All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] busybox: avoid circular dependency when using initramfs
@ 2016-09-04 20:25 Stefan Agner
  2016-09-06 16:35 ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2016-09-04 20:25 UTC (permalink / raw)
  To: openembedded-core

The kernel does not automatically mount devtmpfs when using initramfs
based booting (even when using CONFIG_DEVTMPFS_MOUNT). If the rootfs
is built with USE_DEVFS=1 (which is the default), the system ends up
with a completely empty /dev to begin with.

Busybox uses the first entry in inittab slightly different than
other init systems:
<id>: WARNING: This field has a non-traditional meaning for BusyBox init!

The id field is used by BusyBox init to specify the controlling tty for
the specified process to run on.  The contents of this field are
appended to "/dev/" and used as-is.

Since /dev/null is not there yet, Busybox throws errors instead of
executing the commands, and hence never mounts devtmpfs:
init started: BusyBox v1.24.1 (2016-09-04 11:53:14 PDT)
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory
can't open /dev/null: No such file or directory

Avoid this circular dependency by not specifing <id>. With that
Busybox ends up using the stdio of the init process and executes
the inittab just fine.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 meta/recipes-core/busybox/files/inittab | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-core/busybox/files/inittab b/meta/recipes-core/busybox/files/inittab
index bfec4a7..2bc831c 100644
--- a/meta/recipes-core/busybox/files/inittab
+++ b/meta/recipes-core/busybox/files/inittab
@@ -1,13 +1,13 @@
 # This is run first except when booting in single-user mode.
 
 # Startup the system
-null::sysinit:/bin/mount -t proc proc /proc
-null::sysinit:/bin/mount -t sysfs sysfs /sys
-null::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
-null::sysinit:/bin/mount -o remount,rw /
-null::sysinit:/bin/mkdir -p /dev/pts
-null::sysinit:/bin/mount -t devpts devpts /dev/pts
-null::sysinit:/bin/mount -a
+::sysinit:/bin/mount -t proc proc /proc
+::sysinit:/bin/mount -t sysfs sysfs /sys
+::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
+::sysinit:/bin/mount -o remount,rw /
+::sysinit:/bin/mkdir -p /dev/pts
+::sysinit:/bin/mount -t devpts devpts /dev/pts
+::sysinit:/bin/mount -a
 
 ::sysinit:/etc/init.d/rcS
 
-- 
2.9.0



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

* Re: [PATCH] busybox: avoid circular dependency when using initramfs
  2016-09-04 20:25 [PATCH] busybox: avoid circular dependency when using initramfs Stefan Agner
@ 2016-09-06 16:35 ` Khem Raj
  2016-09-06 17:51   ` Stefan Agner
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2016-09-06 16:35 UTC (permalink / raw)
  To: Stefan Agner; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2724 bytes --]


> On Sep 4, 2016, at 1:25 PM, Stefan Agner <stefan@agner.ch> wrote:
> 
> The kernel does not automatically mount devtmpfs when using initramfs
> based booting (even when using CONFIG_DEVTMPFS_MOUNT). If the rootfs
> is built with USE_DEVFS=1 (which is the default), the system ends up
> with a completely empty /dev to begin with.
> 
> Busybox uses the first entry in inittab slightly different than
> other init systems:
> <id>: WARNING: This field has a non-traditional meaning for BusyBox init!
> 
> The id field is used by BusyBox init to specify the controlling tty for
> the specified process to run on.  The contents of this field are
> appended to "/dev/" and used as-is.
> 
> Since /dev/null is not there yet, Busybox throws errors instead of
> executing the commands, and hence never mounts devtmpfs:
> init started: BusyBox v1.24.1 (2016-09-04 11:53:14 PDT)
> can't open /dev/null: No such file or directory
> can't open /dev/null: No such file or directory
> can't open /dev/null: No such file or directory
> can't open /dev/null: No such file or directory
> can't open /dev/null: No such file or directory
> can't open /dev/null: No such file or directory
> can't open /dev/null: No such file or directory
> 
> Avoid this circular dependency by not specifing <id>. With that
> Busybox ends up using the stdio of the init process and executes
> the inittab just fine.

This looks good. Have you also tested it when using busybox/mdev as main
init system just not in initramfs

> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> meta/recipes-core/busybox/files/inittab | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/meta/recipes-core/busybox/files/inittab b/meta/recipes-core/busybox/files/inittab
> index bfec4a7..2bc831c 100644
> --- a/meta/recipes-core/busybox/files/inittab
> +++ b/meta/recipes-core/busybox/files/inittab
> @@ -1,13 +1,13 @@
> # This is run first except when booting in single-user mode.
> 
> # Startup the system
> -null::sysinit:/bin/mount -t proc proc /proc
> -null::sysinit:/bin/mount -t sysfs sysfs /sys
> -null::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
> -null::sysinit:/bin/mount -o remount,rw /
> -null::sysinit:/bin/mkdir -p /dev/pts
> -null::sysinit:/bin/mount -t devpts devpts /dev/pts
> -null::sysinit:/bin/mount -a
> +::sysinit:/bin/mount -t proc proc /proc
> +::sysinit:/bin/mount -t sysfs sysfs /sys
> +::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
> +::sysinit:/bin/mount -o remount,rw /
> +::sysinit:/bin/mkdir -p /dev/pts
> +::sysinit:/bin/mount -t devpts devpts /dev/pts
> +::sysinit:/bin/mount -a
> 
> ::sysinit:/etc/init.d/rcS
> 
> --
> 2.9.0
> 


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

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

* Re: [PATCH] busybox: avoid circular dependency when using initramfs
  2016-09-06 16:35 ` Khem Raj
@ 2016-09-06 17:51   ` Stefan Agner
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Agner @ 2016-09-06 17:51 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On 2016-09-06 09:35, Khem Raj wrote:
>> On Sep 4, 2016, at 1:25 PM, Stefan Agner <stefan@agner.ch> wrote:
>>
>> The kernel does not automatically mount devtmpfs when using initramfs
>> based booting (even when using CONFIG_DEVTMPFS_MOUNT). If the rootfs
>> is built with USE_DEVFS=1 (which is the default), the system ends up
>> with a completely empty /dev to begin with.
>>
>> Busybox uses the first entry in inittab slightly different than
>> other init systems:
>> <id>: WARNING: This field has a non-traditional meaning for BusyBox init!
>>
>> The id field is used by BusyBox init to specify the controlling tty for
>> the specified process to run on.  The contents of this field are
>> appended to "/dev/" and used as-is.
>>
>> Since /dev/null is not there yet, Busybox throws errors instead of
>> executing the commands, and hence never mounts devtmpfs:
>> init started: BusyBox v1.24.1 (2016-09-04 11:53:14 PDT)
>> can't open /dev/null: No such file or directory
>> can't open /dev/null: No such file or directory
>> can't open /dev/null: No such file or directory
>> can't open /dev/null: No such file or directory
>> can't open /dev/null: No such file or directory
>> can't open /dev/null: No such file or directory
>> can't open /dev/null: No such file or directory
>>
>> Avoid this circular dependency by not specifing <id>. With that
>> Busybox ends up using the stdio of the init process and executes
>> the inittab just fine.
> 
> This looks good. Have you also tested it when using busybox/mdev as main
> init system just not in initramfs
> 

I remember that I tried it once with squashfs and ramdisk, which, as far
as I can recall, behaves as if it is a regular rootfs wrt devtmpfs
mount...

--
Stefan


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

end of thread, other threads:[~2016-09-06 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 20:25 [PATCH] busybox: avoid circular dependency when using initramfs Stefan Agner
2016-09-06 16:35 ` Khem Raj
2016-09-06 17:51   ` Stefan Agner

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.