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

Introduce CDT support #112

Open
wants to merge 4 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
2 changes: 1 addition & 1 deletion classes-recipe/image_types_qcom.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ create_qcomflash_pkg() {

# 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
-o -name 'gpt_backup*.bin' -o -name 'patch*.xml' -o -name 'cdt.bin'`; do
install -m 0644 ${pbin} .
done
# skip BLANK_GPT and WIPE_PARTITIONS for rawprogram xml files
Expand Down
9 changes: 9 additions & 0 deletions recipes-bsp/firmware/firmware-qcom-boot-common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
S = "${WORKDIR}/sources"
UNPACKDIR = "${S}"

CDT_FILE ?= ""
CDT_FILE:qcs6490-rb3gen2-core-kit ?= "cdt_core_kit"

INHIBIT_DEFAULT_DEPS = "1"

do_configure[noexec] = "1"
Expand All @@ -16,5 +19,11 @@ do_deploy() {
find "${UNPACKDIR}/${BOOTBINARIES}" -name '*.fv' -exec install -m 0644 {} ${DEPLOYDIR} \;
find "${UNPACKDIR}/${BOOTBINARIES}" -name '*.mbn' -exec install -m 0644 {} ${DEPLOYDIR} \;
find "${UNPACKDIR}/${BOOTBINARIES}" -name '*.melf' -exec install -m 0644 {} ${DEPLOYDIR} \;

if [ -f "${UNPACKDIR}/${CDT_FILE}.bin" ]; then
install -m 0644 ${UNPACKDIR}/${CDT_FILE}.bin ${DEPLOYDIR}/cdt.bin
fi
}
addtask deploy before do_build after do_install

PACKAGE_ARCH = "${MACHINE_ARCH}"
9 changes: 7 additions & 2 deletions recipes-bsp/firmware/firmware-qcom-boot-qcs6490_00005.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ DESCRIPTION = "QCOM NHLOS Firmware for Qualcomm Robotics RB3Gen2 platform"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://${UNPACKDIR}/${BOOTBINARIES}/Qualcomm-Technologies-Inc.-Proprietary;md5=58d50a3d36f27f1a1e6089308a49b403"

COMPATIBLE_MACHINE = "qcm6490"

FW_ARTIFACTORY = "softwarecenter.qualcomm.com/download/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_integrationandtest_publictest"
FW_BUILD_ID = "r1.0_${PV}/qcm6490-le-1-0"
FW_BIN_PATH = "common/build/ufs/bin"
BOOTBINARIES = "QCM6490_bootbinaries"

SRC_URI = "https://${FW_ARTIFACTORY}/${FW_BUILD_ID}/${FW_BIN_PATH}/${BOOTBINARIES}.zip;downloadfilename=${BOOTBINARIES}_r1.0_${PV}.zip"
SRC_URI[sha256sum] = "5e597229af9103cfea5b398c7e83a05dd078a18af010a40f1b9adf92967d4c1e"
SRC_URI = "https://${FW_ARTIFACTORY}/${FW_BUILD_ID}/${FW_BIN_PATH}/${BOOTBINARIES}.zip;downloadfilename=${BOOTBINARIES}_r1.0_${PV}.zip;name=bootbinaries"
SRC_URI[bootbinaries.sha256sum] = "5e597229af9103cfea5b398c7e83a05dd078a18af010a40f1b9adf92967d4c1e"

SRC_URI:append:qcs6490-rb3gen2-core-kit = " https://artifacts.codelinaro.org/artifactory/codelinaro-le/Qualcomm_Linux/QCS6490/cdt/rb3gen2-core-kit.zip;downloadfilename=cdt-rb3gen2-core-kit_${PV}.zip;name=rb3gen2-core-kit"
SRC_URI[rb3gen2-core-kit.sha256sum] = "0fe1c0b4050cf54203203812b2c1f0d9698823d8defc8b6516414a4e5e0c557e"

include firmware-qcom-boot-common.inc
2 changes: 2 additions & 0 deletions recipes-bsp/firmware/firmware-qcom-boot-qcs9100_00006.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ DESCRIPTION = "QCOM NHLOS Firmware for Qualcomm QCS9100 platform"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://${UNPACKDIR}/${BOOTBINARIES}/Qualcomm-Technologies-Inc.-Proprietary;md5=58d50a3d36f27f1a1e6089308a49b403"

COMPATIBLE_MACHINE = "qcs9100"

FW_ARTIFACTORY = "softwarecenter.qualcomm.com/download/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_integrationandtest_publictest"
FW_BUILD_ID = "r1.0_${PV}/qcs9100-le-1-0"
FW_BIN_PATH = "common/build/ufs/bin"
Expand Down
9 changes: 9 additions & 0 deletions recipes-bsp/partition/qcom-partition-confs_1.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ PARTCONF ?= ""
PARTCONF:qcm6490 ?= "qcm6490-partitions.conf"
PARTCONF:qcs9100 ?= "qcs9100-partitions.conf"

# For machines with a published cdt file, let's make sure we flash it
Copy link
Contributor

@igoropaniuk igoropaniuk Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also expand on what CDT is and what is contains in the `qcom-partition-confs: add support for CDT" commit message. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I can add more information. I will update the PR.
CDT is Configuration Data Table. It contains the platform and subtype IDs, the same explained here https://android.googlesource.com/kernel/msm.git/+/android-msm-bullhead-3.10-n-preview-1/Documentation/devicetree/bindings/arm/msm/board-id.txt.
The IDs are 'flashed', at runtime they are read by the bootloader, and it will search through all the DTBs on the system for the one that 'matches' looking at the board-id in the DTB.

That solution was never accepted upstream, and used mostly in Android. We are working on a 'new' solution for qualcomm linux.

fixup_cdt() {
sed -i '/name=cdt/ s/$/ --filename=cdt.bin/' ${S}/${PARTCONF}
}

do_compile:prepend:qcs6490-rb3gen2-core-kit() {
Copy link
Contributor

@igoropaniuk igoropaniuk Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the information from https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html, CDTs for core and vision kits differ (I've compared hashes). Could we also introduce the one for Vision Kit?

This probably will also require a new machine file for qcs6490-rb3gen2-vision-kit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are different. This is why I prepared the recipe so that we can add more MACHINES in here. There will be a -vision .conf file, we just haven't added it yet (see how it is in the 1.x / legacy branch, https://github.com/quic-yocto/meta-qcom-hwe/tree/kirkstone/conf/machine)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we currently use qcs6490-rb3gen2-core-kit machine for both kits (I'm testing that build on Vision Kit, for example), my concern is if it can break boot if we deliberately flash wrong CDT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. interesting.. we are shipping only 1 DTB, and I would expect the CDT to basically assist in the DTB selection process, nothing else. So I am pretty sure that you can use either one of the 2 CDT , and it will work. Do you want to try?

Copy link
Contributor

@igoropaniuk igoropaniuk Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested both CDTs no my Vision KIt and confirm Linux boots in both cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note: I still consider that changing CDT for the mezzanines is a mistake. What if the user adds industrial mezz on top of the Vision Kit? Which CDT should be flashed in such a case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are only using one DTB in the end via the dtb fat image, since we don't have the extra device-id logic in upstream, that is why the generated image is working fine on both.

We will have to create another machine conf for vision kit as well, which will have its own CDT.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note: I still consider that changing CDT for the mezzanines is a mistake. What if the user adds industrial mezz on top of the Vision Kit? Which CDT should be flashed in such a case?

Yes, I also don't agree on using CDT here, as this is just a mezzanine in the end, but I don't think there is another mechanism to identify if the mezzanine is available at runtime atm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that even with CDT we can not identify the mezzanine (and we have no guarantee that there is just a single mezz). The updated boot-selection mechanism should account for that by e.g. allowing a user to manually name attached mezzanines.

fixup_cdt
}

do_compile() {
gen_partition.py -i ${S}/${PARTCONF} -o ${B}/${MACHINE}-partition.xml
}
Expand Down
Loading