bootloader: make serial console configurable

Currently, the serial console is hardcoded to ttyS0 in the bootloader
element.  This is a challenge for users that want to build images for
some baremetal servers. Supermicro servers, for example, use ttyS1 for
the serial over lan interface.

This patch adds a new environment variable DIB_BOOTLOADER_SERIAL_CONSOLE
that can be set to override the default.

Change-Id: Ie8173be8690ac0b7164ce9e5b66d3c1c18f844d6
This commit is contained in:
Andrei Nistor 2019-10-03 21:14:19 +00:00
parent a77a214339
commit 0e5e358063
3 changed files with 9 additions and 2 deletions

View File

@ -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``.

View File

@ -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:-""}

View File

@ -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"