All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael S. Zick <minimod@morethan.org>
To: buildroot@busybox.net
Subject: [Buildroot] [git commit] initramfs: fix boot with dynamic /dev
Date: Wed, 20 Jul 2011 11:12:41 -0500	[thread overview]
Message-ID: <201107201112.44209.minimod@morethan.org> (raw)
In-Reply-To: <20110720150418.E95188B391@busybox.osuosl.org>

On Wed July 20 2011, Peter Korsgaard wrote:
> 
> commit: http://git.buildroot.net/buildroot/commit/?id=424888e47431db738f5f9b3c6392435bfce7a842
> branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master
> 
> Devtmpfs (which is used by devtmpfs/mdev/udev options) doesn't get
> automounted by the kernel when an initramfs is used, causing boot
> failures when a dynamic /dev is used.
> 
> Fix it by adding a pre-init script to mount devtmpfs before running init.
> 
> Reported-by: Arnout Vandecappelle <arnout@mind.be>
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
> ---
>  fs/initramfs/init         |    4 ++++
>  fs/initramfs/initramfs.mk |   17 +++++++++++++++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
>  create mode 100755 fs/initramfs/init
> 
> diff --git a/fs/initramfs/init b/fs/initramfs/init
> new file mode 100755
> index 0000000..751cb27
> --- /dev/null
> +++ b/fs/initramfs/init
> @@ -0,0 +1,4 @@
> +#!/bin/sh
>

Will the various shell aps run a script without /dev/console and /dev/null?

Once upon a time, some did not, but that may no longer be true.

Mike

> +# devtmpfs does not get automounted for initramfs
> +/bin/mount -t devtmpfs devtmpfs /dev
> +exec /sbin/init $*
> diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk
> index 73122a8..1cd48b6 100644
> --- a/fs/initramfs/initramfs.mk
> +++ b/fs/initramfs/initramfs.mk
> @@ -6,13 +6,26 @@
>  #
>  #############################################################
>  
> -define ROOTFS_INITRAMFS_INIT_SYMLINK
> +ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
> +
> +define ROOTFS_INITRAMFS_ADD_INIT
>  	if [ ! -e $(TARGET_DIR)/init ]; then \
>  		ln -sf sbin/init $(TARGET_DIR)/init; \
>  	fi
>  endef
>  
> -ROOTFS_INITRAMFS_PRE_GEN_HOOKS += ROOTFS_INITRAMFS_INIT_SYMLINK
> +else
> +# devtmpfs does not get automounted when initramfs is used.
> +# Add a pre-init script to mount it before running init
> +define ROOTFS_INITRAMFS_ADD_INIT
> +	if [ ! -e $(TARGET_DIR)/init ]; then \
> +		$(INSTALL) -m 0755 fs/initramfs/init $(TARGET_DIR)/init; \
> +	fi
> +endef
> +
> +endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
> +
> +ROOTFS_INITRAMFS_PRE_GEN_HOOKS += ROOTFS_INITRAMFS_ADD_INIT
>  
>  define ROOTFS_INITRAMFS_CMD
>  	$(SHELL) fs/initramfs/gen_initramfs_list.sh -u 0 -g 0 $(TARGET_DIR) > $$@

  reply	other threads:[~2011-07-20 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 14:30 [Buildroot] [git commit] initramfs: fix boot with dynamic /dev Peter Korsgaard
2011-07-20 16:12 ` Michael S. Zick [this message]
2011-07-20 17:43   ` Peter Korsgaard
2011-08-24  7:53 ` Arnout Vandecappelle
2011-09-01  7:18   ` Thomas Petazzoni
2011-09-01 16:18     ` Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107201112.44209.minimod@morethan.org \
    --to=minimod@morethan.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.