summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2026-05-13 07:47:36 -0500
committerGitHub <noreply@github.com>2026-05-13 07:47:36 -0500
commit1423a3d7ad2cca1eee7fe8dc3db10e2ac07077e2 (patch)
treebb6c6f23891a4cd84cfd3a897042da7002dda5e2
parent4c224fdafba7dd42bcc6931ba52962ea1db2dc7c (diff)
parent7396eeadc74c026b84d615f1e92952af98d4b241 (diff)
downloadvyos-build-1423a3d7ad2cca1eee7fe8dc3db10e2ac07077e2.tar.gz
vyos-build-1423a3d7ad2cca1eee7fe8dc3db10e2ac07077e2.zip
Merge pull request #1186 from c-po/serial-implant
serial: T8844: fix default config injection leading to invalid boot console
-rw-r--r--data/live-build-config/hooks/live/95-serial.chroot14
1 files changed, 10 insertions, 4 deletions
diff --git a/data/live-build-config/hooks/live/95-serial.chroot b/data/live-build-config/hooks/live/95-serial.chroot
index 1bcaa963..9980bae7 100644
--- a/data/live-build-config/hooks/live/95-serial.chroot
+++ b/data/live-build-config/hooks/live/95-serial.chroot
@@ -2,22 +2,28 @@
# We do have different default console configurations per flavor used. We will
# set the serial console to the default configuration for the flavor.
-WRITE_CONFIG="/usr/libexec/vyos/write-config-file-value.py"
+WRITE_CONFIG=$(python3 -c 'from vyos.defaults import base_dir; print(f"{base_dir}/write-config-file-value.py")')
if ! test -x $WRITE_CONFIG; then
echo "E: missing script to implant serial config settings"
exit 1
fi
default_config_file=$(python3 -c 'from vyos.defaults import config_default; print(config_default)')
-device=$(jq -r '"\(.console_type)\(.console_num)"' /usr/share/vyos/flavor.json)
-speed=$(jq -r '.console_speed' /usr/share/vyos/flavor.json)
+flavor_file=$(python3 -c 'from vyos.defaults import directories; print(directories["data"] + "flavor.json" )')
+console_type=$(jq -r '.console_type' $flavor_file)
+device=$(jq -r '"\(.console_type)\(.console_num)"' $flavor_file)
+speed=$(jq -r '.console_speed' $flavor_file)
-if [ -n "$device" ] && [ -n "$speed" ] && [ -f $default_config_file ]; then
+# Serial console settings apply only to hardware serial (x86) or UART (ARM).
+if [ "$console_type" != ttyS ] && [ "$console_type" != ttyAMA ]; then
+ echo "I: Skipping serial console implant (console_type=$console_type is not ttyS or ttyAMA)"
+elif [ -n "$device" ] && [ -n "$speed" ] && [ -f $default_config_file ]; then
$WRITE_CONFIG --path "system console device $device speed" \
--value "$speed" \
--config-file $default_config_file
$WRITE_CONFIG --path "system console device $device kernel" \
--config-file $default_config_file
+ echo "I: Changed serial console settings in: $default_config_file to $device,$speed"
else
echo "E: Could not implant serial console settings in: $default_config_file"
exit 1