mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Markus Pargmann <mpa@pengutronix.de>
Subject: [ptxdist] [PATCH v2] rootfs: Add Option to install /sbin/init as /init
Date: Tue,  2 Feb 2016 12:56:00 +0100	[thread overview]
Message-ID: <1454414160-25399-1-git-send-email-mpa@pengutronix.de> (raw)

The kernel searches in initramfs for an executable /init file. So if we
want to use initramfs as rootfs it is convenient to have a link from
/init to /sbin/init.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 rules/rootfs.in   | 25 ++++++++++++++++++++++++-
 rules/rootfs.make |  7 +++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/rules/rootfs.in b/rules/rootfs.in
index 80a730594892..5c3565f2f44d 100644
--- a/rules/rootfs.in
+++ b/rules/rootfs.in
@@ -440,5 +440,28 @@ config ROOTFS_SERVICES
 	  If enabled, it installs the "./projectroot/etc/services" file if
 	  present, else a generic one from the ptxdist directory.
 
-endmenu
+choice
+	prompt "install /init"
+	default ROOTFS_INIT_LINK
+
+	config ROOTFS_INIT_LINK
+		bool
+		prompt "link to /sbin/init"
+		help
+		  Create a symlink from /init to /sbin/init. This is useful for
+		  initramfs for example in which /init is executed by default.
+
+	config ROOTFS_INIT_BIN
+		bool
+		prompt "binary from file"
+		help
+		  Install the /init binary instead of a symlink to /sbin/init.
 
+	config ROOTFS_INIT_NONE
+		bool
+		prompt "none"
+		help
+		  If enabled, no /init will be install.
+endchoice
+
+endmenu
diff --git a/rules/rootfs.make b/rules/rootfs.make
index 65cf0d126336..7c2e61df9eb9 100644
--- a/rules/rootfs.make
+++ b/rules/rootfs.make
@@ -240,6 +240,13 @@ ifdef PTXCONF_ROOTFS_SERVICES
 	@$(call install_alternative, rootfs, 0, 0, 0644, /etc/services)
 endif
 
+ifdef PTXCONF_ROOTFS_INIT_LINK
+	@$(call install_link, rootfs, /sbin/init, /init)
+endif
+ifdef PTXCONF_ROOTFS_INIT_BIN
+	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
+endif
+
 	@$(call install_finish, rootfs)
 
 	@$(call touch)
-- 
2.7.0.rc3


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2016-02-02 11:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 11:56 Markus Pargmann [this message]
2016-02-11 11:28 ` Michael Olbrich

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=1454414160-25399-1-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox