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