wok annotate linux/stuff/linux-subroot.u @ rev 20334

Do not use efi shell (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 02 16:13:06 2018 +0200 (20 months ago)
parents ffc20f9bd49f
children
rev   line source
pascal@14760 1 Allow to boot on any directories in a filesystem. You will be able to :
pascal@14760 2 - have several distributions in one partition
pascal@14760 3 - use efficently the disk space between several distributions
pascal@14760 4 - deduplicate files across several distributions
pascal@14760 5 - test new configurations
pascal@14760 6 ...
pascal@14761 7 The bad news : you can't remount /
pascal@14761 8
pascal@20261 9 --- linux-3.16.53/Documentation/kernel-parameters.txt
pascal@20261 10 +++ linux-3.16.53/Documentation/kernel-parameters.txt
pascal@20261 11 @@ -3017,8 +3017,9 @@
pascal@14759 12
pascal@14759 13 ro [KNL] Mount root device read-only on boot
pascal@14759 14
pascal@14759 15 - root= [KNL] Root filesystem
pascal@14759 16 + root= [KNL] Root filesystem and root directory
pascal@14759 17 See name_to_dev_t comment in init/do_mounts.c.
pascal@14759 18 + Format: <root_filesystem>[:root_directory]
pascal@14759 19
pascal@14759 20 rootdelay= [KNL] Delay (in seconds) to pause before attempting to
pascal@14759 21 mount the root filesystem
pascal@20261 22 --- linux-3.16.53/init/do_mounts.c
pascal@20261 23 +++ linux-3.16.53/init/do_mounts.c
pascal@20261 24 @@ -40,6 +40,7 @@
pascal@14759 25 int root_mountflags = MS_RDONLY | MS_SILENT;
pascal@14759 26 static char * __initdata root_device_name;
pascal@14759 27 static char __initdata saved_root_name[64];
pascal@14759 28 +static char __initdata saved_root_directory[256];
pascal@14759 29 static int root_wait;
pascal@14759 30
pascal@14759 31 dev_t ROOT_DEV;
pascal@20261 32 @@ -288,7 +289,20 @@
pascal@14759 33
pascal@14759 34 static int __init root_dev_setup(char *line)
pascal@14759 35 {
pascal@14759 36 + char *s;
pascal@14759 37 +
pascal@14759 38 + strcpy(saved_root_directory, ".");
pascal@14759 39 strlcpy(saved_root_name, line, sizeof(saved_root_name));
pascal@14759 40 + s = strchr(saved_root_name, ':');
pascal@14759 41 + if (s) {
pascal@14759 42 + *s = '\0';
pascal@14759 43 + s = strchr(line, ':');
pascal@14759 44 + for (s++; *s == '/'; s++);
pascal@14759 45 + if (*s) {
pascal@14759 46 + strlcpy(saved_root_directory, s,
pascal@14759 47 + sizeof(saved_root_directory));
pascal@14759 48 + }
pascal@14759 49 + }
pascal@14759 50 return 1;
pascal@14759 51 }
pascal@14759 52
pascal@20261 53 @@ -590,7 +604,7 @@
pascal@14759 54 out:
pascal@14759 55 devtmpfs_mount("dev");
pascal@14759 56 sys_mount(".", "/", NULL, MS_MOVE, NULL);
pascal@20261 57 - sys_chroot(".");
pascal@20261 58 + sys_chroot(saved_root_directory);
pascal@14759 59 }
pascal@20261 60
pascal@20261 61 static bool is_tmpfs;