wok-backports diff linux/stuff/linux-subroot.u2 @ rev 0
Add linux
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Dec 18 15:14:49 2013 +0000 (2013-12-18) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/linux/stuff/linux-subroot.u2 Wed Dec 18 15:14:49 2013 +0000 1.3 @@ -0,0 +1,61 @@ 1.4 +Allow to boot on any directories in a filesystem. You will be able to : 1.5 +- have several distributions in one partition 1.6 +- use effectively the disk space between several distributions 1.7 +- deduplicate files across several distributions 1.8 + 1.9 +The bad news : you can't remount / 1.10 + 1.11 +example: bzImage rw root=/dev/sda1:/var/os/slitaz-4.0 screen=1024x768x24 1.12 + 1.13 +Signed-off-by: Pascal Bellard <pascal.bellard@slitaz.org> 1.14 +--- linux-3.2.40/Documentation/kernel-parameters.txt 1.15 ++++ linux-3.2.40/Documentation/kernel-parameters.txt 1.16 +@@ -2304,8 +2304,9 @@ 1.17 + 1.18 + ro [KNL] Mount root device read-only on boot 1.19 + 1.20 +- root= [KNL] Root filesystem 1.21 ++ root= [KNL] Root filesystem and root directory 1.22 + See name_to_dev_t comment in init/do_mounts.c. 1.23 ++ Format: <root_filesystem>[:root_directory] 1.24 + 1.25 + rootdelay= [KNL] Delay (in seconds) to pause before attempting to 1.26 + mount the root filesystem 1.27 +--- linux-3.2.40/init/do_mounts.c 1.28 ++++ linux-3.2.40/init/do_mounts.c 1.29 +@@ -28,6 +28,7 @@ 1.30 + int root_mountflags = MS_RDONLY | MS_SILENT; 1.31 + static char * __initdata root_device_name; 1.32 + static char __initdata saved_root_name[64]; 1.33 ++static char __initdata saved_root_directory[256]; 1.34 + static int root_wait; 1.35 + 1.36 + dev_t ROOT_DEV; 1.37 +@@ -255,7 +256,20 @@ 1.38 + 1.39 + static int __init root_dev_setup(char *line) 1.40 + { 1.41 ++ char *s; 1.42 ++ 1.43 ++ strcpy(saved_root_directory, "."); 1.44 + strlcpy(saved_root_name, line, sizeof(saved_root_name)); 1.45 ++ s = strchr(saved_root_name, ':'); 1.46 ++ if (s) { 1.47 ++ *s = '\0'; 1.48 ++ s = strchr(line, ':') + 1; 1.49 ++ while (*s == '/') 1.50 ++ s++; 1.51 ++ if (*s) 1.52 ++ strlcpy(saved_root_directory, s, 1.53 ++ sizeof(saved_root_directory)); 1.54 ++ } 1.55 + return 1; 1.56 + } 1.57 + 1.58 +@@ -554,5 +568,5 @@ 1.59 + out: 1.60 + devtmpfs_mount("dev"); 1.61 + sys_mount(".", "/", NULL, MS_MOVE, NULL); 1.62 +- sys_chroot((const char __user __force *)"."); 1.63 ++ sys_chroot((const char __user __force *)saved_root_directory); 1.64 + }