refactor(aarch64,riscv64): unify kernel image detection#607
Conversation
mkroening
left a comment
There was a problem hiding this comment.
We already have similar code for RISC-V: https://github.com/hermit-os/loader/blob/v0.5.6/src/arch/riscv64/mod.rs#L21-L51
It might make sense to unify them as methods on an trait FdtExt, but that might not be worth the effort. You can decide. :)
|
Ah, I didn't even bother checking the RISC-V code. That one is also slightly prettier than this approach. I'll try the |
80527af to
baa7cc9
Compare
This unifies the kernel image detection for both aarch64 and riscv64. riscv64 was incorrectly using the length of the module reg as the size of the kernel image, which was always 0, which is fixed by using the approach taken by the aarch64 code to parse the ELF header. On the other hand, aarch64 now falls back to linux,initrd-start and linux,initrd-end for detecting the kernel image thanks to these changes, which is necessary for cloud-hypervisor at the moment.
baa7cc9 to
3725077
Compare
|
CI on aarch64 fails because the fdt is... invalid as far as I can tell. |
This unifies the kernel image detection for both aarch64 and riscv64. riscv64 was incorrectly using the length of the module reg as the size of the kernel image, which was always 0, which is fixed by using the approach taken by the aarch64 code to parse the ELF header. On the other hand, aarch64 now falls back to linux,initrd-start and linux,initrd-end for detecting the kernel image thanks to these changes, which is necessary for cloud-hypervisor at the moment.