fosslinux / live-bootstrap

Use of a Linux initramfs to fully automate the bootstrapping process
482 stars 32 forks source link

Replace hardcoded memory map in kexec-fiwix with proper e820 passthrough #332

Closed Googulator closed 6 months ago

Googulator commented 9 months ago

Kexec-fiwix hardcodes the memory map used by qemu with the particular settings used in live-bootstrap. This can cause problems when bootstrapping on bare metal with a BIOS that reserves memory ranges that would be available in qemu, as well as preventing bootstrap on anything less than 4GB RAM, of which only 3GB ends up usable.

It would be much better if kexec-fiwix could actually query the BIOS using the real e820 mechanism, and pass the received mapping on to Fiwix (which then passes it to Linux).

Googulator commented 6 months ago

This was implemented in #437 for Fiwix & Linux. Builder-hex2 is responsible for querying the memory map (still in 16-bit mode), but it doesn't directly utilize it, instead using a fixed memory map that tries to avoid regions typically used by BIOS & MMIO. BIOSes that reserve memory in the middle of the range used by builder-hex2 are currently unsupported - so far, all such "BIOSes" turned out to be UEFIs in CSM mode, and the plan is to support them using the UEFI bootstrap mode and posix-runner.

Note that Fiwix currently has a bug related to this, where the memory map passed to Linux after kexec is slightly incorrect, see https://github.com/mikaku/Fiwix/issues/72