wok rev 14759

linux: add boot subroot support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jun 19 11:43:07 2013 +0200 (2013-06-19)
parents 599c6d3b2a76
children 4d48f8048d15
files linux/receipt linux/stuff/linux-subroot.u
line diff
     1.1 --- a/linux/receipt	Tue Jun 18 15:41:31 2013 +0200
     1.2 +++ b/linux/receipt	Wed Jun 19 11:43:07 2013 +0200
     1.3 @@ -136,6 +136,7 @@
     1.4  $PACKAGE-header.u
     1.5  $PACKAGE-freeinitrd.u
     1.6  $PACKAGE-core.u
     1.7 +$PACKAGE-subroot.u
     1.8  aufs3-base.patch
     1.9  aufs3-standalone.patch
    1.10  aufs3-loopback.patch
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux/stuff/linux-subroot.u	Wed Jun 19 11:43:07 2013 +0200
     2.3 @@ -0,0 +1,52 @@
     2.4 +Allow to boot on any directories in a filesystem
     2.5 +--- linux-3.2.40/Documentation/kernel-parameters.txt
     2.6 ++++ linux-3.2.40/Documentation/kernel-parameters.txt
     2.7 +@@ -2304,8 +2304,9 @@
     2.8 + 
     2.9 + 	ro		[KNL] Mount root device read-only on boot
    2.10 + 
    2.11 +-	root=		[KNL] Root filesystem
    2.12 ++	root=		[KNL] Root filesystem and root directory
    2.13 + 			See name_to_dev_t comment in init/do_mounts.c.
    2.14 ++			Format: <root_filesystem>[:root_directory]
    2.15 + 
    2.16 + 	rootdelay=	[KNL] Delay (in seconds) to pause before attempting to
    2.17 + 			mount the root filesystem
    2.18 +--- linux-3.2.40/init/do_mounts.c
    2.19 ++++ linux-3.2.40/init/do_mounts.c
    2.20 +@@ -28,6 +28,7 @@
    2.21 + int root_mountflags = MS_RDONLY | MS_SILENT;
    2.22 + static char * __initdata root_device_name;
    2.23 + static char __initdata saved_root_name[64];
    2.24 ++static char __initdata saved_root_directory[256];
    2.25 + static int root_wait;
    2.26 + 
    2.27 + dev_t ROOT_DEV;
    2.28 +@@ -255,7 +256,20 @@
    2.29 + 
    2.30 + static int __init root_dev_setup(char *line)
    2.31 + {
    2.32 ++	char *s;
    2.33 ++	
    2.34 ++	strcpy(saved_root_directory, ".");
    2.35 + 	strlcpy(saved_root_name, line, sizeof(saved_root_name));
    2.36 ++	s = strchr(saved_root_name, ':');
    2.37 ++	if (s) {
    2.38 ++		*s = '\0';
    2.39 ++		s = strchr(line, ':');
    2.40 ++		for (s++; *s == '/'; s++);
    2.41 ++		if (*s) {
    2.42 ++			strlcpy(saved_root_directory, s,
    2.43 ++				sizeof(saved_root_directory));
    2.44 ++		}
    2.45 ++	}
    2.46 + 	return 1;
    2.47 + }
    2.48 + 
    2.49 +@@ -554,5 +568,5 @@
    2.50 + out:
    2.51 + 	devtmpfs_mount("dev");
    2.52 + 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
    2.53 +-	sys_chroot((const char __user __force *)".");
    2.54 ++	sys_chroot((const char __user __force *)saved_root_directory);
    2.55 + }