Ever since signed shim binaries for multiple architectures became
available, the shim binaries installed in Linux distributions have
been renamed to include the EFI architecture in the binary names.
This started in Fedora, but is now used in openSUSE and Ubuntu too.
Reference for shim binary names comes from shim spec in Fedora:
d8c3c8e392/f/shim.spec (_23-32)
- point to main Calamares site in the 'part of' headers instead
of to github (this is the "this file is part of Calamares"
opening line for most files).
- remove boilerplate from all source files, CMake modules and completions,
this is the 3-paragraph summary of the GPL-3.0-or-later, which has
a meaning entirely covered by the SPDX tag.
In spite of there being considerable documentation sometimes in the
config file, we go with CC0 because we don't want the notion of
'derived work' of a config file.
The example `settings.conf` is also CC0. Add some docs to
it while we're at it.
There's lots of (YAML) test data that is just trivial configurations
for modules. Since the configurations themselves are **also** CC0-1.0,
and the tests are less interesting, license them equally liberally.
- These have **not** been fixed for validation, so the schema's themselves
will fail to load. This is a consequence of variations in JSON-Schema
representations through various drafts. Fixing the schemata is
fairly straightforward.
This gives us 19 new tests, all of which fail.
- root_mount_point was used initially for logging c1a139995 (adding new
bootloader job options are to use grub for BIOS, gummiboot for efi set
extra mountpoint when efi is found)
- the trace was removed since 533031b3c ([bootloader] print() does not
log)
- This forces the EFI firmware to boot the loader that was just
created, whatever the boot order set in the firmware setup (USB,
CD/DVD, HD...).
- It is safe to use the first Boot Entry listed in BootOrder as the
previous command creates the new entry and adds it to the first place
of the BootOrder.
src/modules/bootloader/main.py (install_secureboot): Run the configured
grubMkconfig command (should be `grub-mkconfig` or `grub2-mkconfig`) to
create `/boot/efi/EFI/$efi_bootloader_id/grub.cfg`. The sb-shim is just
a chainloader to GRUB 2, which expects a grub.cfg in that location, so
something has to create it or the installed system will not boot beyond
the GRUB rescue shell.
(install_grub): Fix misleading comment above the grubMkconfig call: it
is not the file specified in grubCfg that should be already filled out
by the grubcfg job module, that file is written by `grub*-mkconfig`
using `/etc/default/grub` as the input file. It is that input file
`/etc/default/grub` that should already be filled out by the grubcfg job
module. (The same input file is used in install_secureboot.)
- The output of subprocess is a bytes object, which needs to
be decoded so we can use it like a regular string (alternatively,
we could have changed more code to manipulate bytes, but eventually
we need a string to pass to a subsequent command anyway).
- Centralize the sanitizer so that it's consistent in different
environments.
- While here, add () to the sanitizer to avoid some distro's with
parenthesized names from creating weird EFI dirs.
When choosing `systemd-boot` as the bootloader, numerous problems
occurred:
- the kernel and initrd were not copied to the EFI System Partition,
and therefore could not be reached by the bootloader
- the fallback entry used the default initramfs image instead of the
fallback image
`systemd-boot` provides the `kernel-install` utility, which
automatically copies the kernel + initramfs to the EFI partition, and
creates the corresponding bootloader entry.
Unfortunately, `kernel-install` cannot be used here as the module is not
executed in a chroot. As setting up one only for running a single
command would be overkill, this patch re-creates what `kernel-install`
usually does:
- copy the kernel and initramfs to their own subdirectory at the root of
the EFI partition
- create the corresponding entry configuration file
To this end, the `systemd-boot` installation code in the `bootloader`
module has been largely refactored, including removing a few duplicate
LOCs.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- to make it short - it doesn't help much if one try to find and process any
EFI related things in the live system. The better approach is to search in
the chroot.
- use python builtins for mkdir and cp
- replacing some subprocess calls
- Some PEP8 changes
- added myself to the copyright section
On 32-bit UEFI (note that the bitness of the firmware is what matters
here, not the bitness of the distribution), instead of copying
grubx64.efi to bootx64.efi, copy grubia32.efi to bootia32.efi.
Patch by TeHMoroS from SparkyLinux.
CAL-403 #close
The manual partitioning setup was already requiring the user to check
the ESP flag for the EFI System Partition. Now the autopartitioning also
sets it directly (a one-line change). The sgdisk call in the bootloader
module is thus no longer necessary (it was only a workaround because
kpmcore < 2.1.0 did not support FlagEsp), so remove that snippet.
This fixes configurations such as NVME disks where splitting boot_device
into boot_device[-1:] and boot_device[:-1] is not the correct split
(because the partition gets a 2-letter suffix) (reported by demmm on
IRC).