mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Make initramfs honor CONFIG_DEVTMPFS_MOUNT
@ 2017-05-04 21:09 Rob Landley
  2017-05-04 23:34 ` Kees Cook
  2017-05-09 21:31 ` Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Rob Landley @ 2017-05-04 21:09 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Prarit Bhargava, Yang Shi,
	Rasmus Villemoes, Kees Cook, Emese Revfy, Petr Mladek,
	Fabian Frederick

From: Rob Landley <rob@landley.net>

Make initramfs honor CONFIG_DEVTMPFS_MOUNT, and move
/dev/console open after devtmpfs mount.

Signed-off-by: Rob Landley <rob@landley.net>
---

 init/main.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/init/main.c b/init/main.c
index 2858be7..71ed0d7 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1016,12 +1016,6 @@ static noinline void __init kernel_init_freeable(void)
 
 	do_basic_setup();
 
-	/* Open the /dev/console on the rootfs, this should never fail */
-	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
-		pr_err("Warning: unable to open an initial console.\n");
-
-	(void) sys_dup(0);
-	(void) sys_dup(0);
 	/*
 	 * check if there is an early userspace init.  If yes, let it do all
 	 * the work
@@ -1033,8 +1027,17 @@ static noinline void __init kernel_init_freeable(void)
 	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
 		ramdisk_execute_command = NULL;
 		prepare_namespace();
+	} else if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT)) {
+		sys_mkdir("/dev", 0755);
+		sys_mount("dev", "dev", "devtmpfs", MS_SILENT, NULL);
 	}
 
+	/* Open the /dev/console on the rootfs, this should never fail */
+	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
+		pr_err("Warning: unable to open an initial console.\n");
+	(void) sys_dup(0);
+	(void) sys_dup(0);
+
 	/*
 	 * Ok, we have completed the initial bootup, and
 	 * we're essentially up and running. Get rid of the

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-17 21:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 21:09 [PATCH] Make initramfs honor CONFIG_DEVTMPFS_MOUNT Rob Landley
2017-05-04 23:34 ` Kees Cook
2017-05-09 21:31 ` Andrew Morton
2017-05-11 17:02   ` Rob Landley
2017-05-11 17:05   ` [PATCHv2] " Rob Landley
2017-05-14 21:35     ` Rob Landley
2017-05-17  3:58       ` Michael Ellerman
2017-05-17 21:16         ` Rob Landley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®