Move the console= parameter for the serial console.

See https://salsa.debian.org/raspi-team/image-specs/-/issues/57 for
detailed background.

Summary, e.g. on the Pi 4:
 - fresh build and first boot means:
    console=ttyS1,115200 console=tty0
 - after dpkg-reconfigure raspi-firmware has run, with the default
   settings:
    console=tty0 console=ttyS1,115200

Having some consistency across boots seems desirable (esp. when the Pi
fails to boot and the hints are on a serial console which might not be
wired), so insert the console= parameter for the serial console right
before the root= parameter.

Currently, the /etc/kernel/postinst.d/z50-raspi-firmware hook uses:

    ${pre_cmdline} root=$ROOTPART […]

and console= parameters are inserted via ${pre_cmdline}, so inserting
the serial console before root= should get us the same results.
This commit is contained in:
Cyril Brulebois 2021-10-21 16:47:55 +02:00
parent f89f71560d
commit 6251ebfbe0
1 changed files with 3 additions and 2 deletions

View File

@ -137,14 +137,15 @@ steps:
rm -rf /var/lib/apt/lists rm -rf /var/lib/apt/lists
# Modify the kernel commandline we take from the firmware to boot from # Modify the kernel commandline we take from the firmware to boot from
# the partition labeled raspiroot instead of forcing it to mmcblk0p2 # the partition labeled raspiroot instead of forcing it to mmcblk0p2.
# Also insert the serial console right before the root= parameter.
# #
# These changes will be overwritten after the hardware is probed # These changes will be overwritten after the hardware is probed
# after dpkg reconfigures raspi-firmware (upon first boot), so make # after dpkg reconfigures raspi-firmware (upon first boot), so make
# sure we don't lose label-based booting. # sure we don't lose label-based booting.
- chroot: / - chroot: /
shell: | shell: |
sed -i 's/^/console=__SERIAL_CONSOLE__ /' /boot/firmware/cmdline.txt sed -i 's/root=/console=__SERIAL_CONSOLE__ root=/' /boot/firmware/cmdline.txt
sed -i 's#root=/dev/mmcblk0p2#root=LABEL=RASPIROOT#' /boot/firmware/cmdline.txt sed -i 's#root=/dev/mmcblk0p2#root=LABEL=RASPIROOT#' /boot/firmware/cmdline.txt
sed -i 's/^#ROOTPART=.*/ROOTPART=LABEL=RASPIROOT/' /etc/default/raspi-firmware sed -i 's/^#ROOTPART=.*/ROOTPART=LABEL=RASPIROOT/' /etc/default/raspi-firmware