getty: Create specific getty config + cleanups
authorAssaf Inbal <shmuelzon@gmail.com>
Sun, 15 Sep 2013 06:20:48 +0000 (09:20 +0300)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 15 Sep 2013 20:15:59 +0000 (22:15 +0200)
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 <shmuelzon@gmail.com>
Acked-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
system/Config.in
system/system.mk

index 401285bb521cd9255c92a102867756e5ed98cd3e..92dc7ddebfcc0c3a0899135211d7b2a1e87512f1 100644 (file)
@@ -198,15 +198,20 @@ 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
+menu "getty options"
 config BR2_TARGET_GENERIC_GETTY_PORT
-       string "Port to run a getty (login prompt) on"
+       string "TTY port"
        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"
+       prompt "Baudrate"
        default BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200
        help
          Select a baudrate to use.
@@ -235,10 +240,12 @@ config BR2_TARGET_GENERIC_GETTY_BAUDRATE
        default "115200"        if BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200
 
 config BR2_TARGET_GENERIC_GETTY_TERM
-       string "Value to assign the TERM environment variable"
+       string "TERM environment variable"
        default "vt100"
        help
          Specify a TERM type.
+endmenu
+endif
 
 config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
        bool "remount root filesystem read-write during boot"
index b4ddc3e6e18bb6c52d546b709e5debd32f9be7ab..0d23d54b4913dc13a8c4ed830f6564b9268a234e 100644 (file)
@@ -1,14 +1,14 @@
-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-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 +29,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 +46,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 +61,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