Re: [PATCHv2] Make initramfs honor CONFIG_DEVTMPFS_MOUNT

From: Michael Ellerman
Date: Tue May 16 2017 - 23:58:47 EST


Rob Landley <rob@xxxxxxxxxxx> writes:

> diff --git a/init/main.c b/init/main.c
> index f866510..9ec09ff 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1055,8 +1049,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);
> + devtmpfs_mount("/dev");
> }
>
> + /* Open the /dev/console on the rootfs, this should never fail */
> + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)

Sorry to pile on, but while you're moving it do you want to update this
fairly misleading comment.

It definitely can fail, eg. if /dev/console doesn't exist, or if no
console driver is registered.

cheers