getty: Cleanups + new options config
v3 cover getty: Cleanups + new options config
Hey,
Third time's a charm... :)
Good day,
Assaf
PATCH v3 1/2 getty: Create specific getty config + cleanups
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.
--- system/Config.in | 17 ++++++++++++----- system/system.mk | 27 ++++++++++++++------------- 2 files changed, 26 insertions(+), 18 deletions(-)
system/Config.in +12 -5
@@ -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"
system/system.mk +14 -13
@@ -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
Signature · 1 line
1.7.9.5
PATCH v3 1/2 getty: Create specific getty config + cleanups
Hi Assaf,
Thanks for resending...
Quoted 64 lines · Assaf Inbal
This commit introduces a specific
BR2_TARGET_GENERIC_GETTYconfiguration flag. This eliminates the need for checking ifBR2_TARGET_GENERIC_GETTY_PORTis an empty string or not. It also allows hiding various getty options when getty isn't enabled.Signed-off-by Assaf Inbal <[email protected]>--- system/Config.in | 17 ++++++++++++----- system/system.mk | 27 ++++++++++++++------------- 2 files changed, 26 insertions(+), 18 deletions(-)system/Config.in +12
-5@@ -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"system/system.mk +0
-5@@ -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))
system/system.mk line 8
Quoted 10 lines
system/system.mk +8
-2-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))
Ai, I didn't spot this in the previous versions, but this last line should be in the next patch that introduces the _OPTIONS option...
With that changed, you can add:
Quoted 44 lines
system/system.mk +6
-7target-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 --
Quoted 2 lines
1.7.9.5
Best regards,
Thomas
PATCH v3 1/2 getty: Create specific getty config + cleanups
Hey,
Quoted 6 lines
Ai, I didn't spot this in the previous versions, but this last line should be in the next patch that introduces the
_OPTIONSoption...With that changed, you can add:
You're absolutely right. Probably started with a bad copy-paste. I'll send in new patches shortly.
Good day,
Assaf
PATCH v3 2/2 getty: add the ability to pass options to getty
In reply to Assaf Inbal--- system/Config.in | 7 +++++++ system/system.mk | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
system/Config.in +7 -0
@@ -244,6 +244,13 @@ config BR2_TARGET_GENERIC_GETTY_TERM default "vt100" help Specify a TERM type. + +config BR2_TARGET_GENERIC_GETTY_OPTIONS + string "other options to pass to getty" + default "" + help + Any other flags you want to pass to getty, + Refer to getty --help for details. endmenu endif
system/system.mk +2 -2
@@ -30,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_PORT)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_PORT) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \ + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY_PORT)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_OPTIONS) $(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_PORT) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_PORT) $(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_OPTIONS) $(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
Signature · 1 line
1.7.9.5
PATCH v3 2/2 getty: add the ability to pass options to getty
Quoted 45 lines · Assaf Inbal
Signed-off-by Assaf Inbal <[email protected]>--- system/Config.in | 7 +++++++ system/system.mk | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)system/Config.in +7
-0@@ -244,6 +244,13 @@ config BR2_TARGET_GENERIC_GETTY_TERM default "vt100" help Specify a TERM type. + +config BR2_TARGET_GENERIC_GETTY_OPTIONS + string "other options to pass to getty" + default "" + help + Any other flags you want to pass to getty, + Refer to getty --help for details. endmenu endifsystem/system.mk +2
-3@@ -30,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_PORT)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_PORT) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \ + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY_PORT)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_OPTIONS) $(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_PORT) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_PORT) $(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_OPTIONS) $(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 --
Quoted 1 line
1.7.9.5
With the one line moved from the first patch in this series, you can add:
Best regards,
Thomas