wok-6.x annotate linux/stuff/linux-subroot.u @ rev 16358

fltk: small fix
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 13 21:11:12 2014 +0200 (2014-04-13)
parents 085ef78705d6
children 9710c298422d
rev   line source
pascal@14760 1 Allow to boot on any directories in a filesystem. You will be able to :
pascal@14760 2 - have several distributions in one partition
pascal@14760 3 - use efficently the disk space between several distributions
pascal@14760 4 - deduplicate files across several distributions
pascal@14760 5 - test new configurations
pascal@14760 6 ...
pascal@14761 7 The bad news : you can't remount /
pascal@14761 8
pascal@15671 9 --- linux-3.2.53/Documentation/kernel-parameters.txt
pascal@15671 10 +++ linux-3.2.53/Documentation/kernel-parameters.txt
pascal@15671 11 @@ -2324,8 +2324,9 @@
pascal@14759 12
pascal@14759 13 ro [KNL] Mount root device read-only on boot
pascal@14759 14
pascal@14759 15 - root= [KNL] Root filesystem
pascal@14759 16 + root= [KNL] Root filesystem and root directory
pascal@14759 17 See name_to_dev_t comment in init/do_mounts.c.
pascal@14759 18 + Format: <root_filesystem>[:root_directory]
pascal@14759 19
pascal@14759 20 rootdelay= [KNL] Delay (in seconds) to pause before attempting to
pascal@14759 21 mount the root filesystem
pascal@14759 22 --- linux-3.2.40/init/do_mounts.c
pascal@14759 23 +++ linux-3.2.40/init/do_mounts.c
pascal@14759 24 @@ -28,6 +28,7 @@
pascal@14759 25 int root_mountflags = MS_RDONLY | MS_SILENT;
pascal@14759 26 static char * __initdata root_device_name;
pascal@14759 27 static char __initdata saved_root_name[64];
pascal@14759 28 +static char __initdata saved_root_directory[256];
pascal@14759 29 static int root_wait;
pascal@14759 30
pascal@14759 31 dev_t ROOT_DEV;
pascal@14759 32 @@ -255,7 +256,20 @@
pascal@14759 33
pascal@14759 34 static int __init root_dev_setup(char *line)
pascal@14759 35 {
pascal@14759 36 + char *s;
pascal@14759 37 +
pascal@14759 38 + strcpy(saved_root_directory, ".");
pascal@14759 39 strlcpy(saved_root_name, line, sizeof(saved_root_name));
pascal@14759 40 + s = strchr(saved_root_name, ':');
pascal@14759 41 + if (s) {
pascal@14759 42 + *s = '\0';
pascal@14759 43 + s = strchr(line, ':');
pascal@14759 44 + for (s++; *s == '/'; s++);
pascal@14759 45 + if (*s) {
pascal@14759 46 + strlcpy(saved_root_directory, s,
pascal@14759 47 + sizeof(saved_root_directory));
pascal@14759 48 + }
pascal@14759 49 + }
pascal@14759 50 return 1;
pascal@14759 51 }
pascal@14759 52
pascal@14759 53 @@ -554,5 +568,5 @@
pascal@14759 54 out:
pascal@14759 55 devtmpfs_mount("dev");
pascal@14759 56 sys_mount(".", "/", NULL, MS_MOVE, NULL);
pascal@14759 57 - sys_chroot((const char __user __force *)".");
pascal@14759 58 + sys_chroot((const char __user __force *)saved_root_directory);
pascal@14759 59 }