Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1 | # 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 7 | # maintenance. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 8 | # |
| 9 | # Set EFI_PROVIDER = "systemd-boot" to use systemd-boot on your live images instead of grub-efi |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 10 | # (images built by image-live.bbclass) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 11 | |
| 12 | do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 13 | |
| 14 | EFIDIR = "/EFI/BOOT" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 15 | # Need UUID utility code. |
| 16 | inherit fs-uuid |
| 17 | |
| 18 | efi_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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 34 | EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') |
| 35 | printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_EFI_IMAGE" >${DEST}/startup.nsh |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 36 | 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 | |
| 42 | efi_iso_populate() { |
| 43 | iso_dir=$1 |
| 44 | efi_populate $iso_dir |
| 45 | mkdir -p ${EFIIMGDIR}/${EFIDIR} |
| 46 | cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 47 | cp -r $iso_dir/loader ${EFIIMGDIR} |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 48 | cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 49 | 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 | |
| 56 | efi_hddimg_populate() { |
| 57 | efi_populate $1 |
| 58 | } |
| 59 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 60 | inherit systemd-boot-cfg |