On 2019-01-19 11:08 +0000, Steve McIntyre wrote: > On Sat, Jan 19, 2019 at 04:27:05AM +0000, Wookey wrote:
[Re: adding multiple console support to D-I, including changing /var/run/console-device with one device line to be /var/run/console-devices with 1 or more lines] > >The only other place this affects is > >packages/finish-install.d/90console which reads > >/var/run/console-device when tidying up at the end in order to write > >inittab entries for the used console device (serial, xen, etc). So here is the patch for that so that the right file is looked in and any serial devices are dealt with as before, alowing for the fact there may be more than one console device listed. This code is not well-tested yet, but I think it does the right thing. Review welcome. I can't see any reason why running through this more than once should change anything, but I could be missing something. I note that there is a load of upstart support in here. Can anyone thing of a reason to keep that? I suspect it should go. Happy to do that if we agree. Wookey -- Principal hats: Linaro, Debian, Wookware, ARM http://wookware.org/
commit 2e238ab985eebd44f29cc7b5cd6b7cacc71d792e Author: Wookey <woo...@wookware.org> Date: Fri Feb 15 01:50:44 2019 +0000 Update to deal with multiple consoles diff --git a/finish-install.d/90console b/finish-install.d/90console index bd2f528..0045046 100755 --- a/finish-install.d/90console +++ b/finish-install.d/90console @@ -38,72 +38,76 @@ case "$(udpkg --print-os)" in hurd) # TODO: detect VGA hurd console, and enable it in installed # system. - console=console + consoles=/dev/console ;; *) - console=$(cat /var/run/console-device) - console=${console#/dev/} + consoles=$(cat /var/run/console-devices) ;; esac -if [ -f /target/etc/init/tty1.conf ]; then - upstart_tty1=/target/etc/init/tty1.conf - upstart_console () { +for console in $consoles +do + console=${console#/dev/} + + if [ -f /target/etc/init/tty1.conf ]; then + upstart_tty1=/target/etc/init/tty1.conf + upstart_console () { echo "/target/etc/init/$1.conf" - } -elif [ -f /target/etc/event.d/tty1 ]; then - upstart_tty1=/target/etc/event.d/tty1 - upstart_console () { + } + elif [ -f /target/etc/event.d/tty1 ]; then + upstart_tty1=/target/etc/event.d/tty1 + upstart_console () { echo "/target/etc/event.d/$1" - } -else - upstart_tty1= -fi - -case "$console" in - tty[A-Zu]*|duart*) - log "Configuring init for serial console" - consoletype=${console%%[0-9]*} - ttyline=${console#$consoletype} - ttyspeed=$(chroot /target stty --file /dev/$console speed) - ttyterm="$TERM" - - flowctrlarg="" - if uses_hw_flowcontrol $console; then - flowctrlarg="-h " + } + else + upstart_tty1= fi - if [ -z "$ttyterm" ]; then ttyterm=vt100; fi - if [ -z "$ttyspeed" ]; then ttyspeed=9600; fi + case "$console" in + tty[A-Zu]*|duart*) + log "Configuring init for serial console" + consoletype=${console%%[0-9]*} + ttyline=${console#$consoletype} + ttyspeed=$(chroot /target stty --file /dev/$console speed) + ttyterm="$TERM" + + flowctrlarg="" + if uses_hw_flowcontrol $console; then + flowctrlarg="-h " + fi - if [ -f /target/etc/inittab ]; then - # Disable regular VTs - if [ -z "$KEEP_VT" ]; then + if [ -z "$ttyterm" ]; then ttyterm=vt100; fi + if [ -z "$ttyspeed" ]; then ttyspeed=9600; fi + + if [ -f /target/etc/inittab ]; then + # Disable regular VTs + if [ -z "$KEEP_VT" ]; then sed -i -e "s/^\([1-6]\):/#\1:/" /target/etc/inittab + fi + # Enable serial console + sed -i -e "s/^#T0\(.*\)ttyS.*/T$ttyline\1$console $ttyspeed $ttyterm/" \ + /target/etc/inittab + sed -i -e "s/^\(T$ttyline.*\) -8/\1/" /target/etc/inittab + sed -i -e "s/^\(T$ttyline.* \)-L/\1$flowctrlarg-L/" /target/etc/inittab + fi + if [ "$upstart_tty1" ]; then + sed -e "s/^\(exec.*getty \).*/\1-L $console $ttyspeed $ttyterm/" \ + -e "s/tty1/$console/g" \ + "$upstart_tty1" > "$(upstart_console "$console")" + sed -i -e "s/^\(exec.*\) -8/\1/" "$(upstart_console "$console")" + sed -i -e "s/^\(exec.*\)-L/\1$flowctrlarg-L/" "$(upstart_console "$console")" + fi + if [ "$(readlink /target/sbin/init)" = "/lib/systemd/systemd" ] ; then + chroot /target systemctl --no-reload --quiet enable serial-getty@"$console".service fi - # Enable serial console - sed -i -e "s/^#T0\(.*\)ttyS.*/T$ttyline\1$console $ttyspeed $ttyterm/" \ - /target/etc/inittab - sed -i -e "s/^\(T$ttyline.*\) -8/\1/" /target/etc/inittab - sed -i -e "s/^\(T$ttyline.* \)-L/\1$flowctrlarg-L/" /target/etc/inittab - fi - if [ "$upstart_tty1" ]; then - sed -e "s/^\(exec.*getty \).*/\1-L $console $ttyspeed $ttyterm/" \ - -e "s/tty1/$console/g" \ - "$upstart_tty1" > "$(upstart_console "$console")" - sed -i -e "s/^\(exec.*\) -8/\1/" "$(upstart_console "$console")" - sed -i -e "s/^\(exec.*\)-L/\1$flowctrlarg-L/" "$(upstart_console "$console")" - fi - if [ "$(readlink /target/sbin/init)" = "/lib/systemd/systemd" ] ; then - chroot /target systemctl --no-reload --quiet enable serial-getty@"$console".service - fi - write_console "$rawconsole" /target/etc/securetty - if [ -n "$console" ] && [ "$console" != "$rawconsole" ]; then - write_console "$console" /target/etc/securetty - fi - ;; -esac + write_console "$rawconsole" /target/etc/securetty + if [ -n "$console" ] && [ "$console" != "$rawconsole" ]; then + write_console "$console" /target/etc/securetty + fi + ;; + esac +done # Set up virtualized console via onboard service processor (hvsi/hvc) DT_ROOT=/proc/device-tree
signature.asc
Description: PGP signature