All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] don't check console device file on fs when booting with initrd/initramfs
@ 2019-02-06 13:02 Alexey Brodkin
  2019-02-07 18:20 ` [linux-yocto] " Bruce Ashfield
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Brodkin @ 2019-02-06 13:02 UTC (permalink / raw)
  To: linux-snps-arc

In case of initrd/initramfs /dev/console might not exist that early
as devtmpfs is mounted a bit later by /init process so disable this
check in that case.

Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
---
 init/main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 387a2d7dc90b..5b904bc78fa4 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1112,7 +1112,9 @@ static int __ref kernel_init(void *unused)
 
 static noinline void __init kernel_init_freeable(void)
 {
+#ifndef CONFIG_BLK_DEV_INITRD
 	struct kstat console_stat;
+#endif
 	/*
 	 * Wait until kthreadd is all set-up.
 	 */
@@ -1144,11 +1146,17 @@ static noinline void __init kernel_init_freeable(void)
 
 	do_basic_setup();
 
-	/* Use /dev/console to infer if the rootfs is setup properly */
+#ifndef CONFIG_BLK_DEV_INITRD
+       /*
+        * Use /dev/console to infer if the rootfs is setup properly.
+        * In case of initrd or initramfs /dev/console might be instantiated
+        * later by /init so don't do this check for CONFIG_BLK_DEV_INITRD
+        */
 	if (vfs_lstat((char __user *) "/dev/console", (struct kstat __user *) &console_stat)
 			|| !S_ISCHR(console_stat.mode)) {
 		panic("/dev/console is missing or not a character device!\nPlease ensure your rootfs is properly configured\n");
 	}
+#endif
 
 	/* Open the /dev/console on the rootfs, this should never fail */
 	if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
-- 
2.16.2

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

* [linux-yocto] [PATCH] don't check console device file on fs when booting with initrd/initramfs
  2019-02-06 13:02 [PATCH] don't check console device file on fs when booting with initrd/initramfs Alexey Brodkin
@ 2019-02-07 18:20 ` Bruce Ashfield
  0 siblings, 0 replies; 2+ messages in thread
From: Bruce Ashfield @ 2019-02-07 18:20 UTC (permalink / raw)
  To: linux-snps-arc

On Wed, Feb 6, 2019 at 8:10 AM Alexey Brodkin
<alexey.brodkin@synopsys.com> wrote:
>
> In case of initrd/initramfs /dev/console might not exist that early
> as devtmpfs is mounted a bit later by /init process so disable this
> check in that case.

That's a reasonable tweak to the console check. I've applied the patch
to 4.19 and it will appear in future kernels as well. If you need it
on another version, let me know.

Bruce


>
> Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
> ---
>  init/main.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/init/main.c b/init/main.c
> index 387a2d7dc90b..5b904bc78fa4 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1112,7 +1112,9 @@ static int __ref kernel_init(void *unused)
>
>  static noinline void __init kernel_init_freeable(void)
>  {
> +#ifndef CONFIG_BLK_DEV_INITRD
>         struct kstat console_stat;
> +#endif
>         /*
>          * Wait until kthreadd is all set-up.
>          */
> @@ -1144,11 +1146,17 @@ static noinline void __init kernel_init_freeable(void)
>
>         do_basic_setup();
>
> -       /* Use /dev/console to infer if the rootfs is setup properly */
> +#ifndef CONFIG_BLK_DEV_INITRD
> +       /*
> +        * Use /dev/console to infer if the rootfs is setup properly.
> +        * In case of initrd or initramfs /dev/console might be instantiated
> +        * later by /init so don't do this check for CONFIG_BLK_DEV_INITRD
> +        */
>         if (vfs_lstat((char __user *) "/dev/console", (struct kstat __user *) &console_stat)
>                         || !S_ISCHR(console_stat.mode)) {
>                 panic("/dev/console is missing or not a character device!\nPlease ensure your rootfs is properly configured\n");
>         }
> +#endif
>
>         /* Open the /dev/console on the rootfs, this should never fail */
>         if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
> --
> 2.16.2
>
> --
> _______________________________________________
> linux-yocto mailing list
> linux-yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/linux-yocto



--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

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

end of thread, other threads:[~2019-02-07 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06 13:02 [PATCH] don't check console device file on fs when booting with initrd/initramfs Alexey Brodkin
2019-02-07 18:20 ` [linux-yocto] " Bruce Ashfield

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.