wok diff linux/stuff/linux-subroot.u @ 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
children 4d48f8048d15
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux/stuff/linux-subroot.u	Wed Jun 19 11:43:07 2013 +0200
     1.3 @@ -0,0 +1,52 @@
     1.4 +Allow to boot on any directories in a filesystem
     1.5 +--- linux-3.2.40/Documentation/kernel-parameters.txt
     1.6 ++++ linux-3.2.40/Documentation/kernel-parameters.txt
     1.7 +@@ -2304,8 +2304,9 @@
     1.8 + 
     1.9 + 	ro		[KNL] Mount root device read-only on boot
    1.10 + 
    1.11 +-	root=		[KNL] Root filesystem
    1.12 ++	root=		[KNL] Root filesystem and root directory
    1.13 + 			See name_to_dev_t comment in init/do_mounts.c.
    1.14 ++			Format: <root_filesystem>[:root_directory]
    1.15 + 
    1.16 + 	rootdelay=	[KNL] Delay (in seconds) to pause before attempting to
    1.17 + 			mount the root filesystem
    1.18 +--- linux-3.2.40/init/do_mounts.c
    1.19 ++++ linux-3.2.40/init/do_mounts.c
    1.20 +@@ -28,6 +28,7 @@
    1.21 + int root_mountflags = MS_RDONLY | MS_SILENT;
    1.22 + static char * __initdata root_device_name;
    1.23 + static char __initdata saved_root_name[64];
    1.24 ++static char __initdata saved_root_directory[256];
    1.25 + static int root_wait;
    1.26 + 
    1.27 + dev_t ROOT_DEV;
    1.28 +@@ -255,7 +256,20 @@
    1.29 + 
    1.30 + static int __init root_dev_setup(char *line)
    1.31 + {
    1.32 ++	char *s;
    1.33 ++	
    1.34 ++	strcpy(saved_root_directory, ".");
    1.35 + 	strlcpy(saved_root_name, line, sizeof(saved_root_name));
    1.36 ++	s = strchr(saved_root_name, ':');
    1.37 ++	if (s) {
    1.38 ++		*s = '\0';
    1.39 ++		s = strchr(line, ':');
    1.40 ++		for (s++; *s == '/'; s++);
    1.41 ++		if (*s) {
    1.42 ++			strlcpy(saved_root_directory, s,
    1.43 ++				sizeof(saved_root_directory));
    1.44 ++		}
    1.45 ++	}
    1.46 + 	return 1;
    1.47 + }
    1.48 + 
    1.49 +@@ -554,5 +568,5 @@
    1.50 + out:
    1.51 + 	devtmpfs_mount("dev");
    1.52 + 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
    1.53 +-	sys_chroot((const char __user __force *)".");
    1.54 ++	sys_chroot((const char __user __force *)saved_root_directory);
    1.55 + }