diff options
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | init.c | 23 | ||||
-rw-r--r-- | init/init.c | 23 |
4 files changed, 33 insertions, 24 deletions
@@ -16,11 +16,15 @@ the parts you do not need using C++ style (//) comments. After the build is complete a busybox.links file is generated which is then used by 'make install' to create symlinks to the busybox binary for all compiled in functions. By default, 'make install' will place -the symlink forest into `pwd`/busybox_install unless you have defined -the PREFIX environment variable. +the symlink forest into `pwd`/_install unless you have defined the +PREFIX environment variable. Please feed suggestions, bug reports, insults, and bribes back to: Erik Andersen <andersen@lineo.com> <andersee@deban.org> +<blatent plug> +Many thanks to go to Lineo for paying me to work on busybox. +</blatent plug> + @@ -9,6 +9,9 @@ around to it some time. If you have any good ideas, please let me know. * Allow tar to create archives with sockets, devices, and other special files * Add in a mini insmod, rmmod, lsmod +* init clearly needs to support some type of minimalist /etc/inittab. I + currently have _way_ too much policy hardcoded in the source. Adding + support for getty has made me realize how much that sucks. * dnsdomainname * traceroute/nslookup/netstat * rdate @@ -446,9 +446,11 @@ extern int init_main(int argc, char **argv) pid_t pid1 = 0; pid_t pid2 = 0; struct stat statbuf; + char which_vt1[30]; + char which_vt2[30]; const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0}; - const char* const getty1_command[] = { GETTY, GETTY, VT_PRIMARY, 0}; - const char* const getty2_command[] = { GETTY, GETTY, VT_SECONDARY, 0}; + const char* const getty1_command[] = { GETTY, GETTY, "38400", which_vt1, 0}; + const char* const getty2_command[] = { GETTY, GETTY, "38400", which_vt2, 0}; const char* const shell_command[] = { SHELL, "-" SHELL, 0}; const char* const* tty1_command = shell_command; const char* const* tty2_command = shell_command; @@ -516,11 +518,8 @@ extern int init_main(int argc, char **argv) } else message(CONSOLE|LOG, "Mounting /proc: failed!\n"); -fprintf(stderr, "got proc\n"); - /* Make sure there is enough memory to do something useful. */ check_memory(); -fprintf(stderr, "got check_memory\n"); /* Check if we are supposed to be in single user mode */ if ( argc > 1 && (!strcmp(argv[1], "single") || @@ -529,7 +528,6 @@ fprintf(stderr, "got check_memory\n"); tty1_command = shell_command; tty2_command = shell_command; } -fprintf(stderr, "got single\n"); /* Make sure an init script exists before trying to run it */ if (single==FALSE && stat(INITSCRIPT, &statbuf)==0) { @@ -541,19 +539,22 @@ fprintf(stderr, "got single\n"); /* Make sure /sbin/getty exists before trying to run it */ if (stat(GETTY, &statbuf)==0) { char* where; -fprintf(stderr, "\n"); + /* First do tty2 */ wait_for_enter_tty2 = FALSE; - where = strrchr( console, '/'); + where = strrchr( second_console, '/'); if ( where != NULL) { - strcpy( (char*)getty2_command[2], where); + where++; + strncpy( which_vt2, where, sizeof(which_vt2)); } tty2_command = getty2_command; + /* Check on hooking a getty onto tty1 */ if (run_rc == FALSE && single==FALSE) { wait_for_enter_tty1 = FALSE; - where = strrchr( second_console, '/'); + where = strrchr( console, '/'); if ( where != NULL) { - strcpy( (char*)getty1_command[2], where); + where++; + strncpy( which_vt1, where, sizeof(which_vt1)); } tty1_command = getty1_command; } diff --git a/init/init.c b/init/init.c index 3c800b9b2..5203713ca 100644 --- a/init/init.c +++ b/init/init.c @@ -446,9 +446,11 @@ extern int init_main(int argc, char **argv) pid_t pid1 = 0; pid_t pid2 = 0; struct stat statbuf; + char which_vt1[30]; + char which_vt2[30]; const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0}; - const char* const getty1_command[] = { GETTY, GETTY, VT_PRIMARY, 0}; - const char* const getty2_command[] = { GETTY, GETTY, VT_SECONDARY, 0}; + const char* const getty1_command[] = { GETTY, GETTY, "38400", which_vt1, 0}; + const char* const getty2_command[] = { GETTY, GETTY, "38400", which_vt2, 0}; const char* const shell_command[] = { SHELL, "-" SHELL, 0}; const char* const* tty1_command = shell_command; const char* const* tty2_command = shell_command; @@ -516,11 +518,8 @@ extern int init_main(int argc, char **argv) } else message(CONSOLE|LOG, "Mounting /proc: failed!\n"); -fprintf(stderr, "got proc\n"); - /* Make sure there is enough memory to do something useful. */ check_memory(); -fprintf(stderr, "got check_memory\n"); /* Check if we are supposed to be in single user mode */ if ( argc > 1 && (!strcmp(argv[1], "single") || @@ -529,7 +528,6 @@ fprintf(stderr, "got check_memory\n"); tty1_command = shell_command; tty2_command = shell_command; } -fprintf(stderr, "got single\n"); /* Make sure an init script exists before trying to run it */ if (single==FALSE && stat(INITSCRIPT, &statbuf)==0) { @@ -541,19 +539,22 @@ fprintf(stderr, "got single\n"); /* Make sure /sbin/getty exists before trying to run it */ if (stat(GETTY, &statbuf)==0) { char* where; -fprintf(stderr, "\n"); + /* First do tty2 */ wait_for_enter_tty2 = FALSE; - where = strrchr( console, '/'); + where = strrchr( second_console, '/'); if ( where != NULL) { - strcpy( (char*)getty2_command[2], where); + where++; + strncpy( which_vt2, where, sizeof(which_vt2)); } tty2_command = getty2_command; + /* Check on hooking a getty onto tty1 */ if (run_rc == FALSE && single==FALSE) { wait_for_enter_tty1 = FALSE; - where = strrchr( second_console, '/'); + where = strrchr( console, '/'); if ( where != NULL) { - strcpy( (char*)getty1_command[2], where); + where++; + strncpy( which_vt1, where, sizeof(which_vt1)); } tty1_command = getty1_command; } |