diff options
author | John Estabrook <jestabro@vyos.io> | 2024-01-12 10:10:58 -0600 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-01-17 05:34:02 +0000 |
commit | 2afd5e5575a42bee4483e093e9611fa3363c8adc (patch) | |
tree | 62c525749ed7beb7e89a59a265893edfcb055a11 /data/templates | |
parent | 6c39a9cb6df6bb56c02583f82d68edc8ef17241d (diff) | |
download | vyos-1x-2afd5e5575a42bee4483e093e9611fa3363c8adc.tar.gz vyos-1x-2afd5e5575a42bee4483e093e9611fa3363c8adc.zip |
image-tools: T5923: update system_console.py for new GRUB file structure
Add util function to set serial console speed in accordance with revised
GRUB file structure; in keeping with the intentions of the config_mode
script, adjust the GRUB var 'console_speed' to only modify ttyS0.
(cherry picked from commit 5ceaff2ef970cb9c567ac317bafbffca5b073f4a)
Diffstat (limited to 'data/templates')
-rw-r--r-- | data/templates/grub/grub_common.j2 | 6 | ||||
-rw-r--r-- | data/templates/grub/grub_compat.j2 | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/data/templates/grub/grub_common.j2 b/data/templates/grub/grub_common.j2 index 29c2ab879..5e9b95cc0 100644 --- a/data/templates/grub/grub_common.j2 +++ b/data/templates/grub/grub_common.j2 @@ -8,7 +8,11 @@ fi function setup_serial { # initialize the first serial port by default if [ "${console_type}" == "ttyS" ]; then - serial --unit=${console_num} --speed=${console_speed} + if [ "${console_num}" == "0" ]; then + serial --unit=0 --speed=${console_speed} + else + serial --unit=${console_num} --speed=115200 + fi else serial --unit=0 --speed=${console_speed} fi diff --git a/data/templates/grub/grub_compat.j2 b/data/templates/grub/grub_compat.j2 index 887d5d0bd..d1085eec8 100644 --- a/data/templates/grub/grub_compat.j2 +++ b/data/templates/grub/grub_compat.j2 @@ -22,13 +22,13 @@ {%- endmacro %} {% macro console_opts(type) -%} {% if type == 'tty' -%} - console=ttyS0,115200 console=tty0 + console=ttyS0,{{ console_speed }} console=tty0 {%- elif type == 'ttyS' -%} - console=tty0 console=ttyS0,115200 + console=tty0 console=ttyS0,{{ console_speed }} {%- elif type == 'ttyUSB' -%} console=tty0 console=ttyUSB0,115200 {%- else -%} - console=tty0 console=ttyS0,115200 + console=tty0 console=ttyS0,{{ console_speed }} {%- endif %} {%- endmacro %} {% macro passwd_opts(mode) -%} @@ -39,9 +39,13 @@ set default={{ default }} set timeout={{ timeout }} {% if console_type == 'ttyS' %} +{% if console_num == '0' %} +serial --unit=0 --speed={{ console_speed }} +{% else %} serial --unit={{ console_num }} --speed=115200 +{% endif %} {% else %} -serial --unit=0 --speed=115200 +serial --unit=0 --speed={{ console_speed }} {% endif %} terminal_output --append serial terminal_input serial console |