#include #include #include #include #include #include "tar.h" extern char _bss_start; extern char _bss_end; extern char _initrd; __attribute__((section(".text.startup"))) void _start(void) { _syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT); /* move everything provided by the kernel to /kdev */ MOUNT_AT("/kdev/") { fs_passthru(NULL); } MOUNT_AT("/") { const char *l[] = {"/kdev/", NULL}; fs_whitelist(l); } MOUNT_AT("/init/") { tar_driver(&_initrd); } const char *initpath = "bin/amd64/init"; void *init = tar_find(initpath, strlen(initpath), &_initrd, ~0) + 512; if (init) { _klogf("execing init"); elf_exec(init, NULL, NULL); _klogf("elf_exec failed"); } else { _klogf("couldn't find init.elf"); } _syscall_exit(1); }