made things working:

- ramdisk name calculating
- lowmem parameter, ramdisk will not be loaded, if specified
- stagename parameter appeared, eq "altinst" if not specified
This commit is contained in:
Sergey Bolshakov 2005-03-05 15:26:22 +00:00
parent 17e0f8ab65
commit 1d2720df30
6 changed files with 23 additions and 41 deletions

View File

@ -68,7 +68,7 @@ static enum return_type do_with_device(char * dev_name, char * dev_model)
log_message("found a " DISTRIB_NAME " CDROM, good news!");
if (IS_RESCUE) {
load_ramdisk();
load_ramdisk(NULL);
umount(IMAGE_LOCATION);
}

33
disk.c
View File

@ -242,26 +242,6 @@ static enum return_type try_with_device(char *dev_name)
add_to_env("PIGGYBACK", "1");
}
if (IS_SPECIAL_STAGE2 || ramdisk_possible()) {
/* RAMDISK install */
if (access(IMAGE_LOCATION RAMDISK_LOCATION, R_OK)) {
stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
"(I need the subdirectory " RAMDISK_LOCATION ")\n"
"Here's a short extract of the files in the directory:\n"
"%s", disk_extract_list_directory(IMAGE_LOCATION));
loumount();
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
if (load_ramdisk() != RETURN_OK) {
stg1_error_message("Could not load program into memory.");
loumount();
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
} else {
/* LIVE install */
char p;
if (access(get_ramdisk_path(iso ? NULL : location_full), R_OK)) {
stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
"Here's a short extract of the files in the directory:\n"
@ -270,11 +250,20 @@ static enum return_type try_with_device(char *dev_name)
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
log_message("found the " DISTRIB_NAME " Installation, good news!");
}
log_message("found the " DISTRIB_NAME " Installation, good news!");
if (!IS_LOWMEM && ramdisk_possible()) {
if (load_ramdisk(iso ? NULL : location_full) != RETURN_OK) {
stg1_error_message("Could not load program into memory.");
loumount();
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
} else {
do_losetup(LIVE_DEVICE, get_ramdisk_path(iso ? NULL : location_full));
my_mount(LIVE_DEVICE, STAGE2_LOCATION, (IS_LIVE) ? LIVEFS : STAGE2FS, 0);
}
method_name = strdup("disk");
add_to_env("DEVICE", choice);

View File

@ -396,10 +396,6 @@ int main(int argc, char **argv, char **env)
handle_pcmcia(&pcmcia_adapter);
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.");
if (IS_RESCUE && total_memory() < MEM_LIMIT_RESCUE) {
stg1_error_message("You are starting the rescue with a low memory configuration. "
"From that point, experience showed us that the program may stop "

View File

@ -37,7 +37,7 @@ extern char * interactive_fifo;
#define MODE_RESCUE (1 << 3)
#define MODE_AUTOMATIC (1 << 4)
#define MODE_LOWMEM (1 << 5)
#define MODE_SPECIAL_STAGE2 (1 << 8)
#define MODE_STAGENAME (1 << 8)
#define MODE_RAMDISK (1 << 9)
#define MODE_CHANGEDISK (1 << 10)
#define MODE_UPDATEMODULES (1 << 11)
@ -48,7 +48,7 @@ extern char * interactive_fifo;
#define IS_LIVE (get_param(MODE_LIVE))
#define IS_AUTOMATIC (get_param(MODE_AUTOMATIC))
#define IS_LOWMEM (get_param(MODE_LOWMEM))
#define IS_SPECIAL_STAGE2 (get_param(MODE_SPECIAL_STAGE2))
#define IS_STAGENAME (get_param(MODE_STAGENAME))
#define IS_RAMDISK (get_param(MODE_RAMDISK))
#define IS_CHANGEDISK (get_param(MODE_CHANGEDISK))
#define IS_UPDATEMODULES (get_param(MODE_UPDATEMODULES))

15
tools.c
View File

@ -93,7 +93,7 @@ void process_cmdline(void)
if (!strcmp(name, "updatemodules")) set_param(MODE_UPDATEMODULES);
if (!strcmp(name, "rescue")) set_param(MODE_RESCUE);
if (!strcmp(name, "live")) set_param(MODE_LIVE);
if (!strcmp(name, "special_stage2")) set_param(MODE_SPECIAL_STAGE2);
if (!strcmp(name, "stagename")) set_param(MODE_STAGENAME);
if (!strcmp(name, "lowmem")) set_param(MODE_LOWMEM);
if (!strcmp(name, "automatic")) {
set_param(MODE_AUTOMATIC);
@ -168,8 +168,8 @@ void set_param(int i)
{
stage1_mode |= i;
if (i == MODE_RESCUE) {
set_param_valued("special_stage2", "rescue");
set_param(MODE_SPECIAL_STAGE2);
set_param_valued("stagename", "rescue");
set_param(MODE_STAGENAME);
}
}
@ -315,15 +315,12 @@ enum return_type load_ramdisk_fd(int source_fd, int size)
char * get_ramdisk_realname(void)
{
char img_name[500];
char * stg2_name = get_param_valued("special_stage2");
char * stg2_name = get_param_valued("stagename");
char * begin_img = RAMDISK_LOCATION;
if (!stg2_name)
stg2_name = "altinst";
if (IS_LIVE)
stg2_name = "altlinux";
strcpy(img_name, begin_img);
strcat(img_name, stg2_name);
@ -341,13 +338,13 @@ char * get_ramdisk_path(char *mount_path)
return strdup(img_name);
}
enum return_type load_ramdisk(void)
enum return_type load_ramdisk(char *mount_path)
{
int st2_fd;
struct stat statr;
char img_name[500];
strcpy(img_name, IMAGE_LOCATION);
strcpy(img_name, mount_path ? mount_path : IMAGE_LOCATION);
strcat(img_name, get_ramdisk_realname());
log_message("trying to load %s as a ramdisk", img_name);

View File

@ -32,7 +32,7 @@ int charstar_to_int(char * s);
int total_memory(void);
int ramdisk_possible(void);
char * get_ramdisk_realname(void);
enum return_type load_ramdisk(void);
enum return_type load_ramdisk(char *);
enum return_type load_ramdisk_fd(int ramdisk_fd, int size);
void * memdup(void *src, size_t size);
void add_to_env(char * name, char * value);