]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[lkrn] Support initrd construction for RISC-V bare-metal kernels
authorMichael Brown <mcb30@ipxe.org>
Fri, 23 May 2025 15:14:45 +0000 (16:14 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 23 May 2025 15:14:45 +0000 (16:14 +0100)
commitcd38ed4fab012981b656ffed64a03bf90fe9739f
treef8030bced353d1c5367efd0abbea846d9901f0f1
parentc713ce5c7bb1cf5a1c6ea75a67a8ee8c8d118c10
[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 <mcb30@ipxe.org>
src/image/lkrn.c
src/include/ipxe/lkrn.h