Commit 582a801f authored by Romain Perier's avatar Romain Perier

z50-raspi3-firmware: Make consoles configurable for cmdline.txt (Closes: #926325)

This makes the console= argument configurable from /etc/default/raspi3-firmware
for the generated cmdline parameters in cmdline.txt. Helpful if you want
to decide where to redirect your system logs during boot or if you want
several consoles.
parent 53624b47
raspi3-firmware (1.20190215-2~exp2) UNRELEASED; urgency=medium
* z50-raspi3-firmware: Change to use arm_64bit=1 (Closes: #925062)
* z50-raspi3-firmware: Make consoles configurable for cmdline.txt
(Closes: #926325)
-- Romain Perier <romain.perier@gmail.com> Tue, 26 Mar 2019 15:57:11 +0100
-- Romain Perier <romain.perier@gmail.com> Wed, 03 Apr 2019 19:21:40 +0200
raspi3-firmware (1.20190215-2~exp1) experimental; urgency=medium
......
......@@ -34,3 +34,17 @@
# of the KERNEL image. It can also be set to "no", in this case no
# initramfs will be handled at all by the firmware.
#INITRAMFS="auto"
# Consoles to use for logging. This is a list separated by spaces.
# A tty will be put on all consoles contained in this list, but the last
# one will be used for system boot logs. If you want to use the default
# consoles recommended for the RPIs, leave this value to "auto".
# examples:
# - for logging to an HDMI screen:
# CONSOLES="tty0"
# - for logging to an uart:
# CONSOLES="ttyS1,115200"
# - for logging system boot logs to uart and get a console on the HDMI
# screen and on the uart:
# CONSOLES="tty0 ttyS1,115200"
#CONSOLES="auto"
......@@ -48,6 +48,7 @@ CMA=64M
ROOTPART=/dev/mmcblk0p2
KERNEL="auto"
INITRAMFS="auto"
CONSOLES="auto"
if [ -r /etc/default/raspi3-firmware ]; then
. /etc/default/raspi3-firmware
fi
......@@ -85,13 +86,15 @@ if [ "$KERNEL" = "auto" ]; then
cp "$latest_kernel" /boot/firmware/
cp "$latest_initrd" /boot/firmware/
serial="ttyAMA0,115200"
kernelmajor=$(echo "${latest_kernel_basename}" | sed 's,^vmlinuz-,,g' | cut -d. -f 1)
kernelminor=$(echo "${latest_kernel_basename}" | cut -d. -f 2)
if [ $kernelmajor -ge 4 ]; then
if [ $kernelminor -ge 14 ]; then
# Since Linux 4.14, /dev/ttyS1 is the UART on the pinheader.
serial="ttyS1,115200"
if [ "$CONSOLES" = "auto" ]; then
serial="ttyAMA0,115200"
kernelmajor=$(echo "${latest_kernel_basename}" | sed 's,^vmlinuz-,,g' | cut -d. -f 1)
kernelminor=$(echo "${latest_kernel_basename}" | cut -d. -f 2)
if [ $kernelmajor -ge 4 ]; then
if [ $kernelminor -ge 14 ]; then
# Since Linux 4.14, /dev/ttyS1 is the UART on the pinheader.
serial="ttyS1,115200"
fi
fi
fi
fi
......@@ -127,8 +130,19 @@ fi
# Our cmdline.txt is the default (see http://elinux.org/RPi_cmdline.txt), but
# without parameters for drivers we do not have (e.g. dwc_otg.lpm_enable) or
# parameters we do not need (e.g. rootfstype=, as we are using an initrd).
# We leave the consoles configurable.
pre_cmdline="console=tty0 console=${serial}"
if [ "$CONSOLES" != "auto" ]; then
pre_cmdline=""
for console in $CONSOLES; do
pre_cmdline= "${pre_cmdline} console=${console}"
done
fi
cat >/boot/firmware/cmdline.txt <<EOF
console=tty0 console=${serial} root=$ROOTPART rw elevator=deadline fsck.repair=yes net.ifnames=0 cma=$CMA rootwait
${pre_cmdline} root=$ROOTPART rw elevator=deadline fsck.repair=yes net.ifnames=0 cma=$CMA rootwait
EOF
cd /boot/firmware
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment