summaryrefslogtreecommitdiff
path: root/src/init/main.c
diff options
context:
space:
mode:
authordzwdz2022-07-01 21:41:21 +0200
committerdzwdz2022-07-01 21:41:21 +0200
commitcf8ec3d3623f24cec91025ebdf1237935a970e40 (patch)
treea5176ff53f6a0371729575ce919d4766478e0848 /src/init/main.c
parent5af715e76d65e0c8e5f9e3f066ae66475958689f (diff)
init/fs: move the kernel stuff to /kdev/
Diffstat (limited to 'src/init/main.c')
-rw-r--r--src/init/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 9afb2a7..705da8f 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -22,6 +22,14 @@ int main(void) {
file_open(&__stdout, "/com1", 0);
printf("preinit\n");
+ /* move everything provided by the kernel to /kdev */
+ MOUNT("/kdev/", fs_passthru(NULL));
+ if (!fork2_n_mount("/")) {
+ const char *l[] = {"/kdev/", NULL};
+ fs_whitelist(l);
+ }
+ if (!fork2_n_mount("/")) fs_dir_inject("/kdev/"); // TODO should be part of fs_whitelist
+
MOUNT("/init/", tar_driver(&_initrd));
MOUNT("/tmp/", tmpfs_drv());
MOUNT("/keyboard", ps2_drv());
@@ -49,7 +57,7 @@ int main(void) {
}
if (!_syscall_fork(0, NULL)) {
- if (file_open(&__stdout, "/com1", 0) < 0 || file_open(&__stdin, "/com1", 0) < 0)
+ if (file_open(&__stdout, "/kdev/com1", 0) < 0 || file_open(&__stdin, "/kdev/com1", 0) < 0)
_syscall_exit(1);
shell_loop();
@@ -72,8 +80,8 @@ int main(void) {
// try to find any working output
- if (file_open(&__stdout, "/com1", 0) < 0)
- file_open(&__stdout, "/vga_tty", 0);
+ if (file_open(&__stdout, "/kdev/com1", 0) < 0)
+ file_open(&__stdout, "/kdev/vga_tty", 0);
_syscall_await();
printf("init: quitting\n");