Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] system: add "askfirst shell" as an option for busybox init
@ 2014-12-15  8:56 Alexey Brodkin
  2014-12-15 11:43 ` Károly Kasza
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Alexey Brodkin @ 2014-12-15  8:56 UTC (permalink / raw)
  To: buildroot

Consider following cases:
 * Buildroot only builds rootfs that could be used on systems with
   different default serial ports (ttyS0, ttyS1, ttyAMA3 etc)
 * Target system has multiple serial ports and in kernel command
   line users/developers may select different serial ports as
   debug consoles

In both cases hard-coded with BR2_TARGET_GENERIC_GETTY tty will
only work for 1 particular serial port.

This change introduces an option to use whatever existing console.
For example console selected in kernel's command line will be used.

I'm not sure if the same thing works for SysVinit so marking it
dependent on Busybox init.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 system/Config.in            | 5 +++++
 system/skeleton/etc/inittab | 3 +++
 system/system.mk            | 9 +++++++++
 3 files changed, 17 insertions(+)

diff --git a/system/Config.in b/system/Config.in
index 39f27c7..0fa0dc6 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -311,6 +311,11 @@ config BR2_TARGET_GENERIC_GETTY_OPTIONS
 endmenu
 endif
 
+config BR2_TARGET_ASKFIRST_SHELL
+	bool "Start an \"askfirst\" shell on the console (whatever that may be)"
+	depends on BR2_INIT_BUSYBOX
+	depends on !BR2_TARGET_GENERIC_GETTY
+
 config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
 	bool "remount root filesystem read-write during boot"
 	default y
diff --git a/system/skeleton/etc/inittab b/system/skeleton/etc/inittab
index b1892c1..3a2514a 100644
--- a/system/skeleton/etc/inittab
+++ b/system/skeleton/etc/inittab
@@ -23,6 +23,9 @@ null::sysinit:/bin/hostname -F /etc/hostname
 # now run any rc scripts
 ::sysinit:/etc/init.d/rcS
 
+# Start an "askfirst" shell on the console (whatever that may be)
+#::askfirst:-/bin/sh # ASKFIRST_SHELL
+
 # Put a getty on the serial port
 #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
 
diff --git a/system/system.mk b/system/system.mk
index e4a3160..f93e27a 100644
--- a/system/system.mk
+++ b/system/system.mk
@@ -76,6 +76,15 @@ endif
 TARGET_FINALIZE_HOOKS += SYSTEM_GETTY
 endif
 
+ifeq ($(BR2_TARGET_ASKFIRST_SHELL),y)
+# Add askfirst shell to busybox inittab
+define SYSTEM_ASKFIRST
+	$(SED) '/# ASKFIRST_SHELL$$/s~^.*#~::askfirst:-/bin/sh #~' \
+		$(TARGET_DIR)/etc/inittab
+endef
+TARGET_FINALIZE_HOOKS += SYSTEM_ASKFIRST
+endif
+
 ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
 # Find commented line, if any, and remove leading '#'s
 define SYSTEM_REMOUNT_RW
-- 
2.1.0

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

end of thread, other threads:[~2014-12-23 10:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-15  8:56 [Buildroot] [PATCH] system: add "askfirst shell" as an option for busybox init Alexey Brodkin
2014-12-15 11:43 ` Károly Kasza
2014-12-15 12:31   ` Alexey Brodkin
2014-12-16  7:14 ` Thomas Petazzoni
2014-12-17 15:03   ` Alexey Brodkin
2014-12-17 15:14     ` Thomas Petazzoni
2014-12-17 15:24       ` Alexey Brodkin
2014-12-17 15:36         ` Thomas Petazzoni
2014-12-17 15:50           ` Alexey Brodkin
2014-12-17 15:53             ` Jeremy Rosen
2014-12-17 16:07               ` Thomas Petazzoni
2014-12-17 16:08             ` Thomas Petazzoni
2014-12-17 16:18               ` Alexey Brodkin
2014-12-17 16:28                 ` Thomas Petazzoni
2014-12-23  9:40                   ` Alexey Brodkin
2014-12-23 10:19                     ` Thomas Petazzoni
2014-12-21 21:09 ` Thomas Petazzoni

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