Provide an ability to disable serial console injection
By default, we attempt to inject a serial console, which may, or may not be needed, for example, Centos Stream 9 cloud images already configure a console setting, and repeating it just might be undesirable and cause workload performance degredation if the kernel or an application has to report anything to a console. This change generally results in original console entries being preserved, which might actually be a bug and get fixed in a latter patch. Generally, users of dib *should* likely be specific what they want to do with their console setting, and without setting the new DIB_BOOTLOADER_USE_SERIAL_CONSOLE paramter to false, the default will be adhered to, and any pre-existing serial console entries will *not* be de-duplicated from the base image. That too is *likely* a bug, but a harder one to fix. Change-Id: Icdfb5ed021b1a91e2de3c9a22bb2ff7fe9882bcd
This commit is contained in:
parent
fc4fa1e81f
commit
69187bae3f
@ -19,6 +19,9 @@ Arguments
|
|||||||
to the ``GRUB_CMDLINE_LINUX_DEFAULT`` values in ``grub.cfg``
|
to the ``GRUB_CMDLINE_LINUX_DEFAULT`` values in ``grub.cfg``
|
||||||
configuration. It defaults to ``nofb nomodeset gfxpayload=text``.
|
configuration. It defaults to ``nofb nomodeset gfxpayload=text``.
|
||||||
|
|
||||||
|
* ``DIB_BOOTLOADER_USE_SERIAL_CONSOLE`` allows usage of a serial console
|
||||||
|
to be disabled in the resulting image by setting to a value of ``False``.
|
||||||
|
|
||||||
* ``DIB_BOOTLOADER_SERIAL_CONSOLE`` sets the serial device to be
|
* ``DIB_BOOTLOADER_SERIAL_CONSOLE`` sets the serial device to be
|
||||||
used as a console. It defaults to ``hvc0`` for PowerPC,
|
used as a console. It defaults to ``hvc0`` for PowerPC,
|
||||||
``ttyAMA0,115200`` for ARM64, otherwise ``ttyS0,115200``.
|
``ttyAMA0,115200`` for ARM64, otherwise ``ttyS0,115200``.
|
||||||
|
@ -8,3 +8,4 @@ else
|
|||||||
export DIB_BOOTLOADER_VIRTUAL_TERMINAL=${DIB_BOOTLOADER_VIRTUAL_TERMINAL}
|
export DIB_BOOTLOADER_VIRTUAL_TERMINAL=${DIB_BOOTLOADER_VIRTUAL_TERMINAL}
|
||||||
fi
|
fi
|
||||||
export DIB_NO_TIMER_CHECK=${DIB_NO_TIMER_CHECK:-"True"}
|
export DIB_NO_TIMER_CHECK=${DIB_NO_TIMER_CHECK:-"True"}
|
||||||
|
export DIB_BOOTLOADER_USE_SERIAL_CONSOLE=${DIB_BOOTLOADER_USE_SERIAL_CONSOLE:-"True"}
|
||||||
|
@ -91,7 +91,11 @@ echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub
|
|||||||
echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
|
echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
|
||||||
echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub
|
echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub
|
||||||
echo "GRUB_TIMEOUT_STYLE=${DIB_GRUB_TIMEOUT_STYLE:-hidden}" >>/etc/default/grub
|
echo "GRUB_TIMEOUT_STYLE=${DIB_GRUB_TIMEOUT_STYLE:-hidden}" >>/etc/default/grub
|
||||||
echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub
|
if [[ "True" == "${DIB_BOOTLOADER_USE_SERIAL_CONSOLE:-True}" ]]; then
|
||||||
|
echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub
|
||||||
|
else
|
||||||
|
echo 'GRUB_TERMINAL="console"' >>/etc/default/grub
|
||||||
|
fi
|
||||||
echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub
|
echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub
|
||||||
|
|
||||||
# NOTE(TheJulia): We need to remove any boot entry from the /etc/default/grub
|
# NOTE(TheJulia): We need to remove any boot entry from the /etc/default/grub
|
||||||
@ -139,16 +143,19 @@ if [[ -x /bin/fips-mode-setup ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "True" == "${DIB_BOOTLOADER_USE_SERIAL_CONSOLE:-True}" ]]; then
|
||||||
if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then
|
if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then
|
||||||
SERIAL_CONSOLE="console=${DIB_BOOTLOADER_SERIAL_CONSOLE}"
|
SERIAL_CONSOLE="console=${DIB_BOOTLOADER_SERIAL_CONSOLE}"
|
||||||
elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then
|
elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then
|
||||||
# Serial console on Power is hvc0
|
# Serial console on Power is hvc0
|
||||||
SERIAL_CONSOLE="console=hvc0"
|
SERIAL_CONSOLE="console=hvc0"
|
||||||
elif [[ "arm64" =~ "$ARCH" ]]; then
|
elif [[ "arm64" =~ "$ARCH" ]]; then
|
||||||
SERIAL_CONSOLE="console=ttyAMA0,115200"
|
SERIAL_CONSOLE="console=ttyAMA0,115200"
|
||||||
|
else
|
||||||
|
SERIAL_CONSOLE="console=ttyS0,115200"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
SERIAL_CONSOLE="console=ttyS0,115200"
|
SERIAL_CONSOLE=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${DIB_BOOTLOADER_VIRTUAL_TERMINAL}" ]]; then
|
if [[ -n "${DIB_BOOTLOADER_VIRTUAL_TERMINAL}" ]]; then
|
||||||
@ -165,7 +172,11 @@ fi
|
|||||||
|
|
||||||
GRUB_CMDLINE_LINUX_DEFAULT="${VIRTUAL_TERMINAL} ${SERIAL_CONSOLE} ${NO_TIMER_CHECK}"
|
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_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
|
|
||||||
|
|
||||||
|
if [[ "True" == "${DIB_BOOTLOADER_USE_SERIAL_CONSOLE:-True}" ]]; then
|
||||||
|
echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub
|
||||||
|
fi
|
||||||
|
|
||||||
# os-prober leaks /dev/sda into config file in dual-boot host
|
# os-prober leaks /dev/sda into config file in dual-boot host
|
||||||
# Disable grub-os-prober to avoid the issue while running
|
# Disable grub-os-prober to avoid the issue while running
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds the ability to disable serial console logging from being setup in
|
||||||
|
the ``bootloader`` element by setting the
|
||||||
|
``DIB_BOOTLOADER_USE_SERIAL_CONSOLE`` environment variable to ``False``.
|
Loading…
x
Reference in New Issue
Block a user