# HG changeset patch # User Pascal Bellard # Date 1371634987 -7200 # Node ID 1472150d52c4ef32b80f6eb22945b3ac8826afde # Parent 599c6d3b2a76eb8dc11ca386af1a00369ec77ef7 linux: add boot subroot support diff -r 599c6d3b2a76 -r 1472150d52c4 linux/receipt --- a/linux/receipt Tue Jun 18 15:41:31 2013 +0200 +++ b/linux/receipt Wed Jun 19 11:43:07 2013 +0200 @@ -136,6 +136,7 @@ $PACKAGE-header.u $PACKAGE-freeinitrd.u $PACKAGE-core.u +$PACKAGE-subroot.u aufs3-base.patch aufs3-standalone.patch aufs3-loopback.patch diff -r 599c6d3b2a76 -r 1472150d52c4 linux/stuff/linux-subroot.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux/stuff/linux-subroot.u Wed Jun 19 11:43:07 2013 +0200 @@ -0,0 +1,52 @@ +Allow to boot on any directories in a filesystem +--- linux-3.2.40/Documentation/kernel-parameters.txt ++++ linux-3.2.40/Documentation/kernel-parameters.txt +@@ -2304,8 +2304,9 @@ + + ro [KNL] Mount root device read-only on boot + +- root= [KNL] Root filesystem ++ root= [KNL] Root filesystem and root directory + See name_to_dev_t comment in init/do_mounts.c. ++ Format: [:root_directory] + + rootdelay= [KNL] Delay (in seconds) to pause before attempting to + mount the root filesystem +--- linux-3.2.40/init/do_mounts.c ++++ linux-3.2.40/init/do_mounts.c +@@ -28,6 +28,7 @@ + int root_mountflags = MS_RDONLY | MS_SILENT; + static char * __initdata root_device_name; + static char __initdata saved_root_name[64]; ++static char __initdata saved_root_directory[256]; + static int root_wait; + + dev_t ROOT_DEV; +@@ -255,7 +256,20 @@ + + static int __init root_dev_setup(char *line) + { ++ char *s; ++ ++ strcpy(saved_root_directory, "."); + strlcpy(saved_root_name, line, sizeof(saved_root_name)); ++ s = strchr(saved_root_name, ':'); ++ if (s) { ++ *s = '\0'; ++ s = strchr(line, ':'); ++ for (s++; *s == '/'; s++); ++ if (*s) { ++ strlcpy(saved_root_directory, s, ++ sizeof(saved_root_directory)); ++ } ++ } + return 1; + } + +@@ -554,5 +568,5 @@ + out: + devtmpfs_mount("dev"); + sys_mount(".", "/", NULL, MS_MOVE, NULL); +- sys_chroot((const char __user __force *)"."); ++ sys_chroot((const char __user __force *)saved_root_directory); + }