IsaacWoods / poplar

Microkernel and userspace written in Rust exploring modern ideas
https://poplar.isaacwoods.dev
Mozilla Public License 2.0
251 stars 8 forks source link

Move to EFISTUB-like bootloader on x86_64 #45

Closed IsaacWoods closed 4 years ago

IsaacWoods commented 4 years ago

Instead of having a separate bootloader on x86_64, do what Linux can do and construct a fake PE image that contains the kernel image, and move the UEFI bootstrapping code from the current bootloader into the kernel.

IsaacWoods commented 4 years ago

This seems like it's more difficult than it seems; the final product needs to be a PE file that contains both code that runs in the identity-mapped UEFI environment, plus the kernel code. This unfortunately means we need at least two top-level crates linked indendently (as far as I can see).

Since we can't merge the crates, we might as well go the route that e.g. Linux goes and just include the full kernel image in the PE (we could add a decompression step later) and then parse and relocate it in the identity-mapped stub.

It also looks like the UEFI PE loader is a bit fragile (on Tianocore, anyways), and so we need to look more carefully into where to put the kernel image within the PE.

IsaacWoods commented 4 years ago

I no longer think this is a good use of time and complexity for now. Having a separate loader is fine.