summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2025-05-23 13:13:02 +0200
committerMichael Brown2025-05-23 13:31:46 +0200
commit4a39b877dd165cc903da2e15cb1c42d1d115cc80 (patch)
tree7886a3d5fba2212561739d99c32ebaf1f66ddcaa /src/include
parent[initrd] Allow for images straddling the top of the reshuffle region (diff)
downloadipxe-4a39b877dd165cc903da2e15cb1c42d1d115cc80.tar.gz
ipxe-4a39b877dd165cc903da2e15cb1c42d1d115cc80.tar.xz
ipxe-4a39b877dd165cc903da2e15cb1c42d1d115cc80.zip
[initrd] Split out initrd construction from bzimage.c
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>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/initrd.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/include/ipxe/initrd.h b/src/include/ipxe/initrd.h
index 10533b53b..0b955a381 100644
--- a/src/include/ipxe/initrd.h
+++ b/src/include/ipxe/initrd.h
@@ -10,13 +10,15 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
-
-extern void initrd_reshuffle ( physaddr_t bottom );
-extern int initrd_reshuffle_check ( size_t len, physaddr_t bottom );
+#include <ipxe/memmap.h>
/** Initial ramdisk chunk alignment */
#define INITRD_ALIGN 4096
+extern void initrd_reshuffle ( void );
+extern int initrd_region ( size_t len, struct memmap_region *region );
+extern size_t initrd_load_all ( void *address );
+
/**
* Align initrd length
*
@@ -29,4 +31,15 @@ initrd_align ( size_t len ) {
return ( ( len + INITRD_ALIGN - 1 ) & ~( INITRD_ALIGN - 1 ) );
}
+/**
+ * Get required length for initrds
+ *
+ * @ret len Required length
+ */
+static inline __attribute__ (( always_inline )) size_t
+initrd_len ( void ) {
+
+ return initrd_load_all ( NULL );
+}
+
#endif /* _IPXE_INITRD_H */