Skip to content

Commit

Permalink
image_types_tegra: make initrd-flash support configurable
Browse files Browse the repository at this point in the history
Make the image dependencies and inclusion of the initrd-flash
image conditional on whether TEGRAFLASH_INITRD_FLASH_IMAGE is
non-null.  This allows users to exclude initrd-flash support
from their builds, if desired.

Signed-off-by: Matt Madison <[email protected]>
  • Loading branch information
madisongh committed Jan 17, 2023
1 parent 511be2c commit f3f9936
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions classes/image_types_tegra.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ IMAGE_TEGRAFLASH_ESPIMG ?= "${DEPLOY_DIR_IMAGE}/${TEGRA_ESP_IMAGE}-${MACHINE}.es
DATAFILE ??= ""
IMAGE_TEGRAFLASH_DATA ??= ""

IMAGE_TEGRAFLASH_INITRD_FLASHER = "${DEPLOY_DIR_IMAGE}/${TEGRAFLASH_INITRD_FLASH_IMAGE}-${MACHINE}.cboot"
IMAGE_TEGRAFLASH_INITRD_FLASHER ?= "${@'${DEPLOY_DIR_IMAGE}/${TEGRAFLASH_INITRD_FLASH_IMAGE}-${MACHINE}.cboot' if d.getVar('TEGRAFLASH_INITRD_FLASH_IMAGE') != '' else ''}"

TEGRA_SPIFLASH_BOOT ??= ""
TEGRA_ROOTFS_AND_KERNEL_ON_SDCARD ??=""
Expand Down Expand Up @@ -333,7 +333,9 @@ create_tegraflash_pkg:tegra194() {
cp "${STAGING_DATADIR}/tegraflash/${EMMC_BCT_OVERRIDE}" .
cp "${IMAGE_TEGRAFLASH_KERNEL}" ./${LNXFILE}
cp "${IMAGE_TEGRAFLASH_ESPIMG}" ./esp.img
cp "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ./initrd-flash.img
if [ -n "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ]; then
cp "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ./initrd-flash.img
fi
if [ -n "${DATAFILE}" -a -n "${IMAGE_TEGRAFLASH_DATA}" ]; then
cp "${IMAGE_TEGRAFLASH_DATA}" ./${DATAFILE}
DATAARGS="--datafile ${DATAFILE}"
Expand All @@ -359,6 +361,9 @@ create_tegraflash_pkg:tegra194() {
copy_dtbs "${WORKDIR}/tegraflash"
if [ "${TEGRA_SIGNING_EXCLUDE_TOOLS}" != "1" ]; then
cp -R ${STAGING_BINDIR_NATIVE}/${FLASHTOOLS_DIR}/* .
if [ -z "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ]; then
rm -f ./initrd-flash
fi
mv ./rollback_parser.py ./rollback/
tegraflash_generate_bupgen_script
fi
Expand All @@ -380,8 +385,10 @@ create_tegraflash_pkg:tegra194() {
MACHINE=${TNSPEC_MACHINE} ./tegra194-flash-helper.sh $DATAARGS flash.xml.in ${DTBFILE} ${EMMC_BCT},${EMMC_BCT_OVERRIDE} ${ODMDATA} ${LNXFILE} ${IMAGE_BASENAME}.${IMAGE_TEGRAFLASH_FS_TYPE} "\$@"
END
chmod +x doflash.sh
rm -f .env.initrd-flash
cat > .env.initrd-flash <<END

if [ -n "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ]; then
rm -f .env.initrd-flash
cat > .env.initrd-flash <<END
FLASH_HELPER=${SOC_FAMILY}-flash-helper.sh
BOOTDEV="${TNSPEC_BOOTDEV}"
ROOTFS_DEVICE="${ROOTFS_DEVICE_FOR_INITRD_FLASH}"
Expand All @@ -401,6 +408,7 @@ DATAFILE="${DATAFILE}"
EXTERNAL_ROOTFS_DRIVE=${TEGRAFLASH_ROOTFS_EXTERNAL}
BOOT_PARTITIONS_ON_EMMC=${BOOT_PARTITIONS_ON_EMMC}
END
fi
if [ -e ./odmfuse_pkc.xml ]; then
cat > burnfuses.sh <<END
#!/bin/sh
Expand Down Expand Up @@ -448,7 +456,9 @@ create_tegraflash_pkg:tegra234() {
cp "${STAGING_DATADIR}/tegraflash/${EMMC_BCT}" .
cp "${IMAGE_TEGRAFLASH_KERNEL}" ./${LNXFILE}
cp "${IMAGE_TEGRAFLASH_ESPIMG}" ./esp.img
cp "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ./initrd-flash.img
if [ -n "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ]; then
cp "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ./initrd-flash.img
fi
if [ -n "${DATAFILE}" -a -n "${IMAGE_TEGRAFLASH_DATA}" ]; then
cp "${IMAGE_TEGRAFLASH_DATA}" ./${DATAFILE}
DATAARGS="--datafile ${DATAFILE}"
Expand Down Expand Up @@ -478,6 +488,9 @@ create_tegraflash_pkg:tegra234() {
copy_dtbs "${WORKDIR}/tegraflash"
if [ "${TEGRA_SIGNING_EXCLUDE_TOOLS}" != "1" ]; then
cp -R ${STAGING_BINDIR_NATIVE}/${FLASHTOOLS_DIR}/* .
if [ -z "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ]; then
rm -f ./initrd-flash
fi
rm ./rollback_parser.py
tegraflash_generate_bupgen_script
fi
Expand All @@ -502,7 +515,8 @@ END
chmod +x doflash.sh

chmod +x doflash.sh
cat > .env.initrd-flash <<END
if [ -n "${IMAGE_TEGRAFLASH_INITRD_FLASHER}" ]; then
cat > .env.initrd-flash <<END
FLASH_HELPER=${SOC_FAMILY}-flash-helper.sh
BOOTDEV="${TNSPEC_BOOTDEV}"
ROOTFS_DEVICE="${ROOTFS_DEVICE_FOR_INITRD_FLASH}"
Expand All @@ -522,6 +536,7 @@ DATAFILE="${DATAFILE}"
EXTERNAL_ROOTFS_DRIVE=${TEGRAFLASH_ROOTFS_EXTERNAL}
BOOT_PARTITIONS_ON_EMMC=${BOOT_PARTITIONS_ON_EMMC}
END
fi
if [ -e ./odmfuse_pkc.xml ]; then
cat > burnfuses.sh <<END
#!/bin/sh
Expand Down Expand Up @@ -607,7 +622,7 @@ do_image_tegraflash[depends] += "${TEGRAFLASH_PKG_DEPENDS} dtc-native:do_populat
${@'${INITRD_IMAGE}:do_image_complete' if d.getVar('INITRD_IMAGE') != '' else ''} \
${@'${TEGRA_ESP_IMAGE}:do_image_complete' if d.getVar('TEGRA_ESP_IMAGE') != '' else ''} \
virtual/bootloader:do_deploy virtual/secure-os:do_deploy ${TEGRA_SIGNING_EXTRA_DEPS} ${DTB_EXTRA_DEPS} \
${TEGRAFLASH_INITRD_FLASH_IMAGE}:do_image_complete"
${@'${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() {
Expand Down

0 comments on commit f3f9936

Please sign in to comment.