wok view linux/stuff/linux-subroot.u @ rev 25313
updated smplayer (20.6.0 -> 22.7.0)
author | Hans-G?nter Theisgen |
---|---|
date | Wed Jul 20 17:42:27 2022 +0100 (2022-07-20) |
parents | ffc20f9bd49f |
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 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.16.53/Documentation/kernel-parameters.txt
10 +++ linux-3.16.53/Documentation/kernel-parameters.txt
11 @@ -3017,8 +3017,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.16.53/init/do_mounts.c
23 +++ linux-3.16.53/init/do_mounts.c
24 @@ -40,6 +40,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 @@ -288,7 +289,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 @@ -590,7 +604,7 @@
54 out:
55 devtmpfs_mount("dev");
56 sys_mount(".", "/", NULL, MS_MOVE, NULL);
57 - sys_chroot(".");
58 + sys_chroot(saved_root_directory);
59 }
61 static bool is_tmpfs;