diff --git a/diskimage_builder/elements/bootloader/README.rst b/diskimage_builder/elements/bootloader/README.rst index 56e17076..1c2aefc5 100644 --- a/diskimage_builder/elements/bootloader/README.rst +++ b/diskimage_builder/elements/bootloader/README.rst @@ -16,3 +16,7 @@ Arguments * ``DIB_BOOTLOADER_DEFAULT_CMDLINE`` sets parameters that are appended to the ``GRUB_CMDLINE_LINUX_DEFAULT`` values in ``grub.cfg`` configuration. It defaults to ``nofb nomodeset vga=normal``. + +* ``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``. 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 902494b4..2e474f92 100644 --- a/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline +++ b/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline @@ -1 +1,2 @@ export DIB_BOOTLOADER_DEFAULT_CMDLINE=${DIB_BOOTLOADER_DEFAULT_CMDLINE:-"nofb nomodeset vga=normal"} +export DIB_BOOTLOADER_SERIAL_CONSOLE=${DIB_BOOTLOADER_SERIAL_CONSOLE:-""} \ No newline at end of file diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 75dfd78c..26b861b8 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -174,8 +174,10 @@ function install_grub2 { echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub - # Serial console on Power is hvc0 - if [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then + if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then + SERIAL_CONSOLE="${DIB_BOOTLOADER_SERIAL_CONSOLE}" + elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then + # Serial console on Power is hvc0 SERIAL_CONSOLE="hvc0" elif [[ "arm64" =~ "$ARCH" ]]; then SERIAL_CONSOLE="ttyAMA0,115200"