- do not die when couldn't open console rw

- losetup tweaks
This commit is contained in:
Sergey Bolshakov 2005-02-03 15:38:15 +00:00
parent 2c48d77e2c
commit c199c141b5
6 changed files with 12 additions and 22 deletions

View File

@ -72,12 +72,9 @@ static enum return_type do_with_device(char * dev_name, char * dev_model)
umount(IMAGE_LOCATION);
}
insmod_compressed();
do_losetup(LIVE_DEVICE,get_ramdisk_path(NULL));
if(IS_LIVE)
my_mount(LIVE_DEVICE,STAGE2_LOCATION,LIVEFS, 0);
else
my_mount(LIVE_DEVICE,STAGE2_LOCATION,STAGE2FS, 0);
my_mount(LIVE_DEVICE, STAGE2_LOCATION, (IS_LIVE) ? LIVEFS : STAGE2FS, 0);
method_name = strdup("cdrom");
add_to_env("METHOD", method_name);
add_to_env("PREFIX", "/");
@ -115,7 +112,6 @@ enum return_type cdrom_prepare(void)
my_insmod("ide-cd", ANY_DRIVER_TYPE, NULL);
my_insmod("sr_mod", ANY_DRIVER_TYPE, NULL);
insmod_compressed();
get_medias(CDROM, &medias, &medias_models);

View File

@ -24,8 +24,6 @@
/* If we have more than that amount of memory (in Mbytes), we assume we can load the rescue as a ramdisk */
#define MEM_LIMIT_RESCUE 56
// #define DISTRIB_NAME "ALT Linux Junior 2.2"
#define RAMDISK_COMPRESSION_RATIO 1.95
#define VERSION_FILE "/.VERSION"
@ -38,8 +36,6 @@
#ifndef STAGE2_BINNAME
#define STAGE2_BINNAME "/sbin/init"
#endif
#define insmod_compressed() { my_insmod("zlib_inflate", ANY_DRIVER_TYPE, NULL); my_insmod("cloop", ANY_DRIVER_TYPE, NULL); }
/* user-definable (in Makefile): DISABLE_NETWORK, DISABLE_DISK, DISABLE_CDROM, DISABLE_PCMCIA */

1
disk.c
View File

@ -271,7 +271,6 @@ static enum return_type try_with_device(char *dev_name)
log_message("found the " DISTRIB_NAME " Installation, good news!");
}
insmod_compressed();
do_losetup(LIVE_DEVICE, get_ramdisk_path(iso ? NULL : location_full));
my_mount(LIVE_DEVICE,STAGE2_LOCATION, (IS_LIVE) ? LIVEFS : STAGE2FS, 0);

15
init.c
View File

@ -543,17 +543,16 @@ int main(int argc, char **argv)
fatal_error("overmounting root");
/* chroot, chdir */
if ( chroot(".") || chdir("/") )
if (chroot(".") || chdir("/"))
fatal_error("chroot");
/* Open /dev/console */
if ( (fd = open("/dev/console", O_RDWR)) < 0 )
fatal_error("opening console");
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
close(fd);
if ((fd = open("/dev/console", O_RDWR)) != -1) {
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
close(fd);
}
/* Check for given init */
if (stat(stage2_argv[0], &ist) || !S_ISREG(ist.st_mode))

View File

@ -672,7 +672,6 @@ enum return_type nfs_prepare(void)
if (S_ISDIR(st.st_mode)) {
mount(ramdisk_path, STAGE2_LOCATION, NULL, MS_BIND, NULL);
} else {
insmod_compressed();
do_losetup(LIVE_DEVICE,ramdisk_path);
my_mount(LIVE_DEVICE, STAGE2_LOCATION, (IS_LIVE) ? LIVEFS : STAGE2FS, 0);
}

View File

@ -292,8 +292,6 @@ enum return_type load_ramdisk_fd(int source_fd, int size)
close(ram_fd);
insmod_compressed();
if (do_losetup(LIVE_DEVICE, ramdisk) == -1)
fatal_error("could not setup loopback for loaded second stage");
@ -457,6 +455,9 @@ int do_losetup(char * device, char * target)
{
int loopfd, targfd;
struct loop_info loopInfo;
my_insmod("cloop", ANY_DRIVER_TYPE, NULL);
loopfd = open( device, O_RDONLY );
if ( loopfd < 0 )
{