From cd38ed4fab012981b656ffed64a03bf90fe9739f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 23 May 2025 16:14:45 +0100 Subject: [lkrn] Support initrd construction for RISC-V bare-metal kernels Use the shared initrd reshuffling and CPIO header construction code for RISC-V bare-metal kernels. This allows for files to be injected into the constructed ("magic") initrd image in exactly the same way as is done for bzImage and UEFI kernels. We append a dummy image encompassing the FDT to the end of the reshuffle list, so that it ends up directly following the constructed initrd in memory (but excluded from the initrd length, which was recorded before constructing the FDT). We also temporarily prepend the kernel binary itself to the reshuffle list. This is guaranteed to be safe (since reshuffling is designed to be unable to fail), and avoids the requirement for the kernel segment to be available before reshuffling. This is useful since current RISC-V bare-metal kernels tend to be distributed as EFI zboot images, which require large temporary allocations from the external heap for the intermediate images created during archive extraction. Signed-off-by: Michael Brown --- src/include/ipxe/lkrn.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/include') diff --git a/src/include/ipxe/lkrn.h b/src/include/ipxe/lkrn.h index 43daa8006..88b4d0485 100644 --- a/src/include/ipxe/lkrn.h +++ b/src/include/ipxe/lkrn.h @@ -52,12 +52,10 @@ struct lkrn_context { physaddr_t ram; /** Entry point */ physaddr_t entry; - /** Device tree */ - physaddr_t fdt; /** Initial ramdisk (if any) */ physaddr_t initrd; - /** Length of initial ramdisk (if any) */ - size_t initrd_len; + /** Device tree */ + physaddr_t fdt; }; /** Compressed kernel image header */ -- cgit v1.2.3-55-g7522