From 20c7b5be3bbb5f56a31536c018e20706100f57ae Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 23 Jul 2022 19:28:43 +0200 Subject: user_bootstrap: pass the initrd in an argument to init's main --- src/user/app/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/user/app') diff --git a/src/user/app/main.c b/src/user/app/main.c index 28c4aa0..9f4d50c 100644 --- a/src/user/app/main.c +++ b/src/user/app/main.c @@ -9,16 +9,17 @@ #include #include -// extern char _initrd; +__attribute__((visibility("hidden"))) +extern char _image_base[]; void read_file(const char *path, size_t len); __attribute__((section(".text.startup"))) -int main(void) { +int main(void *initrd) { elf_selfreloc(); file_reopen(stdout, "/com1", 0); - printf("preinit\n"); + printf("in init, loaded at 0x%x\n", &_image_base); /* move everything provided by the kernel to /kdev */ MOUNT("/kdev/", fs_passthru(NULL)); @@ -28,7 +29,7 @@ int main(void) { } if (!fork2_n_mount("/")) fs_dir_inject("/kdev/"); // TODO should be part of fs_whitelist - // MOUNT("/init/", tar_driver(&_initrd)); + MOUNT("/init/", tar_driver(initrd)); MOUNT("/tmp/", tmpfs_drv()); MOUNT("/keyboard", ps2_drv()); MOUNT("/vga_tty", ansiterm_drv()); -- cgit v1.2.3