diff options
author | Erwan Velu <erwan@mandriva.org> | 2002-11-07 15:17:53 +0000 |
---|---|---|
committer | Erwan Velu <erwan@mandriva.org> | 2002-11-07 15:17:53 +0000 |
commit | 45d06dd6c409521abce0681a174b60f945223b92 (patch) | |
tree | f5bf88c93ef748fb906532e0f4276a1e27064f6a | |
parent | 04976ea368d59a6989fdcb0a674fe892e5e0d7dd (diff) | |
download | drakx-45d06dd6c409521abce0681a174b60f945223b92.tar drakx-45d06dd6c409521abce0681a174b60f945223b92.tar.gz drakx-45d06dd6c409521abce0681a174b60f945223b92.tar.bz2 drakx-45d06dd6c409521abce0681a174b60f945223b92.tar.xz drakx-45d06dd6c409521abce0681a174b60f945223b92.zip |
SCSI Support is now activated
-rw-r--r-- | kernel/Makefile | 5 | ||||
-rwxr-xr-x | make_boot_img | 5 | ||||
-rw-r--r-- | mdk-stage1/network.c | 61 | ||||
-rw-r--r-- | mdk-stage1/stage1.h | 1 | ||||
-rw-r--r-- | mdk-stage1/url.c | 53 |
5 files changed, 91 insertions, 34 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index 90fad04b6..4f424ea95 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,4 +1,7 @@ -all: all.modules +all: all.modules gen_modules_conf + +gen_modules_conf: + perl gen_modules_conf.pl.pl > ../rescue/tree/ka/gen_modules_conf.pl all.modules: ../mdk-stage1/mar/mar update_kernel list_modules.pm `../tools/specific_arch ./update_kernel` diff --git a/make_boot_img b/make_boot_img index ca1c4a004..80426e64a 100755 --- a/make_boot_img +++ b/make_boot_img @@ -14,7 +14,7 @@ my ($arch) = $Config{archname} =~ /(.*?)-/; rename 'all.kernels', 'kernel/all.kernels'; rename 'all.modules', 'kernel/all.modules'; -$default_append = "ramdisk_size=32000 root=/dev/ram3"; +$DEFAULT_append = "ramdisk_size=32000 root=/dev/ram3"; $default_vga = "vga=788"; $instdir = "mdk-stage1"; @@ -149,6 +149,7 @@ sub entries_append { my $automatic = ""; $automatic = "automatic=method:cdrom" if ($type eq "cdrom"); $automatic = "automatic=method:disk" if ($type eq "hd"); + $automatic = "automatic=method:ka,interface:eth0,network:dhcp $DEFAULT_append rescue rw" if ($type eq "ka"); my @simple_entries = ( linux => "$default_vga", @@ -163,7 +164,7 @@ sub entries_append { my @entries = ( (map { $_->[0] => "$automatic $_->[1]" } group_by2(@simple_entries)), if_(member($type, "cdrom", "all"), oem => "automatic=method:cdrom $default_vga rescue oem rw"), - if_($type eq "all", all => "pcmcia $default_vga"), + if_($type eq "all", all => "pcmcia $default_vga"), ); map { [ $_->[0], "$default_append $_->[1]" ] } diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 5852ffa6f..a1f550f10 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -837,6 +837,7 @@ enum return_type http_prepare(void) enum return_type ka_prepare(void) { kadeploy=1; /* We are in a ka deploy mode*/ + int server_failure=1; /* Number of time we've failed to find a ka server */ enum return_type results; @@ -853,17 +854,65 @@ enum return_type ka_prepare(void) FILE *f = fopen ("/ka/tftpserver","w"); if (f != NULL) - { fprintf(f,"%s\n",inet_ntoa(next_server)); + { fprintf(f,"%s\n",inet_ntoa(next_server)); /* Writing the NEXT_SERVER value of the DHCP Request in the /ka/tftpserver file */ fclose(f); } log_message("KA: Trying to retrieve stage2 from server"); + do { + results=ka_wait_for_stage2(); /* We are trying to get a valid stage 2 (rescue) */ + if (results != RETURN_OK) + return results; + + char dir[255] = STAGE2_LOCATION; + strcat(dir,"/ka"); + DIR *dp = opendir(dir); /* Trying to open STAGE2_LOCATION/ka directory */ + + if (! dp) { /* Does the STAGE2_LOCATION/ka directory exists ? = Does the rescue with ka well downloaded ?*/ + log_message("KA: Server not found !"); + if (umount (STAGE2_LOCATION)) { /* Be sure that the STAGE2_LOCATION isn't mounted after receiving a wrong rescue */ + log_perror("KA: Unable to umount STAGE2"); + } + int cpt; + + if (server_failure++ == KA_MAX_RETRY){ /* if the KA server can't be reach KA_MAX_RETRY times */ + char * reboot_launch[] = { "/sbin/reboot", NULL}; + for (cpt=5; cpt>0; cpt--) { + wait_message("!!! Can t reach a valid KA server !!! (Rebooting in %d sec)",cpt); + sleep (1); + } + execve(reboot_launch[0], reboot_launch, grab_env()); /* Rebooting the computer to avoid infinite loop on ka mode */ + } + + for (cpt=5; cpt>0; cpt--) { + wait_message("KA server not found ! (Try %d/%d in %d sec)",server_failure,KA_MAX_RETRY,cpt); + sleep (1); + } + remove_wait_message(); + results=RETURN_BACK; /* We should try another time*/ + continue; + } + else{ + log_message("KA: Stage 2 downloaded successfully"); + closedir(dp); /* Closing the /ka directory */ + server_failure=1; /* Resetting server_failure */ + results=RETURN_OK; + } + + log_message("KA: Preparing chroot"); + + set_param(MODE_RAMDISK); + + if (IS_RESCUE) { /* if we are in rescue mode */ + save_stuff_for_rescue(); /* Saving resolve.conf */ + if (umount (STAGE2_LOCATION)) { /* Unmounting STAGE2 elseif kernel can't mount it ! */ + log_perror("KA: Unable to umount STAGE2"); + return RETURN_ERROR; + } + } + } while (results == RETURN_BACK); - results=ka_wait_for_stage2(); - - if (results != RETURN_OK) - return results; - + method_name = strdup("ka"); return RETURN_OK; diff --git a/mdk-stage1/stage1.h b/mdk-stage1/stage1.h index 6cda65bf6..ef4b84233 100644 --- a/mdk-stage1/stage1.h +++ b/mdk-stage1/stage1.h @@ -41,6 +41,7 @@ int kadeploy; #define MODE_CHANGEDISK (1 << 10) #define MODE_UPDATEMODULES (1 << 11) #define MODE_NOAUTO (1 << 12) +#define KA_MAX_RETRY 5 #define IS_TESTING (get_param(MODE_TESTING)) #define IS_EXPERT (get_param(MODE_EXPERT)) diff --git a/mdk-stage1/url.c b/mdk-stage1/url.c index 2061264cb..a5687920e 100644 --- a/mdk-stage1/url.c +++ b/mdk-stage1/url.c @@ -508,36 +508,39 @@ int http_download_file(char * hostname, char * remotename, int * size) enum return_type ka_wait_for_stage2(void) { char * ramdisk = "/dev/ram3"; /* warning, verify that this file exists in the initrd*/ - char * ka_launch[] = { "/ka/getStage2.sh", ramdisk, IMAGE_LOCATION, NULL }; + char * ka_launch[] = { "/ka/ka-d-client", "-w","-s","getstage2","-e","(cd /tmp/stage2; tar --extract --read-full-records --same-permissions --numeric-owner --sparse --file - )", NULL }; /* The command line for ka_launch */ + char * mkfs_launch[] = { "/sbin/mke2fs", ramdisk, NULL}; /* The mkfs command for formating the ramdisk */ - log_message("KA: Waiting for stage 2...."); - - log_message("KA: Launching %s",ka_launch[0]); - - int pid,wait_status; - - if (!(pid = fork())) { - execve(ka_launch[0], ka_launch,grab_env()); - printf("KA: Can't execute %s\n<press Enter>\n", ka_launch[0]); - pause(); - return KAERR_CANTFORK; - } - while (wait4(-1, &wait_status, 0, NULL) != pid) {}; - log_message("KA: Stage 2 downloaded successfully"); + log_message("KA: Preparing to receive stage 2...."); - log_message("KA: Preparing chroot"); + int pid,wait_status; - set_param(MODE_RAMDISK); - - if (IS_RESCUE) { - save_stuff_for_rescue(); - if (umount (IMAGE_LOCATION)) { - log_perror("KA: Unable to umount STAGE2"); - return RETURN_ERROR; - } + if (!(pid = fork())) { /* Forking current process for running mkfs */ + close(1); + close(2); + execve(mkfs_launch[0], mkfs_launch,grab_env()); /* Formating the ramdisk */ + printf("KA: Can't execute %s\n<press Enter>\n", mkfs_launch[0]); + pause(); + return KAERR_CANTFORK; } - + while (wait4(-1, &wait_status, 0, NULL) != pid) {}; /* Waiting the end of mkfs */ + + if (my_mount(ramdisk, STAGE2_LOCATION, "ext2", 1)) /* Trying to mount the ramdisk */ + return RETURN_ERROR; + log_message("KA: Waiting for stage 2...."); + wait_message("Waiting for rescue from KA server"); + if (!(pid = fork())) { /* Froking current process for running ka-deploy (client side) */ + close(1); /* Closing stdout */ + close(2); /* Closing stderr */ + execve(ka_launch[0], ka_launch,grab_env()); /* Running ka-deploy (client side) */ + printf("KA: Can't execute %s\n<press Enter>\n", ka_launch[0]); + pause(); + return KAERR_CANTFORK; + } + while (wait4(-1, &wait_status, 0, NULL) != pid) {}; /* Waiting the end of duplication */ + remove_wait_message(); + return RETURN_OK; } |