From patchwork Mon Dec 15 08:56:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 421008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 8C742140082 for ; Mon, 15 Dec 2014 19:56:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 14D13A1A46; Mon, 15 Dec 2014 08:56:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tUULe4NxVF1X; Mon, 15 Dec 2014 08:56:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 03F6EA1A39; Mon, 15 Dec 2014 08:56:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 8403E1BFA17 for ; Mon, 15 Dec 2014 08:56:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7F6DC9168A for ; Mon, 15 Dec 2014 08:56:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YizisEPnIzuS for ; Mon, 15 Dec 2014 08:56:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9519B91673 for ; Mon, 15 Dec 2014 08:56:34 +0000 (UTC) Received: from dc8secmta1.synopsys.com (unknown [10.13.218.200]) by smtprelay.synopsys.com (Postfix) with ESMTP id 5EA9510C0E39; Mon, 15 Dec 2014 00:56:33 -0800 (PST) Received: from dc8secmta1.internal.synopsys.com (dc8secmta1.internal.synopsys.com [127.0.0.1]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id 3D12B27113; Mon, 15 Dec 2014 00:56:33 -0800 (PST) Received: from mailhost.synopsys.com (unknown [10.13.184.66]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id 1369727102; Mon, 15 Dec 2014 00:56:33 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 04B513B1; Mon, 15 Dec 2014 00:56:33 -0800 (PST) Received: from abrodkin-8560l.internal.synopsys.com (abrodkin-8560l.internal.synopsys.com [10.121.8.44]) by mailhost.synopsys.com (Postfix) with ESMTP id 364433AF; Mon, 15 Dec 2014 00:56:30 -0800 (PST) From: Alexey Brodkin To: buildroot@uclibc.org Date: Mon, 15 Dec 2014 11:56:24 +0300 Message-Id: <1418633784-7709-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.1.0 Cc: Thomas Petazzoni , Alexey Brodkin Subject: [Buildroot] [PATCH] system: add "askfirst shell" as an option for busybox init X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "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 Cc: Anton Kolesov Cc: Gustavo Zacarias Cc: Thomas Petazzoni Tested-by: Karoly Kasza Reviewed-by: Karoly Kasza --- 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