diff --git a/ci/base.yml b/ci/base.yml index f597b7ae..7bb078ff 100644 --- a/ci/base.yml +++ b/ci/base.yml @@ -30,8 +30,8 @@ local_conf_header: INHERIT += "buildhistory" INHERIT += "rm_work" qcomflash: | - IMAGE_CLASSES += "image_types_qcom" - IMAGE_FSTYPES += "qcomflash" + IMAGE_CLASSES += "image_types_qcom image_types_qcom_pkg" + IMAGE_FSTYPES += "qcomflash qcomflashpkg" extra: | EXTRA_IMAGE_FEATURES = "allow-empty-password empty-root-password allow-root-login" IMAGE_ROOTFS_EXTRA_SPACE = "307200" diff --git a/classes-recipe/image_types_qcom.bbclass b/classes-recipe/image_types_qcom.bbclass index 86229287..ffad729a 100644 --- a/classes-recipe/image_types_qcom.bbclass +++ b/classes-recipe/image_types_qcom.bbclass @@ -18,59 +18,67 @@ QCOM_DTB_FILE ?= "dtb.bin" QCOM_ROOTFS_FILE ?= "rootfs.img" IMAGE_QCOMFLASH_FS_TYPE ??= "ext4" -QCOMFLASH_DIR = "${WORKDIR}/qcomflash" -IMAGE_CMD:qcomflash = "create_qcomflash_pkg" +QCOMFLASH_DIR = "${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}" +IMAGE_CMD:qcomflash = "create_qcomflash" do_image_qcomflash[dirs] = "${QCOMFLASH_DIR}" do_image_qcomflash[cleandirs] = "${QCOMFLASH_DIR}" do_image_qcomflash[depends] += "qcom-gen-partition-bins:do_deploy virtual/kernel:do_deploy \ ${@'${QCOM_ESP_IMAGE}:do_image_complete' if d.getVar('QCOM_ESP_IMAGE') != '' else ''}" IMAGE_TYPEDEP:qcomflash += "${IMAGE_QCOMFLASH_FS_TYPE}" -create_qcomflash_pkg() { +create_image_relative_link () { + filename=$1 + + if [ -z "$2" ]; then + linkname=$(basename $filename) + else + linkname=$2 + fi + + ln -sf ../$(basename $filename) $linkname +} + +create_qcomflash() { # esp image if [ -n "${QCOM_ESP_FILE}" ]; then - install -m 0644 ${DEPLOY_DIR_IMAGE}/${QCOM_ESP_IMAGE}-${MACHINE}.rootfs.vfat ${QCOM_ESP_FILE} + create_image_relative_link ${DEPLOY_DIR_IMAGE}/${QCOM_ESP_IMAGE}-${MACHINE}.rootfs.vfat ${QCOM_ESP_FILE} fi # dtb image if [ -n "${QCOM_DTB_DEFAULT}" ] && \ [ -f "${DEPLOY_DIR_IMAGE}/dtb-${QCOM_DTB_DEFAULT}-image.vfat" ]; then # default image - install -m 0644 ${DEPLOY_DIR_IMAGE}/dtb-${QCOM_DTB_DEFAULT}-image.vfat ${QCOM_DTB_FILE} + create_image_relative_link ${DEPLOY_DIR_IMAGE}/dtb-${QCOM_DTB_DEFAULT}-image.vfat ${QCOM_DTB_FILE} # copy all images so they can be made available via the same tarball for dtbimg in ${DEPLOY_DIR_IMAGE}/dtb-*-image.vfat; do - install -m 0644 ${dtbimg} . + create_image_relative_link ${dtbimg} done fi # rootfs image - install -m 0644 ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${IMAGE_QCOMFLASH_FS_TYPE} ${QCOM_ROOTFS_FILE} + create_image_relative_link ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${IMAGE_QCOMFLASH_FS_TYPE} ${QCOM_ROOTFS_FILE} # partition bins for pbin in `find ${DEPLOY_DIR_IMAGE} -type f -name 'gpt_main*.bin' \ -o -name 'gpt_backup*.bin' -o -name 'patch*.xml'`; do - install -m 0644 ${pbin} . + create_image_relative_link ${pbin} done # skip BLANK_GPT and WIPE_PARTITIONS for rawprogram xml files for rawpg in `find ${DEPLOY_DIR_IMAGE} -type f -name 'rawprogram*.xml' \ ! -name 'rawprogram*_BLANK_GPT.xml' ! -name 'rawprogram*_WIPE_PARTITIONS.xml'`; do - install -m 0644 ${rawpg} . + create_image_relative_link ${rawpg} done for logfs in `find ${DEPLOY_DIR_IMAGE} -type f -name 'logfs_*.bin'`; do - install -m 0644 ${logfs} . + create_image_relative_link ${logfs} done for zeros in `find ${DEPLOY_DIR_IMAGE} -type f -name 'zeros_*.bin'`; do - install -m 0644 ${zeros} . + create_image_relative_link ${zeros} done # boot firmware for bfw in `find ${DEPLOY_DIR_IMAGE} -type f -name '*.elf' -o -name '*.mbn' -o -name '*.fv'`; do - install -m 0644 ${bfw} . + create_image_relative_link ${bfw} done - - # Create qcomflash tarball - ${IMAGE_CMD_TAR} --sparse --numeric-owner --transform="s,^\./,${IMAGE_BASENAME}-${MACHINE}/," -cf- . | gzip -f -9 -n -c --rsyncable > ${IMGDEPLOYDIR}/${IMAGE_NAME}.qcomflash.tar.gz - ln -sf ${IMAGE_NAME}.qcomflash.tar.gz ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.qcomflash.tar.gz } -create_qcomflash_pkg[vardepsexclude] += "DATETIME" +create_qcomflash[vardepsexclude] += "DATETIME" diff --git a/classes-recipe/image_types_qcom_pkg.bbclass b/classes-recipe/image_types_qcom_pkg.bbclass new file mode 100644 index 00000000..e1c47cd6 --- /dev/null +++ b/classes-recipe/image_types_qcom_pkg.bbclass @@ -0,0 +1,16 @@ +# Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +inherit image_types + +IMAGE_TYPES += "qcomflashpkg" + +QCOMFLASH_DIR = "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}" +IMAGE_CMD:qcomflashpkg = "create_qcomflash_tarball" +IMAGE_TYPEDEP:qcomflashpkg += "qcomflash" + +create_qcomflash_tarball() { + # Create qcomflash tarball + ${IMAGE_CMD_TAR} --sparse --numeric-owner --transform="s,^\./,${IMAGE_BASENAME}-${MACHINE}/," -hcf- -C ${QCOMFLASH_DIR} . | gzip -f -9 -n -c --rsyncable > ${IMGDEPLOYDIR}/${IMAGE_NAME}.qcomflash.tar.gz + ln -sf ${IMAGE_NAME}.qcomflash.tar.gz ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.qcomflash.tar.gz +} \ No newline at end of file