diff --git a/diskimage_builder/elements/bootloader/README.rst b/diskimage_builder/elements/bootloader/README.rst index c786ee0b..306410de 100644 --- a/diskimage_builder/elements/bootloader/README.rst +++ b/diskimage_builder/elements/bootloader/README.rst @@ -17,3 +17,8 @@ Arguments * ``DIB_BOOTLOADER_SERIAL_CONSOLE`` sets the serial device to be used as a console. It defaults to ``hvc0`` for PowerPC, ``ttyAMA0,115200`` for ARM64, otherwise ``ttyS0,115200``. + +* ``DIB_BOOTLOADER_VIRTUAL_TERMINAL`` sets the virtual terminal be + used as a console. It defaults to ``tty0``. When explicitly set + to an empty string then no virtual terminal console kernel argument + is added. diff --git a/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline b/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline index a5176b80..598f5980 100644 --- a/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline +++ b/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline @@ -1,2 +1,9 @@ export DIB_BOOTLOADER_DEFAULT_CMDLINE=${DIB_BOOTLOADER_DEFAULT_CMDLINE:-"nofb nomodeset gfxpayload=text"} export DIB_BOOTLOADER_SERIAL_CONSOLE=${DIB_BOOTLOADER_SERIAL_CONSOLE:-""} +if [ ! -v DIB_BOOTLOADER_VIRTUAL_TERMINAL ]; then + # DIB_BOOTLOADER_VIRTUAL_TERMINAL is unset + export DIB_BOOTLOADER_VIRTUAL_TERMINAL=tty0 +else + # DIB_BOOTLOADER_VIRTUAL_TERMINAL is set to empty string or other value + export DIB_BOOTLOADER_VIRTUAL_TERMINAL=${DIB_BOOTLOADER_VIRTUAL_TERMINAL} +fi diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 64f06810..5cb14c2d 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -135,17 +135,23 @@ fi if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then - SERIAL_CONSOLE="${DIB_BOOTLOADER_SERIAL_CONSOLE}" + SERIAL_CONSOLE="console=${DIB_BOOTLOADER_SERIAL_CONSOLE}" elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then # Serial console on Power is hvc0 - SERIAL_CONSOLE="hvc0" + SERIAL_CONSOLE="console=hvc0" elif [[ "arm64" =~ "$ARCH" ]]; then - SERIAL_CONSOLE="ttyAMA0,115200" + SERIAL_CONSOLE="console=ttyAMA0,115200" else - SERIAL_CONSOLE="ttyS0,115200" + SERIAL_CONSOLE="console=ttyS0,115200" fi -GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=${SERIAL_CONSOLE} no_timer_check" +if [[ -n "${DIB_BOOTLOADER_VIRTUAL_TERMINAL}" ]]; then + VIRTUAL_TERMINAL="console=${DIB_BOOTLOADER_VIRTUAL_TERMINAL}" +else + VIRTUAL_TERMINAL="" +fi + +GRUB_CMDLINE_LINUX_DEFAULT="${VIRTUAL_TERMINAL} ${SERIAL_CONSOLE} no_timer_check" echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT} ${DIB_BOOTLOADER_DEFAULT_CMDLINE} ${BOOT_FS} ${BOOT_FIPS}\"" >>/etc/default/grub echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub diff --git a/releasenotes/notes/tty0-d01980dce4ed7786.yaml b/releasenotes/notes/tty0-d01980dce4ed7786.yaml new file mode 100644 index 00000000..b29244eb --- /dev/null +++ b/releasenotes/notes/tty0-d01980dce4ed7786.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The bootloader element now has variable DIB_BOOTLOADER_VIRTUAL_TERMINAL to + customize or suppress the console=tty0 kernel argument. \ No newline at end of file