summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-10-09 12:45:33 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-10-09 12:45:33 +0000
commita24f74ae570de7f259a032124a3197ce8584d6e6 (patch)
tree709983ef009006c95e04d4b6464ca63861969a97 /mdk-stage1
parentb1f3ab35e1089aadf28eb90dde96ff25a6ea00db (diff)
downloaddrakx-backup-do-not-use-a24f74ae570de7f259a032124a3197ce8584d6e6.tar
drakx-backup-do-not-use-a24f74ae570de7f259a032124a3197ce8584d6e6.tar.gz
drakx-backup-do-not-use-a24f74ae570de7f259a032124a3197ce8584d6e6.tar.bz2
drakx-backup-do-not-use-a24f74ae570de7f259a032124a3197ce8584d6e6.tar.xz
drakx-backup-do-not-use-a24f74ae570de7f259a032124a3197ce8584d6e6.zip
create a few devices dynamically in the tmpfs / to start up stage2, so that we don't use devices from the live mount, so that we will be able to umount the live mount
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/stage1.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index c411140a6..b7055ac79 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -407,6 +407,23 @@ int mandrake_move_post(void)
}
fclose(f);
+ // need to create the few devices needed to start up stage2 in a decent manner, we can't symlink or they will keep CD busy
+ // we need only the ones before mounting /dev as devfs
+ if (scall(mkdir(SLASH_LOCATION "/dev", 0755), "mkdir"))
+ return RETURN_ERROR;
+ if (scall(!(f = fopen(IMAGE_LOCATION LIVE_LOCATION "devices", "rb")), "fopen"))
+ return RETURN_ERROR;
+ while (fgets(buf, sizeof(buf), f)) {
+ char name[500], path[500], type;
+ int major, minor;
+ sscanf(buf, "%s %c %d %d", name, &type, &major, &minor);
+ sprintf(path, "%s%s", SLASH_LOCATION, name);
+ log_message("move: creating device %s %c %d %d", path, type, major, minor);
+ if (scall(mknod(path, type == 'c' ? S_IFCHR : S_IFBLK, makedev(major, minor)), "mknod"))
+ return RETURN_ERROR;
+ }
+ fclose(f);
+
log_message("move: pivot_rooting");
// trick so that kernel won't try to mount the root device when initrd exits
if (scall((fd = open("/proc/sys/kernel/real-root-dev", O_WRONLY)) < 0, "open"))