From f7602a8242a3121dce558245e88e084c3bfff627 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 13 Sep 2023 10:09:43 -0600 Subject: [PATCH] x86,armsr: interpolate GRUB_SERIAL into /etc/inittab Some platforms have their console on other ports than ttyS0, so allow the developer to tailor this on bespoke platform images. Fixes issue #13401. Signed-off-by: Philip Prindeville --- target/linux/armsr/base-files.mk | 10 ++++++++++ target/linux/armsr/base-files/etc/inittab | 2 +- target/linux/x86/base-files.mk | 10 ++++++++++ target/linux/x86/base-files/etc/inittab | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 target/linux/armsr/base-files.mk create mode 100644 target/linux/x86/base-files.mk diff --git a/target/linux/armsr/base-files.mk b/target/linux/armsr/base-files.mk new file mode 100644 index 0000000000000..f846133d24b26 --- /dev/null +++ b/target/linux/armsr/base-files.mk @@ -0,0 +1,10 @@ +GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL)) +ifeq ($(GRUB_SERIAL),) +$(error This platform requires CONFIG_GRUB_SERIAL be set!) +endif + +ifneq ($(GRUB_SERIAL),) + define Package/base-files/install-target + $(SED) "s#@GRUB_SERIAL@#$(GRUB_SERIAL)#" $(1)/etc/inittab + endef +endif diff --git a/target/linux/armsr/base-files/etc/inittab b/target/linux/armsr/base-files/etc/inittab index 51832eb77564f..87d5460d32331 100644 --- a/target/linux/armsr/base-files/etc/inittab +++ b/target/linux/armsr/base-files/etc/inittab @@ -1,7 +1,7 @@ ::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K shutdown ttyAMA0::askfirst:/usr/libexec/login.sh -ttyS0::askfirst:/usr/libexec/login.sh +@GRUB_SERIAL@::askfirst:/usr/libexec/login.sh tty0::askfirst:/usr/libexec/login.sh hvc0::askfirst:/usr/libexec/login.sh ttymxc0::askfirst:/usr/libexec/login.sh diff --git a/target/linux/x86/base-files.mk b/target/linux/x86/base-files.mk new file mode 100644 index 0000000000000..f846133d24b26 --- /dev/null +++ b/target/linux/x86/base-files.mk @@ -0,0 +1,10 @@ +GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL)) +ifeq ($(GRUB_SERIAL),) +$(error This platform requires CONFIG_GRUB_SERIAL be set!) +endif + +ifneq ($(GRUB_SERIAL),) + define Package/base-files/install-target + $(SED) "s#@GRUB_SERIAL@#$(GRUB_SERIAL)#" $(1)/etc/inittab + endef +endif diff --git a/target/linux/x86/base-files/etc/inittab b/target/linux/x86/base-files/etc/inittab index f4747f200d0b2..9daf2ce2f0f34 100644 --- a/target/linux/x86/base-files/etc/inittab +++ b/target/linux/x86/base-files/etc/inittab @@ -1,5 +1,5 @@ ::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K shutdown -ttyS0::askfirst:/usr/libexec/login.sh +@GRUB_SERIAL@::askfirst:/usr/libexec/login.sh hvc0::askfirst:/usr/libexec/login.sh tty1::askfirst:/usr/libexec/login.sh