project-lakitu: limit installed GRUB modules
Only install GRUB modules that are required to boot COS
and skip the rest.
Also propagate botloader install failure to the upper layer.
and do not silently ignore it.
BUG=b/355062117
TEST=presubmit
RELEASE_NOTE=None
Change-Id: I4c6fbfd035a31aab21f825f702524db3594b26bb
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/77942
Reviewed-by: Kevin Berry <kpberry@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Arnav Kansal <rnv@google.com>
diff --git a/project-lakitu/scripts/bootloader_install.sh b/project-lakitu/scripts/bootloader_install.sh
index 1cbeefa..1ef27fb 100755
--- a/project-lakitu/scripts/bootloader_install.sh
+++ b/project-lakitu/scripts/bootloader_install.sh
@@ -89,9 +89,15 @@
fi
if [[ "${ARCH}" == "amd64" ]]; then
- install_grub2_amd64
+ if ! install_grub2_amd64; then
+ error "Could not install GRUB2 on ${IMAGE}"
+ return 1
+ fi
elif [[ "${ARCH}" == "arm64" ]]; then
- install_efi_bootloaders_arm64
+ if ! install_efi_bootloaders_arm64; then
+ error "Could not install EFI bootloader on ${IMAGE}"
+ return 1
+ fi
else
error "Could not install bootloaders on unsupported architecture: ${ARCH}"
return 1
@@ -159,6 +165,7 @@
if ! sudo grub-install --target="${grub_target}" \
--boot-directory="${ESP_DIR}/boot" \
--modules="${grub_modules}" \
+ --install-modules="${grub_modules}" \
"${LOOP_DEV}"; then
error "Error running grub-install"
return 1