wok-undigest annotate linux/stuff/linux-subroot.u @ rev 1087

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