summaryrefslogtreecommitdiffstats
path: root/src/image/initrd.c
Commit message (Collapse)AuthorAgeFilesLines
* [memmap] Rename addr/last fields to min/max for clarityMichael Brown2025-05-231-2/+2
| | | | | | | | Use the terminology "min" and "max" for addresses covered by a memory region descriptor, since this is sufficiently intuitive to generally not require further explanation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Squash and shuffle only initrds within the external heapMichael Brown2025-05-231-33/+35
| | | | | | | | | | | | | | | | | Any initrd images that are not within the external heap (e.g. embedded images) do not need to be copied to the external heap for reshuffling, and can just be left in their original locations. Ignore any images that are not already within the external heap (or, more precisely, that are wholly outside of the reshuffle region within the external heap) when squashing and swapping images. This reduces the maximum additional storage required by squashing and swapping to zero, and so ensures that the reshuffling step is guaranteed to succeed under all circumstances. (This is unrelated to the post-reshuffle load region check, which is still required.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Split out initrd construction from bzimage.cMichael Brown2025-05-231-15/+116
| | | | | | | | | Provide a reusable function initrd_load_all() to load all initrds (including any constructed CPIO headers) into a contiguous memory region, and support functions to find the constructed total length and permissible post-reshuffling load address range. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Allow for images straddling the top of the reshuffle regionMichael Brown2025-05-221-1/+8
| | | | | | | | | | | | It is hypothetically possible for external heap memory allocated during driver startup to have been freed before an image was downloaded, which could therefore leave an image straddling the address recorded as the top of the reshuffle region. Allow for this possibility by skipping squashing for any images already straddling (or touching) the top of the reshuffle region. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Rename bzimage_align() to initrd_align()Michael Brown2025-05-221-13/+5Star
| | | | | | | Alignment of initrd lengths is applicable to all Linux kernels, not just those in the x86 bzImage format. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Swap initrds entirely in-place via triple reversalMichael Brown2025-05-221-49/+42Star
| | | | | | | Eliminate the requirement for free space when reshuffling initrds by swapping adjacent initrds using an in-place triple reversal. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uheap] Expose external heap region directlyMichael Brown2025-05-221-21/+16Star
| | | | | | | | | | | | | We currently rely on implicit detection of the external heap region. The INT 15 memory map mangler relies on examining the corresponding in-use memory region, and the initrd reshuffler relies on performing a separate detection of the largest free memory block after startup has completed. Replace these with explicit public symbols to describe the external heap region. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Move initrd reshuffling to be architecture-independent codeMichael Brown2025-05-211-0/+309
| | | | | | | | There is nothing x86-specific in initrd.c, and a variant of the reshuffling logic will be required for executing bare-metal kernels on RISC-V and AArch64. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Kill off the initrd image typeMichael Brown2008-07-081-37/+0Star
| | | | | | | We can just treat all non-kernel images as initrds, which matches our behaviour for multiboot kernels. This allows us to eliminate initrd as an image type, and treat the "initrd" command as just another synonym for "imgfetch".
* Actually, the initrd image should be architecture-independent.Michael Brown2007-01-141-0/+37