From 3badc5ac30fcc0836a2604146788158b16b64f2d Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 23 Jul 2022 18:20:06 +0200 Subject: init: compile as an elf --- src/user/app/main.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/user/app/main.c') diff --git a/src/user/app/main.c b/src/user/app/main.c index 6672344..28c4aa0 100644 --- a/src/user/app/main.c +++ b/src/user/app/main.c @@ -1,23 +1,21 @@ +#include +#include +#include +#include #include #include -#include -#include #include +#include +#include #include -#include -#include -#include -extern char _bss_start; // provided by the linker -extern char _bss_end; -extern char _initrd; +// extern char _initrd; void read_file(const char *path, size_t len); __attribute__((section(".text.startup"))) int main(void) { - // allocate bss - _syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT); + elf_selfreloc(); file_reopen(stdout, "/com1", 0); printf("preinit\n"); @@ -30,7 +28,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