summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/initrd.h
diff options
context:
space:
mode:
authorSimon Rettberg2026-01-28 12:53:53 +0100
committerSimon Rettberg2026-01-28 12:53:53 +0100
commit8e82785c584dc13e20f9229decb95bd17bbe9cd1 (patch)
treea8b359e59196be5b2e3862bed189107f4bc9975f /src/include/ipxe/initrd.h
parentMerge branch 'master' into openslx (diff)
parent[prefix] Make unlzma.S compatible with 386 class CPUs (diff)
downloadipxe-openslx.tar.gz
ipxe-openslx.tar.xz
ipxe-openslx.zip
Merge branch 'master' into openslxopenslx
Diffstat (limited to 'src/include/ipxe/initrd.h')
-rw-r--r--src/include/ipxe/initrd.h46
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 */