Skip to content

Commit

Permalink
gadget: use new boot chain
Browse files Browse the repository at this point in the history
  • Loading branch information
valentindavid committed Jun 24, 2024
1 parent 5f1e9c7 commit 0e125d4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
8 changes: 7 additions & 1 deletion gadget/gadget-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ volumes:
edition: 2
content:
- source: grubx64.efi
target: EFI/boot/grubx64.efi
target: EFI/ubuntu/grubx64.efi
- source: shim.efi.signed
target: EFI/ubuntu/shimx64.efi
- source: boot.csv
target: EFI/ubuntu/bootx64.csv
- source: fb.efi
target: EFI/boot/fbx64.efi
- source: shim.efi.signed
target: EFI/boot/bootx64.efi
- name: ubuntu-boot
Expand Down
8 changes: 7 additions & 1 deletion gadget/gadget-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ volumes:
edition: 2
content:
- source: grubaa64.efi
target: EFI/boot/grubaa64.efi
target: EFI/ubuntu/grubaa64.efi
- source: shim.efi.signed
target: EFI/ubuntu/shimaa64.efi
- source: boot.csv
target: EFI/ubuntu/bootaa64.csv
- source: fb.efi
target: EFI/boot/fbaa64.efi
- source: shim.efi.signed
target: EFI/boot/bootaa64.efi
- name: ubuntu-boot
Expand Down
10 changes: 10 additions & 0 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,37 @@ parts:
grub_target=x86_64
grub_bin=grubx64.efi.signed
shim_bin=shimx64.efi.dualsigned
fb_bin=fbx64.efi
boot_csv=BOOTX64.CSV
if [ "${CRAFT_ARCH_BUILD_FOR}" = arm64 ]; then
grub_target=arm64
grub_bin=grubaa64.efi.signed
shim_bin=shimaa64.efi.dualsigned
fb_bin=fbaa64.efi
boot_csv=bootaa64.csv
fi
# Make sure we have have the right signatures
shim_path="${CRAFT_PART_INSTALL}"/usr/lib/shim/$shim_bin
fb_path="${CRAFT_PART_INSTALL}/usr/lib/shim/${fb_bin}"
bootcsv_path="${CRAFT_PART_INSTALL}/usr/lib/shim/${boot_csv}"
grub_path="${CRAFT_PART_INSTALL}"/usr/lib/grub/"$grub_target"-efi-signed/$grub_bin
sbverify --list "$shim_path" | grep -E 'Canonical Ltd. Secure Boot Signing \(2022 v1\)'
sbverify --list "$grub_path" | grep -E 'Canonical Ltd. Secure Boot Signing \(2022 v1\)'
# Move shim/grub to the expected path
install -m 644 "$shim_path" "${CRAFT_PART_INSTALL}"/shim.efi.signed
install -m 644 "$grub_path" "${CRAFT_PART_INSTALL}"/${grub_bin%.signed}
install -m 644 "${fb_path}" "${CRAFT_PART_INSTALL}/fb.efi"
install -m 644 "${bootcsv_path}" "${CRAFT_PART_INSTALL}/boot.csv"
# Remove all the bits we do not need, keeping changelogs and copyrights
# (using organize/prime is not possible due to different names per arch - x64/aa64)
find "${CRAFT_PART_INSTALL}"/ -type f,l \
-not -path "${CRAFT_PART_INSTALL}"/shim.efi.signed \
-not -path "${CRAFT_PART_INSTALL}"/${grub_bin%.signed} \
-not -path "${CRAFT_PART_INSTALL}"/fb.efi \
-not -path "${CRAFT_PART_INSTALL}"/boot.csv \
-not -path "${CRAFT_PART_INSTALL}"/usr/share/doc/grub-efi-${CRAFT_ARCH_BUILD_FOR}-signed/'*' \
-and -not -path "${CRAFT_PART_INSTALL}"/'usr/share/doc/shim-signed/*' \
-delete
Expand Down

0 comments on commit 0e125d4

Please sign in to comment.