summaryrefslogtreecommitdiffstats
path: root/classes/override_grub-efi_secureboot.inc
blob: b944ec8ba3f7ec9155e45ce17bbbd6f9060ed71f (plain)
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
efi_populate() {
	# DEST must be the root of the image so that EFIDIR is not
	# nested under a top level directory.
	DEST=$1

	install -d ${DEST}${EFIDIR}

	GRUB_IMAGE="grub-efi-bootia32.efi"
	DEST_IMAGE="bootia32.efi"
	if [ "${TARGET_ARCH}" = "x86_64" ]; then
		GRUB_IMAGE="grub-efi-bootx64.efi"
		DEST_IMAGE="bootx64.efi"
	fi

        #Install EFI binaries
        install -m 0644 ${IMAGE_ROOTFS}/boot/efi${EFIDIR}/*.* ${DEST}${EFIDIR}

        #Install kernel and initramfs sig
        install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}.p7b ${DEST}/vmlinuz.p7b
        install -m 0644 ${INITRD_LIVE}.p7b ${DEST}/initrd.p7b

	EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
	printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh

	install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg

        #Install UEFI keys
        install -d ${DEST}/uefi_sb_keys
        install -m 0644 ${DEPLOY_DIR_IMAGE}/user-keys/uefi_sb_keys/*.crt ${DEST}/uefi_sb_keys/
        install -m 0644 ${DEPLOY_DIR_IMAGE}/user-keys/uefi_sb_keys/*.esl ${DEST}/uefi_sb_keys/
}