Message ID | 20191001125028.5094-1-mailist@logilin.fr |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/1] board/raspberrypi/post-build.sh: avoid HDMI login when getty disabled | expand |
On Tue, Oct 1, 2019 at 9:58 AM Christophe Blaess <mailist@logilin.fr> wrote: > > From: Christophe Blaess <christophe.blaess@logilin.fr> > > When the "Run a getty after boot" option is disabled, the inittab line > starting getty on serial console is commented out. But the line running > an HDMI login on Raspberry Pi is still enabled. > With this patch the HDMI line is removed. > > Co-authored-by: Christophe Blaess <christophe.blaess@logilin.fr> > Co-authored-by: Stephen Bos <stephen.bos@hagergroup.com> > > Signed-off-by: Christophe Blaess <christophe.blaess@logilin.fr> > --- > board/raspberrypi/post-build.sh | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/board/raspberrypi/post-build.sh b/board/raspberrypi/post-build.sh > index 5e5eb71100..7f4e1cc8bf 100755 > --- a/board/raspberrypi/post-build.sh > +++ b/board/raspberrypi/post-build.sh > @@ -3,9 +3,11 @@ > set -u > set -e > > -# Add a console on tty1 > if [ -e ${TARGET_DIR}/etc/inittab ]; then > - grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \ > - sed -i '/GENERIC_SERIAL/a\ > + # Remove tty1 line > + sed -i '/^tty1::/d' ${TARGET_DIR}/etc/inittab > + # Add a tty1 line if GENERIC_SERIAL is present (and not commented) > + sed -i '/^[^#].*GENERIC_SERIAL/a\ > tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab > fi > + > -- > 2.17.1 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot I guess you are using raspberrypi_defconfig as a template for a custom board configuration. Can't you simply leave BR2_ROOTFS_POST_BUILD_SCRIPT empty?
Hello Carlos, > I guess you are using raspberrypi_defconfig as a template for a custom > board configuration. Can't you simply leave > BR2_ROOTFS_POST_BUILD_SCRIPT empty? No, I was using raspberry_defconfig on Raspberry Pi 4 as training support to show how to use this option on production systems when we don't want any getty (only custom code running on background). I removed serial console by disabling the "Run a getty option.." but the HDMI login was still there. It's ok to remove the BR2_ROOTFS_POST_BUILD_SCRIPT, but I would rather have only disabled the getty option. It seemed more elegant to me.
On Thu, Oct 3, 2019 at 4:54 PM Christophe Blaess <mailist@logilin.fr> wrote: > > Hello Carlos, > > > I guess you are using raspberrypi_defconfig as a template for a custom > > board configuration. Can't you simply leave > > BR2_ROOTFS_POST_BUILD_SCRIPT empty? > > No, I was using raspberry_defconfig on Raspberry Pi 4 as training > support to show how to use this option on production systems when we > don't want any getty (only custom code running on background). > > I removed serial console by disabling the "Run a getty option.." but the > HDMI login was still there. > > It's ok to remove the BR2_ROOTFS_POST_BUILD_SCRIPT, but I would rather > have only disabled the getty option. It seemed more elegant to me. I think it's more elegant to solve the problem by means of the configuration, not by customizing buildroot. The board configurations an their post-build and post-mage scripts are mostly examples. If you need something more sophisticated then it's better to keep them in a BR2_EXTERNAL, as documented in http://www.buildroot.org/downloads/manual/manual.html#customize
Hello Christophe, On Tue, 1 Oct 2019 14:50:28 +0200 Christophe Blaess <mailist@logilin.fr> wrote: > -# Add a console on tty1 > if [ -e ${TARGET_DIR}/etc/inittab ]; then > - grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \ > - sed -i '/GENERIC_SERIAL/a\ > + # Remove tty1 line > + sed -i '/^tty1::/d' ${TARGET_DIR}/etc/inittab > + # Add a tty1 line if GENERIC_SERIAL is present (and not commented) > + sed -i '/^[^#].*GENERIC_SERIAL/a\ > tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab > fi We're fine with the idea, but we would like the implementation to rely on the BR2 option. So something like this: # Add a console on tty1 if grep -Eq "^BR2_TARGET_GENERIC_GETTY=y$" ${BR2_CONFIG} && [ -e ${TARGET_DIR}/etc/inittab ]; then grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \ sed -i '/GENERIC_SERIAL/a\ tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab fi Probably the shell syntax is bogus, but you get the point: we want to rely on BR2_TARGET_GENERIC_GETTY=y to decide whether or not to add a getty on tty1. Could you rework your patch in that direction ? Thanks! Thomas
diff --git a/board/raspberrypi/post-build.sh b/board/raspberrypi/post-build.sh index 5e5eb71100..7f4e1cc8bf 100755 --- a/board/raspberrypi/post-build.sh +++ b/board/raspberrypi/post-build.sh @@ -3,9 +3,11 @@ set -u set -e -# Add a console on tty1 if [ -e ${TARGET_DIR}/etc/inittab ]; then - grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \ - sed -i '/GENERIC_SERIAL/a\ + # Remove tty1 line + sed -i '/^tty1::/d' ${TARGET_DIR}/etc/inittab + # Add a tty1 line if GENERIC_SERIAL is present (and not commented) + sed -i '/^[^#].*GENERIC_SERIAL/a\ tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab fi +