blob: 3cd6811a6ce12248bcb764f27631131a2fef9aa5 [file] [log] [blame]
Patrick Williamsc0f7c042017-02-23 20:41:17 -06001# Copyright (C) 2016 Intel Corporation
2#
3# Released under the MIT license (see COPYING.MIT)
4
5# systemd-boot.bbclass - The "systemd-boot" is essentially the gummiboot merged into systemd.
6# The original standalone gummiboot project is dead without any more
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007# maintenance.
Patrick Williamsc0f7c042017-02-23 20:41:17 -06008#
9# Set EFI_PROVIDER = "systemd-boot" to use systemd-boot on your live images instead of grub-efi
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010# (images built by image-live.bbclass)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011
12do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060013
14EFIDIR = "/EFI/BOOT"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060015# Need UUID utility code.
16inherit fs-uuid
17
18efi_populate() {
19 DEST=$1
20
21 EFI_IMAGE="systemd-bootia32.efi"
22 DEST_EFI_IMAGE="bootia32.efi"
23 if [ "${TARGET_ARCH}" = "x86_64" ]; then
24 EFI_IMAGE="systemd-bootx64.efi"
25 DEST_EFI_IMAGE="bootx64.efi"
26 fi
27
28 install -d ${DEST}${EFIDIR}
29 # systemd-boot requires these paths for configuration files
30 # they are not customizable so no point in new vars
31 install -d ${DEST}/loader
32 install -d ${DEST}/loader/entries
33 install -m 0644 ${DEPLOY_DIR_IMAGE}/${EFI_IMAGE} ${DEST}${EFIDIR}/${DEST_EFI_IMAGE}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
35 printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_EFI_IMAGE" >${DEST}/startup.nsh
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036 install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf
37 for i in ${SYSTEMD_BOOT_ENTRIES}; do
38 install -m 0644 ${i} ${DEST}/loader/entries
39 done
40}
41
42efi_iso_populate() {
43 iso_dir=$1
44 efi_populate $iso_dir
45 mkdir -p ${EFIIMGDIR}/${EFIDIR}
46 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050047 cp -r $iso_dir/loader ${EFIIMGDIR}
Brad Bishop316dfdd2018-06-25 12:45:53 -040048 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
50 echo "fs0:${EFIPATH}\\${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
51 if [ -f "$iso_dir/initrd" ] ; then
52 cp $iso_dir/initrd ${EFIIMGDIR}
53 fi
54}
55
56efi_hddimg_populate() {
57 efi_populate $1
58}
59
Brad Bishop316dfdd2018-06-25 12:45:53 -040060inherit systemd-boot-cfg