wok view linux/stuff/linux-subroot.u @ rev 15844

dosfstools, flac: update WGET_URL
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 27 11:21:33 2014 +0000 (2014-01-27)
parents 8580e54b5284
children db5b03f42dd9
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 efficently the disk space between several distributions
4 - deduplicate files across several distributions
5 - create pseudo snapshots using "cp -al" outside /
6 - test new configurations
7 ...
8 The bad news : you can't remount /
10 --- linux-3.2.53/Documentation/kernel-parameters.txt
11 +++ linux-3.2.53/Documentation/kernel-parameters.txt
12 @@ -2324,8 +2324,9 @@
14 ro [KNL] Mount root device read-only on boot
16 - root= [KNL] Root filesystem
17 + root= [KNL] Root filesystem and root directory
18 See name_to_dev_t comment in init/do_mounts.c.
19 + Format: <root_filesystem>[:root_directory]
21 rootdelay= [KNL] Delay (in seconds) to pause before attempting to
22 mount the root filesystem
23 --- linux-3.2.40/init/do_mounts.c
24 +++ linux-3.2.40/init/do_mounts.c
25 @@ -28,6 +28,7 @@
26 int root_mountflags = MS_RDONLY | MS_SILENT;
27 static char * __initdata root_device_name;
28 static char __initdata saved_root_name[64];
29 +static char __initdata saved_root_directory[256];
30 static int root_wait;
32 dev_t ROOT_DEV;
33 @@ -255,7 +256,20 @@
35 static int __init root_dev_setup(char *line)
36 {
37 + char *s;
38 +
39 + strcpy(saved_root_directory, ".");
40 strlcpy(saved_root_name, line, sizeof(saved_root_name));
41 + s = strchr(saved_root_name, ':');
42 + if (s) {
43 + *s = '\0';
44 + s = strchr(line, ':');
45 + for (s++; *s == '/'; s++);
46 + if (*s) {
47 + strlcpy(saved_root_directory, s,
48 + sizeof(saved_root_directory));
49 + }
50 + }
51 return 1;
52 }
54 @@ -554,5 +568,5 @@
55 out:
56 devtmpfs_mount("dev");
57 sys_mount(".", "/", NULL, MS_MOVE, NULL);
58 - sys_chroot((const char __user __force *)".");
59 + sys_chroot((const char __user __force *)saved_root_directory);
60 }