diff options
Diffstat (limited to 'src/include/ipxe/initrd.h')
| -rw-r--r-- | src/include/ipxe/initrd.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/include/ipxe/initrd.h b/src/include/ipxe/initrd.h new file mode 100644 index 000000000..50788597b --- /dev/null +++ b/src/include/ipxe/initrd.h @@ -0,0 +1,46 @@ +#ifndef _IPXE_INITRD_H +#define _IPXE_INITRD_H + +/** @file + * + * Initial ramdisk (initrd) reshuffling + * + */ + +FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); +FILE_SECBOOT ( PERMITTED ); + +#include <stdint.h> +#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 + * + * @v len Length + * @ret len Aligned length + */ +static inline __attribute__ (( always_inline )) size_t +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 */ |
