Mercurial > lcfOS
diff cos/kernel/initrd.c @ 32:3a6a9b929db0
Added initial ramdisk and some virtual file system functions
author | windel |
---|---|
date | Fri, 13 Jan 2012 18:18:17 +0100 |
parents | |
children | 35cc54e078dd |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cos/kernel/initrd.c Fri Jan 13 18:18:17 2012 +0100 @@ -0,0 +1,25 @@ +/* + * Initial ramdisk filesystem driver. + * */ + +#include "kernel.h" + +fs_node_t *initrd_root = 0; + +typedef struct +{ + uint32_t magic; + uint32_t numfiles; +} initrd_header_t; + +fs_node_t* initialize_initrd(uint64_t location) +{ + // We need a valid malloc here! + initrd_root = (fs_node_t*)kmalloc(sizeof(fs_node_t)); + + initrd_header_t *header = (initrd_header_t*)location; + initrd_root->length = header->numfiles; + + return initrd_root; +} +