diskimage-builder/diskimage_builder/elements/bootloader
Clark Boylan 3294aecca2 Properly set grub2 root device when using efi
We've noticed that centos8 arm64 images have a root devices of
/dev/mapper/loop7p3 which make sense within a dib image build context
but not at boot time. Dib intends to use labels to set the root device
but when efi is used we end up running grub2-mkconfig against the efi
grub config path before we configure grub to use labels.

Fix this by running grub2-mkconfig after its configuration is set.
This should avoid confusion and complicated paths through the scripts
that configure this for us. We then copy the resulting config to the efi
specific grub.cfg location for platforms that have it.

There is also a small refactoring that is done to try and make the ~3
boot variants more clear:

 1) Booting with legacy bios
 2) Booting with uefi without a signed shim that directly calls grub
 3) Booting with uefi and a signed shim that calls grub

Options 1 and 2 share the /boot/grub*/grub.cfg file. Option 3 needs its
grub.cfg to live alongside distro specific efi target.

Change-Id: Ie9790da9d1bbea58197b37b15a48e77f8a93c1ac
2021-04-07 15:46:10 -07:00
..
cleanup.d update grub cmdline to current kernel parameters 2020-06-14 00:39:42 -05:00
environment.d update grub cmdline to current kernel parameters 2020-06-14 00:39:42 -05:00
finalise.d Properly set grub2 root device when using efi 2021-04-07 15:46:10 -07:00
pkg-map Support secure-boot bootloader where possible 2021-03-11 10:27:59 +13:00
README.rst update grub cmdline to current kernel parameters 2020-06-14 00:39:42 -05:00

==========
bootloader
==========

Installs ``grub[2]`` on boot partition on the system. In case GRUB2 is
not available in the system, a fallback to Extlinux will happen. It's
also possible to enforce the use of Extlinux by exporting a
``DIB_EXTLINUX`` variable to the environment.

Arguments
=========

* ``DIB_GRUB_TIMEOUT`` sets the ``grub`` menu timeout.  It defaults to
  5 seconds.  Set this to 0 (no timeout) for fast boot times.

* ``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 gfxpayload=text``.

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