Skip to content

Commit

Permalink
base: efitools: sign the UnLock efi at install phase
Browse files Browse the repository at this point in the history
We can't change files of ${D} in the do_deploy task and so
we need to move it to the do_install task.

This new UnLock efi is only required in the target and this
is the reason of the class-target override.
Before it don't fail on the class native because the do_deploy
only runs for the class target.

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
  • Loading branch information
quaresmajose committed Oct 29, 2024
1 parent 026661d commit 8ef639a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
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 "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
}

SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/LockDown.efi ${DEPLOY_DIR_IMAGE}/UnLock-signed.efi"
13 changes: 0 additions & 13 deletions meta-lmp-base/recipes-bsp/efitools/efitools_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,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

0 comments on commit 8ef639a

Please sign in to comment.