logo

bootstrap-initrd

Linux initrd generator to bootstrap a POSIX-ish system from a reasonably small binary seed git clone https://hacktivis.me/git/make-initrd.git
commit: 751dc15d36dce8349d25237fa06481f034971a97
parent 883896b593f60f67738fc3065cbdf8a4e132ea74
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 27 Apr 2024 20:23:11 +0200

init.c: Clean out commended out code for creating nodes in /dev

Diffstat:

Minit.c42------------------------------------------
1 file changed, 0 insertions(+), 42 deletions(-)

diff --git a/init.c b/init.c @@ -61,11 +61,6 @@ main(int argc, char *argv[]) setenv("PATH", "/bin", 1); if(build_mrsh() < 0) return 1; - //e_mknod("/dev/null", S_IFCHR|0666, makedev(0x1, 0x3)); - //e_mknod("/dev/tty", S_IFCHR|0666, makedev(0x5, 0x0)); - //e_mknod("/dev/tty1", S_IFCHR|0620, makedev(0x4, 0x1)); - //e_mknod("/dev/console", S_IFCHR|0660, makedev(0x5, 0x1)); - if(mount("sysfs", "/sys", "sysfs", MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_RELATIME, NULL) < 0) fprintf(stderr, "Failed to mount /sys: %s\n", strerror(errno)); @@ -75,43 +70,6 @@ main(int argc, char *argv[]) if(mount("devtmpfs", "/dev", "devtmpfs", MS_NOSUID|MS_NOEXEC, NULL) < 0) fprintf(stderr, "Failed to mount /proc: %s\n", strerror(errno)); -#if 0 - int console_ro = open("/dev/console", O_RDONLY); - if(console_ro < 0) - { - fprintf(stderr, "Failed ro-opening /dev/console: %s\n", strerror(errno)); - return 1; - } - - // turn stdin into /dev/console - if(dup2(console_ro, 0) < 0) - { - fprintf(stderr, "Failed setting /dev/console as stdin: %s\n", strerror(errno)); - return 1; - } - - int console_wo = open("/dev/console", O_WRONLY); - if(console_wo < 0) - { - fprintf(stderr, "Failed wo-opening /dev/console: %s\n", strerror(errno)); - return 1; - } - - // turn stdout into /dev/console - if(dup2(console_wo, 1) < 0) - { - fprintf(stderr, "Failed setting /dev/console as stdout: %s\n", strerror(errno)); - return 1; - } - - // turn stderr into /dev/console - if(dup2(console_wo, 2) < 0) - { - fprintf(stderr, "Failed setting /dev/console as stderr: %s\n", strerror(errno)); - return 1; - } -#endif - fprintf(stderr, "Launching: /bin/mrsh /init.sh\n"); setenv("PS1", "> ", 1);