Skip to content

Commit 2400cce

Browse files
examples: factor out code to install systemd-boot
All of the examples do this (except for unified-secureboot, which wants to install a signed copy) so factor it out. Signed-off-by: Allison Karlitskaya <[email protected]>
1 parent 084cd7d commit 2400cce

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

examples/bls/build

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ mkdir -p "tmp/sysroot/state/${BASE_IMAGE_FSVERITY}/etc/work"
5757
mkdir -p "tmp/sysroot/state/${BASE_IMAGE_FSVERITY}/etc/upper"
5858
mkdir -p "tmp/sysroot/state/${BASE_IMAGE_FSVERITY}/var"
5959

60-
mkdir -p tmp/efi/loader
61-
echo 'timeout 3' > tmp/efi/loader/loader.conf
62-
mkdir -p tmp/efi/EFI/BOOT tmp/efi/EFI/systemd
63-
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/systemd
64-
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/BOOT/BOOTX64.EFI
6560
${CFSCTL} oci prepare-boot "${BASE_ID}" tmp/efi
6661

6762
OPTIONS="console=ttyS0,115200 composefs=${BASE_IMAGE_FSVERITY} rw"
@@ -74,4 +69,5 @@ else
7469
fi
7570
sed -i 's@ /boot/@ /@' "${BLE}"
7671

72+
../common/install-systemd-boot
7773
../common/make-image "${os}-bls-efi.qcow2"

examples/common/install-systemd-boot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
mkdir -p tmp/efi/loader
6+
echo 'timeout 3' > tmp/efi/loader/loader.conf
7+
mkdir -p tmp/efi/EFI/BOOT tmp/efi/EFI/systemd
8+
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/systemd
9+
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/BOOT/BOOTX64.EFI

examples/uki/build

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ mkdir -p "tmp/sysroot/state/${BASE_IMAGE_FSVERITY}/etc/work"
6464
mkdir -p "tmp/sysroot/state/${BASE_IMAGE_FSVERITY}/etc/upper"
6565
mkdir -p "tmp/sysroot/state/${BASE_IMAGE_FSVERITY}/var"
6666

67-
mkdir -p tmp/efi/loader
68-
echo 'timeout 3' > tmp/efi/loader/loader.conf
69-
mkdir -p tmp/efi/EFI/BOOT tmp/efi/EFI/systemd
70-
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/systemd
71-
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/BOOT/BOOTX64.EFI
7267
${CFSCTL} oci prepare-boot "${FINAL_ID}" tmp/efi
7368

69+
../common/install-systemd-boot
7470
../common/make-image "${os}-uki-efi.qcow2"

examples/unified-secureboot/build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ mkdir -p "tmp/sysroot/state/${IMAGE_FSVERITY}/etc/work"
5555
mkdir -p "tmp/sysroot/state/${IMAGE_FSVERITY}/etc/upper"
5656
mkdir -p "tmp/sysroot/state/${IMAGE_FSVERITY}/var"
5757

58+
${CFSCTL} oci prepare-boot "${IMAGE_ID}" tmp/efi
59+
60+
# install a signed copy of systemd-boot
5861
mkdir -p tmp/efi/loader
5962
echo 'timeout 3' > tmp/efi/loader/loader.conf
6063
mkdir -p tmp/efi/EFI/BOOT tmp/efi/EFI/systemd
6164
sbsign --key secureboot/db.key --cert secureboot/db.crt \
6265
/usr/lib/systemd/boot/efi/systemd-bootx64.efi \
6366
--output tmp/efi/EFI/systemd/systemd-bootx64.efi
6467
cp tmp/efi/EFI/{systemd/systemd-bootx64.efi,BOOT/BOOTX64.EFI}
65-
${CFSCTL} oci prepare-boot "${IMAGE_ID}" tmp/efi
6668

6769
../common/make-image fedora-unified-secureboot-efi.qcow2

examples/unified/build

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ mkdir -p "tmp/sysroot/state/${IMAGE_FSVERITY}/etc/work"
3737
mkdir -p "tmp/sysroot/state/${IMAGE_FSVERITY}/etc/upper"
3838
mkdir -p "tmp/sysroot/state/${IMAGE_FSVERITY}/var"
3939

40-
mkdir -p tmp/efi/loader
41-
echo 'timeout 3' > tmp/efi/loader/loader.conf
42-
mkdir -p tmp/efi/EFI/BOOT tmp/efi/EFI/systemd
43-
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/systemd
44-
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi tmp/efi/EFI/BOOT/BOOTX64.EFI
4540
${CFSCTL} oci prepare-boot "${IMAGE_ID}" tmp/efi
4641

42+
../common/install-systemd-boot
4743
../common/make-image fedora-unified-efi.qcow2

0 commit comments

Comments
 (0)