wok-backports annotate linux/stuff/linux-subroot.u2 @ rev 0

Add linux
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Dec 18 15:14:49 2013 +0000 (2013-12-18)
parents
children
rev   line source
pascal@0 1 Allow to boot on any directories in a filesystem. You will be able to :
pascal@0 2 - have several distributions in one partition
pascal@0 3 - use effectively the disk space between several distributions
pascal@0 4 - deduplicate files across several distributions
pascal@0 5
pascal@0 6 The bad news : you can't remount /
pascal@0 7
pascal@0 8 example: bzImage rw root=/dev/sda1:/var/os/slitaz-4.0 screen=1024x768x24
pascal@0 9
pascal@0 10 Signed-off-by: Pascal Bellard <pascal.bellard@slitaz.org>
pascal@0 11 --- linux-3.2.40/Documentation/kernel-parameters.txt
pascal@0 12 +++ linux-3.2.40/Documentation/kernel-parameters.txt
pascal@0 13 @@ -2304,8 +2304,9 @@
pascal@0 14
pascal@0 15 ro [KNL] Mount root device read-only on boot
pascal@0 16
pascal@0 17 - root= [KNL] Root filesystem
pascal@0 18 + root= [KNL] Root filesystem and root directory
pascal@0 19 See name_to_dev_t comment in init/do_mounts.c.
pascal@0 20 + Format: <root_filesystem>[:root_directory]
pascal@0 21
pascal@0 22 rootdelay= [KNL] Delay (in seconds) to pause before attempting to
pascal@0 23 mount the root filesystem
pascal@0 24 --- linux-3.2.40/init/do_mounts.c
pascal@0 25 +++ linux-3.2.40/init/do_mounts.c
pascal@0 26 @@ -28,6 +28,7 @@
pascal@0 27 int root_mountflags = MS_RDONLY | MS_SILENT;
pascal@0 28 static char * __initdata root_device_name;
pascal@0 29 static char __initdata saved_root_name[64];
pascal@0 30 +static char __initdata saved_root_directory[256];
pascal@0 31 static int root_wait;
pascal@0 32
pascal@0 33 dev_t ROOT_DEV;
pascal@0 34 @@ -255,7 +256,20 @@
pascal@0 35
pascal@0 36 static int __init root_dev_setup(char *line)
pascal@0 37 {
pascal@0 38 + char *s;
pascal@0 39 +
pascal@0 40 + strcpy(saved_root_directory, ".");
pascal@0 41 strlcpy(saved_root_name, line, sizeof(saved_root_name));
pascal@0 42 + s = strchr(saved_root_name, ':');
pascal@0 43 + if (s) {
pascal@0 44 + *s = '\0';
pascal@0 45 + s = strchr(line, ':') + 1;
pascal@0 46 + while (*s == '/')
pascal@0 47 + s++;
pascal@0 48 + if (*s)
pascal@0 49 + strlcpy(saved_root_directory, s,
pascal@0 50 + sizeof(saved_root_directory));
pascal@0 51 + }
pascal@0 52 return 1;
pascal@0 53 }
pascal@0 54
pascal@0 55 @@ -554,5 +568,5 @@
pascal@0 56 out:
pascal@0 57 devtmpfs_mount("dev");
pascal@0 58 sys_mount(".", "/", NULL, MS_MOVE, NULL);
pascal@0 59 - sys_chroot((const char __user __force *)".");
pascal@0 60 + sys_chroot((const char __user __force *)saved_root_directory);
pascal@0 61 }