mirror of
https://github.com/ipxe/ipxe
synced 2025-12-17 01:52:08 +03:00
[cpio] Split out bzImage initrd CPIO header construction
iPXE will construct CPIO headers for images that have a non-empty command line, thereby allowing raw images (without CPIO headers) to be injected into a dynamically constructed initrd. This feature is currently implemented within the BIOS-only bzImage format support. Split out the CPIO header construction logic to allow for reuse in other contexts such as in a UEFI build. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/image.h>
|
||||
|
||||
/** A CPIO archive header
|
||||
*
|
||||
* All field are hexadecimal ASCII numbers padded with '0' on the
|
||||
@@ -48,6 +50,25 @@ struct cpio_header {
|
||||
/** CPIO magic */
|
||||
#define CPIO_MAGIC "070701"
|
||||
|
||||
/** CPIO header length alignment */
|
||||
#define CPIO_ALIGN 4
|
||||
|
||||
/** Alignment for CPIO archives within an initrd */
|
||||
#define INITRD_ALIGN 4096
|
||||
|
||||
/**
|
||||
* Get CPIO image name
|
||||
*
|
||||
* @v image Image
|
||||
* @ret name Image name (not NUL terminated)
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) const char *
|
||||
cpio_name ( struct image *image ) {
|
||||
return image->cmdline;
|
||||
}
|
||||
|
||||
extern void cpio_set_field ( char *field, unsigned long value );
|
||||
extern size_t cpio_name_len ( struct image *image );
|
||||
extern size_t cpio_header ( struct image *image, struct cpio_header *cpio );
|
||||
|
||||
#endif /* _IPXE_CPIO_H */
|
||||
|
||||
Reference in New Issue
Block a user