Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efitools: fix do_deploy and keys check #1525

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions meta-lmp-base/recipes-bsp/efitools/efitools.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,18 @@ do_install() {
oe_runmake install DESTDIR='${D}${base_prefix}'
}

do_install:append:class-target() {
if ! sbsign --key ${UEFI_SIGN_KEYDIR}/DB.key \
--cert ${UEFI_SIGN_KEYDIR}/DB.crt \
--output ${D}${datadir}/efitools/efi/UnLock-signed.efi \
${D}${datadir}/efitools/efi/UnLock.efi; then
bbfatal_log "Failed to sign UnLock.efi"
fi

if ! sbverify --cert ${UEFI_SIGN_KEYDIR}/DB.crt \
${D}${datadir}/efitools/efi/UnLock-signed.efi; then
bbfatal_log "Failed to verify UnLock-signed.efi"
fi
}

SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/LockDown.efi ${DEPLOY_DIR_IMAGE}/UnLock-signed.efi"
20 changes: 6 additions & 14 deletions meta-lmp-base/recipes-bsp/efitools/efitools_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ python do_prepare_local_auths() {
dir = d.expand('${UEFI_SIGN_KEYDIR}/')

import shutil
import os

# Use auths already generated by the user
for _ in ('PK', 'KEK', 'DB', 'DBX', 'noPK', 'noKEK'):
shutil.copyfile(dir + _ + '.auth', d.expand('${S}/') + _ + '.auth')
file = _ + '.auth'
src = dir + file
if not os.path.isfile(src):
bb.fatal("File '%s' not found!" % src)
shutil.copyfile(src, d.expand('${S}/') + file)

}
addtask prepare_local_auths after do_configure before do_compile
Expand All @@ -55,19 +60,6 @@ do_deploy() {
install -d ${DEPLOYDIR}
install -m 0600 ${D}${datadir}/efitools/efi/LockDown.efi ${DEPLOYDIR}
install -m 0600 ${WORKDIR}/lockdown.conf ${DEPLOYDIR}

if ! sbsign --key ${UEFI_SIGN_KEYDIR}/DB.key \
--cert ${UEFI_SIGN_KEYDIR}/DB.crt \
--output ${D}${datadir}/efitools/efi/UnLock-signed.efi \
${D}${datadir}/efitools/efi/UnLock.efi; then
bbfatal "Failed to sign UnLock.efi"
fi

if ! sbverify --cert ${UEFI_SIGN_KEYDIR}/DB.crt \
${D}${datadir}/efitools/efi/UnLock-signed.efi; then
bbfatal "Failed to verify UnLock-signed.efi"
fi

install -m 0600 ${D}${datadir}/efitools/efi/UnLock-signed.efi ${DEPLOYDIR}
install -m 0600 ${WORKDIR}/unlock.conf ${DEPLOYDIR}
}
Expand Down