Skip to content

Commit

Permalink
tegra-uefi-capsules: include all logic for BUP generation
Browse files Browse the repository at this point in the history
Drop BUP-specific recipes and move all logic to UEFI capsule
generation recipe, as suggested in [1].

[1] #1492
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
  • Loading branch information
igoropaniuk committed May 27, 2024
1 parent 7d4a957 commit 303960d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 95 deletions.
22 changes: 0 additions & 22 deletions classes-recipe/image_types_tegra.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -462,25 +462,3 @@ do_image_tegraflash[depends] += "${TEGRAFLASH_PKG_DEPENDS} dtc-native:do_populat
virtual/bootloader:do_deploy virtual/secure-os:do_deploy ${TEGRA_SIGNING_EXTRA_DEPS} ${DTB_EXTRA_DEPS} \
${@'${TEGRAFLASH_INITRD_FLASH_IMAGE}:do_image_complete' if d.getVar('TEGRAFLASH_INITRD_FLASH_IMAGE') != '' else ''}"
IMAGE_TYPEDEP:tegraflash += "${IMAGE_TEGRAFLASH_FS_TYPE}"

oe_make_bup_payload() {
PATH="${STAGING_BINDIR_NATIVE}/${FLASHTOOLS_DIR}:${PATH}"
export tosimgfilename=${TOSIMGFILENAME}
rm -rf ${WORKDIR}/bup-payload
mkdir ${WORKDIR}/bup-payload
oldwd="$PWD"
cd ${WORKDIR}/bup-payload
# BUP generator really wants to use 'boot.img' for the LNX
# partition contents
tegraflash_populate_package "$1" boot.img ${@tegra_bootcontrol_overlay_list(d, bup=True)}
mv generate_bup_payload.sh doflash.sh
tegraflash_create_flash_config flash.xml.in boot.img ${STAGING_DATADIR}/tegraflash/bupgen-internal-flash.xml
. ./flashvars
tegraflash_custom_sign_bup
for bup in ${WORKDIR}/bup-payload/${BUP_PAYLOAD_DIR}/*; do
[ -e $bup ] || continue
BUP_generator.py --contents --check $bup
done
mv ${WORKDIR}/bup-payload/${BUP_PAYLOAD_DIR}/* .
cd "$oldwd"
}
26 changes: 0 additions & 26 deletions recipes-bsp/tegra-bup-payload/tegra-bup-payload_1.0.bb

This file was deleted.

43 changes: 41 additions & 2 deletions recipes-bsp/uefi/tegra-uefi-capsules_35.5.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DESCRIPTION = "Generate UEFI capsules for bup paylods"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

inherit tegra-bup deploy
inherit tegra-bup deploy image_types_tegra kernel-artifact-names

TEGRA_UEFI_CAPSULE_SIGNING_CLASS ??= "tegra-uefi-capsule-signing"
inherit ${TEGRA_UEFI_CAPSULE_SIGNING_CLASS}
Expand All @@ -11,12 +11,46 @@ TEGRA_UEFI_CAPSULE_SIGNING_EXTRA_DEPS ??= ""

COMPATIBLE_MACHINE = "(tegra)"

DEPENDS += "tegra-bup-payload"
TEGRA_SIGNING_EXTRA_DEPS ??= ""

GUID:tegra194 ?= "be3f5d68-7654-4ed2-838c-2a2faf901a78"
GUID:tegra234 ?= "bf0d4599-20d4-414e-b2c5-3595b1cda402"

do_compile() {
# Generate BUP images
PATH="${STAGING_BINDIR_NATIVE}/${FLASHTOOLS_DIR}:${PATH}"
export tosimgfilename=${TOSIMGFILENAME}
rm -rf ${WORKDIR}/bup-payload
mkdir ${WORKDIR}/bup-payload
oldwd="$PWD"
cd ${WORKDIR}/bup-payload
# BUP generator really wants to use 'boot.img' for the LNX
# partition contents
tegraflash_populate_package ${IMAGE_TEGRAFLASH_KERNEL} boot.img ${@tegra_bootcontrol_overlay_list(d, bup=True)}
mv generate_bup_payload.sh doflash.sh
tegraflash_create_flash_config flash.xml.in boot.img ${STAGING_DATADIR}/tegraflash/bupgen-internal-flash.xml
. ./flashvars
tegraflash_custom_sign_bup
for bup in ${WORKDIR}/bup-payload/${BUP_PAYLOAD_DIR}/*; do
[ -e $bup ] || continue
BUP_generator.py --contents --check $bup
done
mv ${WORKDIR}/bup-payload/${BUP_PAYLOAD_DIR}/* .
cd "$oldwd"

# Deploy BUP payloads
for f in ${WORKDIR}/bup-payload/*_only_payload; do
[ -e $f ] || continue
sfx=$(basename $f _payload)
# We need to have bup-payload images to be deployed to ${DEPLOY_DIR_IMAGE} before
# capsule generation function is called
# Using DEPLOY_DIR_IMAGE directly is not recommended, and DEPLOYDIR and deploy class
# should be used instead, so this should be split on two separate recipes
# (bup generation and capsule generation)
install -m 0644 $f ${DEPLOY_DIR_IMAGE}/${BUPFILENAME}.$sfx.bup-payload
done

# Generate UEFI capsules
sign_uefi_capsules
}

Expand Down Expand Up @@ -53,3 +87,8 @@ do_deploy() {
addtask deploy after do_install

do_compile[depends] += "${@bup_dependency(d)} ${TEGRA_UEFI_CAPSULE_SIGNING_EXTRA_DEPS}"
do_compile[depends] += "virtual/kernel:do_deploy tegra-flashtools-native:do_populate_sysroot dtc-native:do_populate_sysroot"
do_compile[depends] += "python3-pyyaml-native:do_populate_sysroot"
do_compile[depends] += "tegra-redundant-boot-rollback:do_populate_sysroot tegra-bootfiles:do_populate_sysroot"
do_compile[depends] += "coreutils-native:do_populate_sysroot ${TEGRA_ESP_IMAGE}:do_image_complete virtual/secure-os:do_deploy"
do_compile[depends] += "${TEGRA_SIGNING_EXTRA_DEPS}"
45 changes: 0 additions & 45 deletions recipes-kernel/kernel-bup-payload/kernel-bup-payload.bb

This file was deleted.

0 comments on commit 303960d

Please sign in to comment.