From patchwork Sun Aug 25 11:13:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Assaf Inbal X-Patchwork-Id: 269695 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 11B062C00AF for ; Sun, 25 Aug 2013 21:14:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E217A8B646; Sun, 25 Aug 2013 11:14:00 +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 4qvhanRPELP2; Sun, 25 Aug 2013 11:14:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 343A18B5B6; Sun, 25 Aug 2013 11:14:00 +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 6EE101C2AB4 for ; Sun, 25 Aug 2013 11:13:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6851F85E98 for ; Sun, 25 Aug 2013 11:13:59 +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 Vek5ZN0vS5Gc for ; Sun, 25 Aug 2013 11:13:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by whitealder.osuosl.org (Postfix) with ESMTPS id 73EA885C85 for ; Sun, 25 Aug 2013 11:13:56 +0000 (UTC) Received: by mail-ee0-f48.google.com with SMTP id l10so1059718eei.7 for ; Sun, 25 Aug 2013 04:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+sTxsFUacrgqFeQzAigbemvZut+pfkQ4HkT4COd1t+k=; b=tMsmHZ/rb0gBhKi5uElrbMNPJJj1hVcFDz/ZTTpkkQll4oQl+tf0Ajc276L/Z/SV3A +QFj8xPuEwmlUSywxcGKPJvEwzeovRm74M8aw6HWFP3r3sulZgOYC7g9wYUzJ4iRVeWp T0lSxUW6OTr2BEvXoF5NfbLHsQsOJAhwl/wc2sW0ijw37Z0J6gHDndByp/7U2TGLfYiu Ymmoto5LqEq1P+E04X9DvMSCQ4z6LDSxtXjRMACXxgjtVKRG8MTQOvk4KNOoYLuD/Iog ut2kzRq6nhAa27DBhSjbJpKQJxByR17z0xEVr4Ldx5IxODRUOEukkaUrvfsMAFzMVpt/ gROw== X-Received: by 10.15.35.196 with SMTP id g44mr16090633eev.18.1377429234980; Sun, 25 Aug 2013 04:13:54 -0700 (PDT) Received: from ainbal-ubuntu.home.jungo.com (out.jungo.com. [212.150.239.254]) by mx.google.com with ESMTPSA id m54sm13373994eex.2.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 Aug 2013 04:13:53 -0700 (PDT) From: Assaf Inbal To: buildroot@uclibc.org Date: Sun, 25 Aug 2013 14:13:38 +0300 Message-Id: <1377429219-25140-1-git-send-email-shmuelzon@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <[Buildroot] [PATCH] getty: add the ability to pass options to getty> References: <[Buildroot] [PATCH] getty: add the ability to pass options to getty> Cc: Assaf Inbal Subject: [Buildroot] [PATCH v2 1/2] getty: Create specific getty config + cleanups X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 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-bounces@busybox.net This commit introduces a specific BR2_TARGET_GENERIC_GETTY configuration flag. This eliminates the need for checking if BR2_TARGET_GENERIC_GETTY_PORT is an empty string or not. It also allows hiding various getty options when getty isn't enabled. Signed-off-by: Assaf Inbal --- system/Config.in | 9 +++++++-- system/system.mk | 27 ++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/system/Config.in b/system/Config.in index d41f184..403b229 100644 --- a/system/Config.in +++ b/system/Config.in @@ -194,12 +194,16 @@ config BR2_TARGET_GENERIC_ROOT_PASSWD in the build log! Avoid using a valuable password if either the .config file or the build log may be distributed! +config BR2_TARGET_GENERIC_GETTY + bool "Run a getty (login prompt) after boot" + default y + +if BR2_TARGET_GENERIC_GETTY config BR2_TARGET_GENERIC_GETTY_PORT string "Port to run a getty (login prompt) on" default "ttyS0" help - Specify a port to run a getty (login prompt) on. - Set to the empty string to not run a getty. + Specify a port to run a getty on. choice prompt "Baudrate to use" @@ -235,6 +239,7 @@ config BR2_TARGET_GENERIC_GETTY_TERM default "vt100" help Specify a TERM type. +endif config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW bool "remount root filesystem read-write during boot" diff --git a/system/system.mk b/system/system.mk index b4ddc3e..c9e7cf7 100644 --- a/system/system.mk +++ b/system/system.mk @@ -1,14 +1,15 @@ -TARGET_GENERIC_HOSTNAME := $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME)) -TARGET_GENERIC_ISSUE := $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE)) -TARGET_GENERIC_ROOT_PASSWD := $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD)) -TARGET_GENERIC_PASSWD_METHOD := $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD)) -TARGET_GENERIC_GETTY := $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) -TARGET_GENERIC_GETTY_BAUDRATE := $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -TARGET_GENERIC_GETTY_TERM := $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) +TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME)) +TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE)) +TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD)) +TARGET_GENERIC_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD)) +TARGET_GENERIC_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) +TARGET_GENERIC_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) +TARGET_GENERIC_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) +TARGET_GENERIC_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS)) target-generic-securetty: - grep -q '^$(TARGET_GENERIC_GETTY)$$' $(TARGET_DIR)/etc/securetty || \ - echo '$(TARGET_GENERIC_GETTY)' >> $(TARGET_DIR)/etc/securetty + grep -q '^$(TARGET_GENERIC_GETTY_PORT)$$' $(TARGET_DIR)/etc/securetty || \ + echo '$(TARGET_GENERIC_GETTY_PORT)' >> $(TARGET_DIR)/etc/securetty target-generic-hostname: mkdir -p $(TARGET_DIR)/etc @@ -29,13 +30,13 @@ target-root-passwd: $(SED) "s,^root:[^:]*:,root:$$TARGET_GENERIC_ROOT_PASSWD_HASH:," $(TARGET_DIR)/etc/shadow target-generic-getty-busybox: - $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \ + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY_PORT)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_PORT) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \ $(TARGET_DIR)/etc/inittab # In sysvinit inittab, the "id" must not be longer than 4 bytes, so we # skip the "tty" part and keep only the remaining. target-generic-getty-sysvinit: - $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \ + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_PORT) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \ $(TARGET_DIR)/etc/inittab # Find commented line, if any, and remove leading '#'s @@ -46,7 +47,7 @@ target-generic-do-remount-rw: target-generic-dont-remount-rw: $(SED) '/^[^#].*# REMOUNT_ROOTFS_RW$$/s~^~#~' $(TARGET_DIR)/etc/inittab -ifneq ($(TARGET_GENERIC_GETTY),) +ifeq ($(BR2_TARGET_GENERIC_GETTY),y) TARGETS += target-generic-securetty endif @@ -61,7 +62,7 @@ endif ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y) TARGETS += target-root-passwd -ifneq ($(TARGET_GENERIC_GETTY),) +ifeq ($(BR2_TARGET_GENERIC_GETTY),y) TARGETS += target-generic-getty-$(if $(BR2_PACKAGE_SYSVINIT),sysvinit,busybox) endif