wok-6.x view linux/stuff/linux-subroot.u @ rev 17539

apulse: add deps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jan 25 14:19:52 2015 +0100 (2015-01-25)
parents 085ef78705d6
children 9710c298422d
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 - test new configurations
6 ...
7 The bad news : you can't remount /
9 --- linux-3.2.53/Documentation/kernel-parameters.txt
10 +++ linux-3.2.53/Documentation/kernel-parameters.txt
11 @@ -2324,8 +2324,9 @@
13 ro [KNL] Mount root device read-only on boot
15 - root= [KNL] Root filesystem
16 + root= [KNL] Root filesystem and root directory
17 See name_to_dev_t comment in init/do_mounts.c.
18 + Format: <root_filesystem>[:root_directory]
20 rootdelay= [KNL] Delay (in seconds) to pause before attempting to
21 mount the root filesystem
22 --- linux-3.2.40/init/do_mounts.c
23 +++ linux-3.2.40/init/do_mounts.c
24 @@ -28,6 +28,7 @@
25 int root_mountflags = MS_RDONLY | MS_SILENT;
26 static char * __initdata root_device_name;
27 static char __initdata saved_root_name[64];
28 +static char __initdata saved_root_directory[256];
29 static int root_wait;
31 dev_t ROOT_DEV;
32 @@ -255,7 +256,20 @@
34 static int __init root_dev_setup(char *line)
35 {
36 + char *s;
37 +
38 + strcpy(saved_root_directory, ".");
39 strlcpy(saved_root_name, line, sizeof(saved_root_name));
40 + s = strchr(saved_root_name, ':');
41 + if (s) {
42 + *s = '\0';
43 + s = strchr(line, ':');
44 + for (s++; *s == '/'; s++);
45 + if (*s) {
46 + strlcpy(saved_root_directory, s,
47 + sizeof(saved_root_directory));
48 + }
49 + }
50 return 1;
51 }
53 @@ -554,5 +568,5 @@
54 out:
55 devtmpfs_mount("dev");
56 sys_mount(".", "/", NULL, MS_MOVE, NULL);
57 - sys_chroot((const char __user __force *)".");
58 + sys_chroot((const char __user __force *)saved_root_directory);
59 }