Commit Graph

48 Commits

Author SHA1 Message Date
James Le Cuirot
e6e3dafa86
grub_install.sh: Temporarily undo copying the officially signed shim
We previously did the AKV signing in the image job but temporarily
nobbled that code path while we completed the shim review.

Now the AKV signing has been split out into a separate job that will
only be invoked once changes to the jenkins-os repo have been merged.
The only thing we now need to nobble here is copying the signed shim. In
the meantime, we copy the unsigned shim instead. Revert this commit once
the shim review is complete.
2024-12-03 16:01:24 +00:00
James Le Cuirot
b3183b42c4
Do SB signing for official builds in a separate additional job
We only want to do the signing in Azure, not the whole image job. This
new job downloads the unsigned image, signs it, and replaces it.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-12-03 16:01:23 +00:00
James Le Cuirot
945014691b
grub_install.sh: Compress modules with xz instead of gzip to save space
Giving the --best or -9 option results in a heavier decompression cost
with no gain on such small files.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-18 14:56:20 +00:00
James Le Cuirot
93cbba765d
grub_install.sh: Only install additional GRUB modules for non-SB targets
Secure Boot prevents you from loading additional modules so remove them
to save space. These modules could be useful for debugging with Secure
Boot disabled, but manually copying the modules with debug symbols is
even more useful and not that difficult.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-18 14:55:50 +00:00
James Le Cuirot
101efbff39
Temporarily undo AKV signing while we complete the shim review
We don't want to be blocked from doing releases in the meantime. Revert
this commit when ready.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-13 12:19:24 +00:00
James Le Cuirot
d8a8704f92
Refactor SB signing code and sign official builds with Azure Key Vault
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-13 12:19:22 +00:00
James Le Cuirot
0eb1d4a287
grub_install.sh: Remove redundant BOARD_GRUB logic
We always use the board's GRUB now.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-13 12:19:21 +00:00
Adrian Vladu
e7d9faadc8 grub_install: Remove core grub modules from EFI partition for i386-pc
The image also boots on Hyper-V Generation 1 VM (BIOS) if the modules
are removed.

Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-06-21 11:04:35 +03:00
Jeremi Piotrowski
0624d8cc4a grub_install: Remove core grub modules from EFI partition
Since we build them into the grub executable, they are not needed on
disk. The only case I am unsure of is legacy BIOS boot, so left those
on disk.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-06-21 11:04:35 +03:00
Jeremi Piotrowski
14f1c4f735 grub_install: Remove core.{elf,efi} after copying
We currently carry multiple copies of the same grub core.elf or core.efi
on the boot partition. Save some space by removing duplicates that are
never used at runtime. CPIO build needed to be adapted because it
publishes grub efi files.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-06-21 11:04:35 +03:00
Jeremi Piotrowski
f53f1af51e grub_install: Add btrfs to core modules
The OEM partition is on a btrfs file system and grub has to be able to
read grub.cfg from there so it makes sense to include btrfs in core
modules. This avoids all other fs modules from being autoloaded during
boot.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-04-25 12:20:19 +02:00
Jeremi Piotrowski
e78a59cc65 grub_install: Use hd0,gpt1 as a hint when searching for root
In the context of load.cfg in the memdisk, root is set to memdisk, so
passing it as a hint to search is not helpful. While we don't know for
sure whether hd0 is the boot disk, it's a safe hint for most situations.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-04-25 12:20:19 +02:00
Kai Lueke
834d32efa8 build_library/grub.cfg: Enable TPM module by default
For binding a secret to the OS we need TPM PCRs that measure the kernel
and boot configuration (UEFI). Used for:
https://github.com/flatcar/flatcar-website/pull/317
2024-04-09 22:17:18 +09:00
Sayan Chowdhury
52ce21a5ab grub_install.sh: ship mokmanager, and rename to grubx64
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 15:46:13 +01:00
Sayan Chowdhury
99bfcf5f32 shim, coreos-sb-keys, grub_install.sh: retab to spaces
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:10 +01:00
Sayan Chowdhury
fc28e72322 sys-boot/grub: install file with sbat contents, add --sbat to script
This is just the contents of the section, but the section
itself is written by grub-mkimage. sbat.csv needs to be passed
with --sbat.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:09 +01:00
Jeremi Piotrowski
64556256db grub_install: switch to BOARD_GRUB by default
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-02-26 12:01:09 +01:00
Sayan Chowdhury
0479480ef1 grub_install.sh: Sign the GRUB/MM with the proper keys
Add the linux.mod file back

Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2024-02-26 12:01:09 +01:00
Krzesimir Nowak
c23dde1713 build_library/grub_install: Try mounting ESP directory in a loop
Apparently successful `[[ -b "${LOOP_DEV}p1" ]]` check is not enough -
the mount can still fail. So instead of doing those checks, try
mounting and reprobing in the loop with some small exponential
backoffs.
2023-10-13 08:38:11 +02:00
Sayan Chowdhury
abb6bdb682
build_library/grub: Remove the grub modules not ported/removed
Signed-off-by: Sayan Chowdhury <schowdhury@microsoft.com>
2023-08-24 13:22:41 +05:30
Krzesimir Nowak
fa48f70a37 *: Make catalyst and emerge verbose by default
That way we can see a report of what emerge is going to do and the
status of the use flags for the installed packages. The downside is
that we are going to have reports about using deprecated and
unsupported profile in even more places.
2023-02-16 13:57:05 +01:00
Krzesimir Nowak
520b92ad7e *: Expand short emerge flags and use bash arrays
Emerge flags are cryptic in general, but short flags even more so, so
expand them. While at it, I noticed some places where bash arrays
could be used, so convert those places too.
2023-02-16 13:57:05 +01:00
Flatcar Buildbot
c7bbb2b1e2 2345.0.0 2019-12-04 14:59:11 +01:00
Flatcar Buildbot
1dad511f69 2317.0.1 2019-11-07 19:40:01 +01:00
David Michael
2467923d56 Remove arm64 from supported board operations 2018-10-25 16:00:09 +00:00
Benjamin Gilbert
329f4bd113 build_library: Run dd with status=none
Avoid dumping dd statistics to stderr.
2017-04-21 14:06:00 -07:00
Benjamin Gilbert
e65d5101cf build_image: Extract and upload GRUB/shim EFI images for signing
On arm64, extract only GRUB, since there is no shim.  On dev builds,
extract neither.
2017-02-02 17:00:15 -08:00
Benjamin Gilbert
f16226acb5 grub_install: Install shim in official amd64 builds 2017-02-02 16:58:52 -08:00
Michael Marineau
7012375023 grub: abort boot if gptprio fails
If the gptprio.next command fails to give us something to boot we
shouldn't try! In order to diagnose why the failure happened halt
immediately so the user can see the error message.
2016-07-20 17:54:37 -07:00
Nick Owens
ff124fce3d build_library: add linux module to grub for arm64 2016-07-06 17:14:02 -07:00
Nick Owens
14e90df8d5 build_library: add tftp module to grub 2016-07-06 17:13:28 -07:00
Nick Owens
d935a8aca0 build_library: make arm64 grub file name match x86_64 2016-05-12 13:09:46 -07:00
Michael Marineau
4d97d2752d grub_install: use GRUB installed to the board root instead of SDK
Follow up to https://github.com/coreos/coreos-overlay/pull/1950
2016-05-10 12:02:56 -07:00
Michael Marineau
d5cb907947 grub_install: drop old/unused esp_dir flag 2016-05-10 10:56:21 -07:00
Nick Owens
12a9d94922 build_library: enable extra modules for arm64-efi 2016-04-14 14:46:01 -07:00
Matthew Garrett
5fa4196501 Verify netboot config fragments if there's an available gpg key
If there's a gpg public key available in a system firmware variable, trust
it and use it to verify netboot configuration fragments.
2016-01-11 11:54:04 -08:00
Matthew Garrett
1f7c749b2d Add UEFI netboot support
If grub's been netbooted, pull the uuid and serial number out of smbios and
hit the API server to get the appropriate configuration.
2016-01-08 14:45:45 -08:00
Andrej Rosano
16feac5ef6 Add arm64 grub installation support
Add the necessary variables in grub.cfg and populate the EFI
partition with arm64 efi executable and modules.

Signed-off-by: Andrej Rosano <andrej@inversepath.com>
2015-09-16 15:13:08 +02:00
Michael Marineau
806d9ca313 grub_install: stash an exact copy of the MBR boot code.
Useful for repairing the MBR without needing GRUB's tools.
2015-07-16 18:06:35 -07:00
George Tankersley
aa879ddcce grub_install: add support for verity and non-verity grub.cfg 2015-07-01 17:32:37 -07:00
Matthew Garrett
9fe7952578 Don't read OEM config data if Secure Boot is enabled
We don't want untrusted configuration to be read if we're in Secure Boot
mode, so skip the OEM config when Secure Boot is enabled and in User Mode.
2015-05-11 15:39:03 -07:00
Matthew Garrett
9579f4d68a Update grub configuration to handle ESP kernels, build it into grub
The grub configuration needs some updates to handle dealing with booting
the kernel from the ESP rather than from inside the image. We also want to
be able to avoid dealing with signing the config file, so build it into the
binary. Finally, rather than having to cope with signing grub modules, build
the ones we need to boot into the grub image.
2015-04-22 11:37:15 -07:00
Matthew Garrett
4b8a64b70c Build shim into the image
grub requires that shim be available in order to call out to verify the
kernel. Sign it and stick it in the image alongside grub.
2015-04-15 11:24:17 -07:00
Matthew Garrett
707803ed43 Add support for Secure Boot images and sign unofficial builds with test keys
Add qemu_uefi_secure target for building Secure Boot images. These are
identical to qemu_uefi images with the exception that the test keys have
been installed into the flash image, enabling Secure Boot by default. In
addition, sign the grub binary with the test keys during build when
producing unofficial images.
2015-04-15 11:11:24 -07:00
Michael Marineau
d443daa168 grub: the one bootloader to rule them all
This uses our new GRUB2 features to handle GPT priority partition
selection, terminal selection, OEM tweaks, etc. The old SYSLINUX and
PV-GRUB configs are now unused except for maintaining compatibility
with older installs. Of the old configs only the ones that
coreos-postinst copies are needed. The new setup supports using GRUB2
under Xen, giving us automatic fallback support on all of our platforms
for the very first time!

Since grub.cfg is copied into place instead of generated, build_image's
--boot_args option is no longer supported. It could be re-added later
with some sed goo but for now it is easy enough to just edit grub.cfg.
2014-12-05 16:51:11 -08:00
Alex Crawford
a204e434c6 grub_install: use sudo when reprobing 2014-10-22 15:19:04 -07:00
Michael Marineau
bb1c2559fb grub_install: work around intermittent missing loopback partitions
I am unsure exactly what situation is causing the loopback partition
device node to not exist when it is being mounted but this should help
work around the situation and log loudly about it so we can hopefully
figure out where to dig further.
2014-10-08 12:24:01 -07:00
Michael Marineau
12a9900e02 grub_install: new install script for grub, add UEFI bootloader
This script replaces the standard grub-install tool to give us some more
control over what is going and ensure grub-install's auto-detection
magic doesn't make any incorrect choices. Also this script sets up a
loopback device and mounts the EFI partition in just the right way for
grub-bios-setup's auto-detection magic to work correctly.

I've chosen not to adapt disk_util to use partitioned loop devices to
make grub happy because ensuring loop devices get cleaned up properly
for the general case gets tricky and less robust.
2014-09-07 09:57:39 -07:00