mirror of
https://github.com/ipxe/ipxe
synced 2025-12-12 14:32:49 +03:00
[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>
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user