mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] rootfs: Add Option to install /sbin/init as /init
@ 2015-11-11 10:07 Markus Pargmann
  0 siblings, 0 replies; only message in thread
From: Markus Pargmann @ 2015-11-11 10:07 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Pargmann

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   | 17 ++++++++++++++++-
 rules/rootfs.make |  8 ++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/rules/rootfs.in b/rules/rootfs.in
index 80a730594892..102282b4c339 100644
--- a/rules/rootfs.in
+++ b/rules/rootfs.in
@@ -440,5 +440,20 @@ config ROOTFS_SERVICES
 	  If enabled, it installs the "./projectroot/etc/services" file if
 	  present, else a generic one from the ptxdist directory.
 
-endmenu
+config ROOTFS_INIT
+	bool
+	prompt "/init"
+	default y
+	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
+	depends on ROOTFS_INIT
+	bool
+	prompt "Install /init binary"
+	default n
+	help
+	  Install the /init binary instead of a symlink to /sbin/init.
+
+endmenu
diff --git a/rules/rootfs.make b/rules/rootfs.make
index 65cf0d126336..35568567fd82 100644
--- a/rules/rootfs.make
+++ b/rules/rootfs.make
@@ -240,6 +240,14 @@ ifdef PTXCONF_ROOTFS_SERVICES
 	@$(call install_alternative, rootfs, 0, 0, 0644, /etc/services)
 endif
 
+ifdef PTXCONF_ROOTFS_INIT
+ ifdef PTXCONF_ROOTFS_INIT_BIN
+	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
+ else
+	@$(call install_link, rootfs, /sbin/init, /init)
+ endif
+endif
+
 	@$(call install_finish, rootfs)
 
 	@$(call touch)
-- 
2.6.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-11 10:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 10:07 [ptxdist] [PATCH] rootfs: Add Option to install /sbin/init as /init Markus Pargmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox