summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-12 18:29:43 +0100
committerGitHub <noreply@github.com>2024-01-12 18:29:43 +0100
commit72e30717dc2d4bdec118be227054c5b3db3ce8e1 (patch)
tree3fce5c53b3511c3a97c6af8e305db46fa1bd4e0e
parent387d4727d747306414cb26460e835b3d56e33da0 (diff)
parentb676106dd0926dc72cd959836270e1ffb9f48918 (diff)
downloadvyos-1x-72e30717dc2d4bdec118be227054c5b3db3ce8e1.tar.gz
vyos-1x-72e30717dc2d4bdec118be227054c5b3db3ce8e1.zip
Merge pull request #2811 from vyos/mergify/bp/sagitta/pr-2806
image-tools: T5910: explicitly set transmission speed of serial console (backport #2806)
-rw-r--r--data/templates/grub/grub_common.j24
-rw-r--r--data/templates/grub/grub_vyos_version.j211
-rwxr-xr-xsrc/op_mode/image_installer.py1
-rw-r--r--src/system/grub_update.py3
4 files changed, 13 insertions, 6 deletions
diff --git a/data/templates/grub/grub_common.j2 b/data/templates/grub/grub_common.j2
index 278ffbf2c..29c2ab879 100644
--- a/data/templates/grub/grub_common.j2
+++ b/data/templates/grub/grub_common.j2
@@ -8,9 +8,9 @@ fi
function setup_serial {
# initialize the first serial port by default
if [ "${console_type}" == "ttyS" ]; then
- serial --unit=${console_num}
+ serial --unit=${console_num} --speed=${console_speed}
else
- serial --unit=0
+ serial --unit=0 --speed=${console_speed}
fi
terminal_output --append serial console
terminal_input --append serial console
diff --git a/data/templates/grub/grub_vyos_version.j2 b/data/templates/grub/grub_vyos_version.j2
index 97fbe8473..62688e68b 100644
--- a/data/templates/grub/grub_vyos_version.j2
+++ b/data/templates/grub/grub_vyos_version.j2
@@ -6,16 +6,21 @@
{% endif %}
menuentry "{{ version_name }}" --id {{ version_uuid }} {
set boot_opts="{{ boot_opts_rendered }}"
+ if [ "${console_type}" == "ttyS" ]; then
+ set console_opts="console=${console_type}${console_num},${console_speed}"
+ else
+ set console_opts="console=${console_type}${console_num}"
+ fi
# load rootfs to RAM
if [ "${boot_toram}" == "yes" ]; then
set boot_opts="${boot_opts} toram"
fi
if [ "${bootmode}" == "pw_reset" ]; then
- set boot_opts="${boot_opts} console=${console_type}${console_num} init=/usr/libexec/vyos/system/standalone_root_pw_reset"
+ set boot_opts="${boot_opts} ${console_opts} init=/usr/libexec/vyos/system/standalone_root_pw_reset"
elif [ "${bootmode}" == "recovery" ]; then
- set boot_opts="${boot_opts} console=${console_type}${console_num} init=/usr/bin/busybox init"
+ set boot_opts="${boot_opts} ${console_opts} init=/usr/bin/busybox init"
else
- set boot_opts="${boot_opts} console=${console_type}${console_num}"
+ set boot_opts="${boot_opts} ${console_opts}"
fi
linux "/boot/{{ version_name }}/vmlinuz" ${boot_opts}
initrd "/boot/{{ version_name }}/initrd.img"
diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py
index 5e2af2d97..b78029c24 100755
--- a/src/op_mode/image_installer.py
+++ b/src/op_mode/image_installer.py
@@ -91,6 +91,7 @@ DEFAULT_BOOT_VARS: dict[str, str] = {
'timeout': '5',
'console_type': 'tty',
'console_num': '0',
+ 'console_speed': '115200',
'bootmode': 'normal'
}
diff --git a/src/system/grub_update.py b/src/system/grub_update.py
index 3c851f0e0..4d5e0b6ae 100644
--- a/src/system/grub_update.py
+++ b/src/system/grub_update.py
@@ -68,7 +68,8 @@ if __name__ == '__main__':
'default': grub.gen_version_uuid(default_entry['version']),
'bootmode': default_entry['bootmode'],
'console_type': default_entry['console_type'],
- 'console_num': default_entry['console_num']
+ 'console_num': default_entry['console_num'],
+ 'console_speed': '115200'
}
vars.update(default_settings)