aboutsummaryrefslogtreecommitdiffstats
path: root/include/initrd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/initrd.h')
-rw-r--r--include/initrd.h40
1 files changed, 35 insertions, 5 deletions
diff --git a/include/initrd.h b/include/initrd.h
index 9c7a9de..de730f2 100644
--- a/include/initrd.h
+++ b/include/initrd.h
@@ -1,23 +1,53 @@
+/**
+ * @file initrd.h
+ * Initrd image support
+ * An archive file (made with ar) can be linked into the final executable to
+ * allow files to be loaded in memory on boot. See mkinitrd.sh or the Makefile
+ * for more info.
+ */
+
#ifndef INITRD_H_
#define INITRD_H_
#include <stdint.h>
+/**
+ * Structure for the archive's header.
+ */
typedef struct
{
- char signature[8];
+ char signature[8]; /**< The archive's signature. */
} __attribute__ ((packed)) initrd_header;
+/**
+ * Structure for a file entry in the archive.
+ */
typedef struct
{
- char name[16];
- uint8_t unused[32];
- char size[10];
- char sig[2];
+ char name[16]; /**< The name of the file. */
+ uint8_t unused[32]; /**< Unused information. */
+ char size[10]; /**< The file's size in bytes (as string). */
+ char sig[2]; /**< A signature to start file data. */
} __attribute__ ((packed)) initrd_file;
+/**
+ * Confirms the initrd image is loaded and valid.
+ * @return non-zero if valid image found
+ */
uint8_t initrd_validate(void);
+
+/**
+ * Gets contents of the given file.
+ * @param name the file's name
+ * @return pointer to file data, null if not found
+ */
char *initrd_getfile(const char *name);
+
+/**
+ * Gets the size of the given file.
+ * @param name the file's name
+ * @return the file's size, in bytes
+ */
uint32_t initrd_getfilesize(const char *name);
#endif // INITRD_H_