-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathsnapcraft.yaml
112 lines (108 loc) · 3.14 KB
/
snapcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: pc
version: '20-0.4'
type: gadget
base: core20
summary: PC gadget for generic devices
description: |
This gadget enables generic pc devices to work with Ubuntu Core
confinement: strict
grade: stable
icon: icon.png
package-repositories:
- type: apt
ppa: ucdev/uc-staging-ppa
# Min version to support shim 15.7
assumes:
- snapd2.59.3
parts:
# Temporary workaround until pinning is supported by snapcraft
pin-ucdev:
plugin: nil
override-pull: |
# This is run before the pull step of grub part, so we make sure
# we get the packages from the PPA.
set -x
cat <<'EOF' > /etc/apt/preferences.d/ucdev
Package: *
Pin: release LP-PPA-ucdev-uc-staging-ppa,a=jammy,n=jammy
Pin: origin ppa.launchpad.net
Pin-Priority: 1000
EOF
grub:
after: [ pin-ucdev ]
plugin: nil
source: .
build-packages:
- ubuntu-dev-tools
- grub-pc-bin
- grub-common
- sbsigntool
stage-packages:
- grub-efi-amd64-signed
- shim-signed
override-build: |
set -x
# Make sure we have signatures from the UC certificates
sbverify --list "$SNAPCRAFT_PART_INSTALL"/usr/lib/shim/shimx64.efi.dualsigned |
grep -E 'Canonical Ltd. Secure Boot Signing \(Ubuntu Core'
sbverify --list "$SNAPCRAFT_PART_INSTALL"/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed |
grep -E 'Canonical Ltd. Secure Boot Signing \(Ubuntu Core'
mbr_img="$SNAPCRAFT_PART_INSTALL"/pc-boot.img
dd if=/usr/lib/grub/i386-pc/boot.img of="$mbr_img" bs=440 count=1
printf '\x90\x90' | dd of="$mbr_img" seek=102 bs=1 conv=notrunc
GRUB_MODULES="\
all_video \
biosdisk \
boot \
cat \
chain \
configfile \
echo \
ext2 \
fat \
font \
gettext \
gfxmenu \
gfxterm \
gfxterm_background \
gzio \
halt \
jpeg \
keystatus \
loadenv \
loopback \
linux \
memdisk \
minicmd \
normal \
part_gpt \
png \
reboot \
regexp \
search \
search_fs_uuid \
search_fs_file \
search_label \
sleep \
squash4 \
test \
true \
video"
bios_img="$SNAPCRAFT_PART_INSTALL"/pc-core.img
# shellcheck disable=SC2086
grub-mkimage -O i386-pc -o "$bios_img" -p '(,gpt2)/EFI/ubuntu' $GRUB_MODULES
# The first sector of the core image requires an absolute pointer to the
# second sector of the image. Since this is always hard-coded, it means our
# BIOS boot partition must be defined with an absolute offset. The
# particular value here is 2049, or 0x01 0x08 0x00 0x00 in little-endian.
printf '\x01\x08\x00\x00' | dd of="$bios_img" seek=500 bs=1 conv=notrunc
install -m 644 /dev/null "$SNAPCRAFT_PART_INSTALL"/grub.conf
organize:
usr/lib/shim/shimx64.efi.dualsigned: shim.efi.signed
usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed: grubx64.efi
prime:
- shim.efi.signed
- grubx64.efi
- grub.conf
- pc-boot.img
- pc-core.img