All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Wire up CONFIG_DEVTMPFS_MOUNT to initramfs.
@ 2022-01-16 18:36 Rob Landley
  2022-01-16 22:45   ` kernel test robot
  2022-01-17 10:20   ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Rob Landley @ 2022-01-16 18:36 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

From: Rob Landley <rob@landley.net>

The kernel has had CONFIG_DEVTMPFS_MOUNT for years, but it only applied to
fallback ROOT= not initramfs/initmpfs. As long as the config option exists, it
might as well work.

I use this for board bringup: populating a chdir and calling cpio as a normal
user often leaves /dev empty (because mknod requires root access), meaning no
/dev/console for init/main.c to open, meaning init runs without
stdin/stdout/stderr and has to mount devtmpfs and redirect the filehandles blind
with no error output if something goes wrong.

Signed-off-by: Rob Landley <rob@landley.net>
---
Previously: https://lkml.org/lkml/2017/9/13/651

 init/main.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index bb984ed79de0..288c73db57f4 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1612,7 +1612,6 @@ static noinline void __init kernel_init_freeable(void)
 	kunit_run_all_tests();

 	wait_for_initramfs();
-	console_on_rootfs();

 	/*
 	 * check if there is an early userspace init.  If yes, let it do all
@@ -1621,7 +1620,11 @@ static noinline void __init kernel_init_freeable(void)
 	if (init_eaccess(ramdisk_execute_command) != 0) {
 		ramdisk_execute_command = NULL;
 		prepare_namespace();
+	} else if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT)) {
+		sys_mkdir("/dev", 0755);
+		devtmpfs_mount();
 	}
+	console_on_rootfs();

 	/*
 	 * Ok, we have completed the initial bootup, and

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

end of thread, other threads:[~2022-01-17 10:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-16 18:36 [PATCH] Wire up CONFIG_DEVTMPFS_MOUNT to initramfs Rob Landley
2022-01-16 22:45 ` kernel test robot
2022-01-16 22:45   ` kernel test robot
2022-01-17 10:20 ` kernel test robot
2022-01-17 10:20   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.