From d56dd5688127f8fe860b11e5e6a7e8c28ad24549 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Tue, 11 Apr 2023 15:49:03 +1200 Subject: [PATCH] Allow custom console=tty0 argument The bootloader element now has variable DIB_BOOTLOADER_VIRTUAL_TERMINAL to customize or suppress the console=tty0 kernel argument. This is proposed to allow console=tty0 to be removed entirely as it is causing significant performance degredation in DPDK environments. Change-Id: Iba2ee5b8a6b4acdd236a770550dffd29c784ce11 Related: rhbz#2179366 --- diskimage_builder/elements/bootloader/README.rst | 5 +++++ .../environment.d/10-bootloader-default-cmdline | 7 +++++++ .../elements/bootloader/finalise.d/50-bootloader | 16 +++++++++++----- releasenotes/notes/tty0-d01980dce4ed7786.yaml | 5 +++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/tty0-d01980dce4ed7786.yaml diff --git a/diskimage_builder/elements/bootloader/README.rst b/diskimage_builder/elements/bootloader/README.rst index c786ee0bb..306410de3 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 a5176b80d..598f59808 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 64f06810f..5cb14c2d1 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 000000000..b29244eb6 --- /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