diff options
Diffstat (limited to 'mdk-stage1/stage1.c')
| -rw-r--r-- | mdk-stage1/stage1.c | 81 |
1 files changed, 34 insertions, 47 deletions
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index 505bf655c..94bb1e0df 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -1,7 +1,7 @@ /* - * Guillaume Cottenceau (was gc@mandrakesoft.com) + * Guillaume Cottenceau (gc) * - * Copyright 2000-2004 Mandrakesoft + * Copyright 2000-2004 Mandriva * * * This software may be freely redistributed under the terms of the GNU @@ -34,6 +34,7 @@ #include <stdarg.h> #include <signal.h> #include <linux/unistd.h> +#include <libldetect.h> #include "stage1.h" @@ -120,7 +121,7 @@ static pid_t shell_pid = 0; static void spawn_shell(void) { int fd; - char * shell_name[] = { "/sbin/sh", NULL }; + char * shell_name[] = { "/bin/sh", NULL }; log_message("spawning a shell"); @@ -218,22 +219,18 @@ static void spawn_interactive(void) static void handle_pcmcia(void) { char * pcmcia_adapter; - if (kernel_version() == 2) { - stg1_error_message("We now use kernel pcmcia support and this won't work with a 2.2 kernel."); - return; - } pcmcia_adapter = pcmcia_probe(); if (!pcmcia_adapter) { log_message("no pcmcia adapter found"); return; } - my_insmod("pcmcia_core", ANY_DRIVER_TYPE, NULL, 0); - my_insmod(pcmcia_adapter, ANY_DRIVER_TYPE, NULL, 0); + my_modprobe("pcmcia_core", ANY_DRIVER_TYPE, NULL); + my_modprobe(pcmcia_adapter, ANY_DRIVER_TYPE, NULL); /* ds is an alias for pcmcia in recent 2.6 kernels but we don't have modules.alias in install, so try to load both */ - my_insmod("ds", ANY_DRIVER_TYPE, NULL, 0); - my_insmod("pcmcia", ANY_DRIVER_TYPE, NULL, 0); + my_modprobe("ds", ANY_DRIVER_TYPE, NULL); + my_modprobe("pcmcia", ANY_DRIVER_TYPE, NULL); /* setup a dynamic resource database for non statically mapped PCMCIA sockets */ pcmcia_socket_startup(-1); @@ -242,6 +239,20 @@ static void handle_pcmcia(void) } #endif +#ifndef ENABLE_NETWORK_STANDALONE +static void handle_hid(void) +{ + struct hid_entries entry_list; + unsigned int i; + + entry_list = hid_probe(); + for (i = 0; i < entry_list.nb; i++) { + if (entry_list.entries[i].module != NULL) + my_modprobe(entry_list.entries[i].module, ANY_DRIVER_TYPE, NULL); + } + my_modprobe("hid_generic", ANY_DRIVER_TYPE, NULL); +} + /************************************************************ */ @@ -331,47 +342,19 @@ static void method_select_and_prepare(void) /* try to find third party modules on the install media */ thirdparty_load_media_modules(); } - -static enum return_type create_initial_fs_symlinks(char* symlinks) -{ - FILE *f; - char buf[5000]; - - if (scall(!(f = fopen(symlinks, "rb")), "fopen")) - return RETURN_ERROR; - while (fgets(buf, sizeof(buf), f)) { - char oldpath[500], newpath[500]; - buf[strlen(buf)-1] = '\0'; // trim \n - if (sscanf(buf, "%s %s", oldpath, newpath) != 2) { - sprintf(oldpath, "%s%s", STAGE2_LOCATION, buf); - sprintf(newpath, "%s", buf); - } - recursiveRemove_if_it_exists(newpath); - log_message("creating symlink %s -> %s", oldpath, newpath); - if (scall(symlink(oldpath, newpath), "symlink")) - return RETURN_ERROR; - } - fclose(f); - return RETURN_OK; -} +#endif void finish_preparing(void) { - recursiveRemove("/init"); - - if (create_initial_fs_symlinks(STAGE2_LOCATION "/usr/share/symlinks") != RETURN_OK) - stg1_fatal_message("Fatal error finishing initialization."); - - /* /tmp/syslog is used by the second init, so it must be copied now, not in stage2 */ - /* we remove it to ensure the old one is not copied over it in stage2 */ - #ifdef SPAWN_SHELL if (shell_pid != 0) { - int fd; + int fd; + const char *clear = "\033[H\033[J"; kill(shell_pid, 9); + log_message("killed shell"); fd = open("/dev/tty2", O_RDWR); - write(fd, "Killed\n", 7); - close(fd); + write(fd, clear, strlen(clear)); + close(fd); } #endif } @@ -408,6 +391,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) init_modules_insmoding(); init_frontend("Welcome to " DISTRIB_DESCR ", " __DATE__ " " __TIME__); + probe_that_type(VIRTIO_DEVICES, BUS_ANY); + /* load usb interface as soon as possible, helps usb mouse detection in stage2 */ probe_that_type(USB_CONTROLLERS, BUS_USB); @@ -419,6 +404,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) handle_pcmcia(); #endif + handle_hid(); + if (IS_CHANGEDISK) stg1_info_message("You are starting the installation with an alternate booting method. " "Please change your disk, and insert the Installation disk."); @@ -450,7 +437,7 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) if (IS_RESCUE) return 66; /* ask init to exec new init */ - else - return 0x35; /* ask init to run stage2 binary */ + + return 0; #endif } |
