I need to modify the DTS file associated with the WP7702 to indicate that there is a SPI NOR flash connected. What is the ‘main’ DTS file associated with this model? Typically this file is located in kernel/arch/arm/boot/dts/
. Additional note: I am using the linux-msm recipe associated with the more modern legato releases.
for WP76xx, I will look into /kernel/arch/arm/boot/dts/qcom/mdm9607-wp76xx.dtsi
Ok, to clarify this for others with questions regarding the kernel:
The kernel is packaged with the SDK and you can find the location of it on your system with:
$ cat ./build_bin/conf/local.conf | grep LINUX
LINUX_REPO_DIR = "/var/wp77xx/yocto/kernel"
The LINUX_REPO_DIR
variable is used by the linux-msm
recipes to point to the source files. This version of the kernel has been patched with the dts
files i was looking for kernel/arch/arm/boot/dts/qcom/mdm9206-wp77xx-default.dts
summary
Ok looks like it is more compilated than I originally thought, all the main dtb files are getting merged into something called a masterDTB
file via dtbtool
and put into the final image. How do I know which of these dtb files are used at boot when they are all present in the boot image?
details
The important main dtb files that come out of typical kernel compilation are
-rw-r--r--. 2 bldr bldr 98830 Dec 3 18:39 mdm9607-cdp.dtb
-rw-r--r--. 2 bldr bldr 98792 Dec 3 18:39 mdm9607-mtp.dtb
-rw-r--r--. 2 bldr bldr 98838 Dec 3 18:39 mdm9607-rcm.dtb
-rw-r--r--. 2 bldr bldr 102253 Dec 3 18:39 mdm9607-wp76xx-default.dtb
-rw-r--r--. 2 bldr bldr 105212 Dec 3 18:39 mdm9607-wp76xx-mangoh-green.dtb
-rw-r--r--. 2 bldr bldr 103286 Dec 3 18:39 mdm9607-wp76xx-mangoh-red.dtb
-rw-r--r--. 2 bldr bldr 103426 Dec 3 18:39 mdm9607-wp76xx-mangoh-yellow.dtb
linux-msm.inc
then turns them into
-rw-r--r--. 1 bldr bldr 10355910 Dec 3 18:39 dtb-zImage-4.14.253-cdp.dtb
-rw-r--r--. 1 bldr bldr 10355872 Dec 3 18:39 dtb-zImage-4.14.253-mtp.dtb
-rw-r--r--. 1 bldr bldr 10355918 Dec 3 18:39 dtb-zImage-4.14.253-rcm.dtb
-rw-r--r--. 1 bldr bldr 10359333 Dec 3 18:39 dtb-zImage-4.14.253-wp76xx-default.dtb
-rw-r--r--. 1 bldr bldr 10362292 Dec 3 18:39 dtb-zImage-4.14.253-wp76xx-mangoh-green.dtb
-rw-r--r--. 1 bldr bldr 10360366 Dec 3 18:39 dtb-zImage-4.14.253-wp76xx-mangoh-red.dtb
-rw-r--r--. 1 bldr bldr 10360506 Dec 3 18:39 dtb-zImage-4.14.253-wp76xx-mangoh-yellow.dtb
one of these sets of dtb files are merged together via the command
${STAGING_BINDIR_NATIVE}/dtbtool \
${B}/arch/arm/boot/dts/ \
-s $page_size \
-o ${DEPLOYDIR}/$master_dtb_name \
-p ${B}/scripts/dtc/ \
-v
This is actually run twice to generate two different master dtb files: masterDTB.2k
and masterDTB.4k
. These correspond to the 2k
and 4k
page size, boot images that are generated.
Anyhow I need to know which of these dtb files is selected by the bootloader and/or kernel so i know which one to modify.
are you able to just build the kernel?
If so, you can add some dummy characters in those dts file and see if it will generate compilation error
BTW, why don’t you work on the kernel first?
strange that you need to distinguish which file for bootloader and which file for kernel
I can build the kernel just fine, I need to modify the Device Tree used by the kernel which selected by the bootloader. Once I know which DTB file/parition is selected, I can patch the associated DTS file.
If so, you can add some dummy characters in those dts file and see if it will generate compilation error
This still will not tell me which of the DTB files is selected by the bootloader. It will cause a compilation error even for DTB files we don’t use, because you bundle multiple DTB files into the masterDTB.
strange that you need to distinguish which file for bootloader and which file for kernel
This is not strange at all and something every other Linux SOM expects the final user to modify; as such, this documentation is typically provided in the Support Package. DTS modification are required for many peripherals ( SPI Flash, I2C Real Time Clocks, etc. ).
To summarize:
- I need to modify the DTB file used by the Kernel so support a SPI peripheral
- The Legato build environment builds and bundles several DTB files into a MasterDTB file. The bootloader then selects one of them to be used by the kernel.
I need to know which DTB/Partition is being selected by the bootloader (which i have very limited insight into).
Bug
Upon further investigation, I believe there is an error in your yocto recipe that is preventing WP77XX DTB files from being put into the final deployment image
Notes
Using /proc/device-tree/model
I can see that mdm9206-wp77xx-default
is the main device tree selected by the bootloader.
:~# cat /proc/device-tree/model
Sierra Wireless, Inc. MDM WP7xxx series
The issue is that I cannot update this file, in addition, this file is not being put into the final image.
The reason for this is is both the WP76XX and WP77XX get put into the same basemachine
#/meta-swi-wp/meta-swi-wp/conf/machine/swi-mdm9x28-wp.conf
GENERIC_BASEMACHINE = "mdm9x28"
which then gives them the variable
#./meta-swi/meta-swi-mdm9x28/conf/machine/swi-mdm9x28.conf
BASEMACHINE_QCOM = "mdm9607"
Finally this variable is used to isolate the dtb files used in the master image
#./meta-swi/meta-swi-mdm9x28/recipes-kernel/linux-msm/linux-msm.inc
dtb_files=$(find ${B}/arch/arm/boot/dts -iname "*${BASEMACHINE_QCOM}*.dtb" | awk -F/ '{print $NF}' | awk -F[.][d] '{print $1}')
As the dtb files are either prefixed mdm9607-wp76xx
or mdm9206-wp77xx
, just the wp76xx
files are selected.
i don’t have much experience in using the SPI bus.
But i recall I have tried the CAN bus IOT card using SPI bus on mangoh red board:
And I did not need to change DTS file for this driver
Ok, but for SPI NOR Flash I have to edit the DTS file, so let’s keep the thread on track.
DTS modifications is a standard procedure in Embedded Linux development. Right now it looks like your board support package is not allowing this for at least the WP77XX. I need either documentation explaining how your dev environment does allow for modifications to the relavent DTS/B file or an update that fixes the deficiency.
what if you change the file mdm9607-wp76xx.dtsi and build the yocto image, does it take effect for your usage?
looking into that now, will report back after the build
Root Cause?
The DTS file is not being pushed because Yocto is specifically not including the boot-yocto
image in the generated cwe
output.
I need to know:
- Why is the code to include the
boot-yocto
image commented out? - Can this code be re-enabled and the generated
boot-yocto*cwe
files used? - Are there any implications to secure boot as it deals with the same files?
Procedure
- Modified
mdm9607-wp76xx-default.dts
by adding aspi
device and also appendedCDI v1
onto themodel
string - Cleaned the bitbake caches with
bitbake -c cleanall linux-msm
- rebuilt the entire base image
bitbake mdm9x28-image-minimal
, this should- compile the dts to a dtb (
CONFIG_ARCH_MDM9607
) - bundle the dtb into a master dtb (
./linux-msm.inc
andgen_master_dtb
) - bundle the master dtb files into an boot-yocto*.img file (
./linux-msm.inc
andgen_bootimg
).
- compile the dts to a dtb (
Here is the issue, the expectation is that mdm9x28-image-cwe.inc
(generate_cwe
and generate_cwe_pid
specifically) is supposed to use the boot-yocto
image to generate boot-yocto-legato*.cwe
and boot-yocto*.cwe
; however this does not happen because these steps are both commented out:
#mdm9x28-image-cwe.inc
done
# echo "Generating CWE package for $TARGET ($PAGE_SIZE, with lk)"
# generate_cwe_pid $PID $PLATFORM $PAGE_SIZE ${DEPLOY_DIR_IMAGE}/boot-yocto${CWE_NAME_EXTRA}_$TARGET.cwe true true true false
# if [ "${LEGATO_BUILD}" = "true" ]; then
# echo "Generating CWE package for $TARGET ($PAGE_SIZE)"
# generate_cwe_pid $PID $PLATFORM $PAGE_SIZE ${DEPLOY_DIR_IMAGE}/yocto-legato${CWE_NAME_EXTRA}_$TARGET.cwe false true true true
# echo "Generating CWE package for $TARGET ($PAGE_SIZE, with lk, with Legato)"
# generate_cwe_pid $PID $PLATFORM $PAGE_SIZE ${DEPLOY_DIR_IMAGE}/boot-yocto-legato${CWE_NAME_EXTRA}_$TARGET.cwe true true true true
# fi
}
Notes
- I have confirmed that the modification to the dts is being compiled to the intended dtb file
yocto/build_bin$ dtc -I dtb -O dts ./tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/linux-msm/4.14.253-r1/deploy-linux-msm/dtb/qcom/mdm9607-wp76xx-default.dtb 2>&1| grep "\smodel ="
model = "Sierra Wireless, Inc. MDM WP7xxx series - CDI v1";
- The only reason i stumbled onto this was looking at the Secure boot guide, which only has this vague statement regarding
mdm9x28-image-cwe.inc
Package the signed images into CWE images. For details, refer to the following script in the build system
output – meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image-cwe.inc.
Do you mean now the yocto.cwe and appboot.cwe have been compiled after typing “make” command and working for your SPI flash?
If yes, actually you can combine the image by swicwe tool
No, per the last time you actually documented the Yocto system, in Release 15.10, the ‘boot’ packages contain the bootloader. It is in these bootloader packages that you also put the DTS file, so without the ability to generate the boot
packages and install them on the target, I cannot update the DTS file. The appboot
package seems to mainly be involved with the little kernel ('lk
) but does not appear to bundle the DTS file.
packages | boot_wp85.cwe | package with bootloader | ||
---|---|---|---|---|
boot-yocto_wp85.cwe | package with bootloader + yocto (= kernel + rootfs) | |||
boot-yocto-legato_wp85.cwe | package with bootloader + yocto (= kernel + rootfs) + legato | |||
legato-image.wp85.cwe | package with legato | |||
yocto_wp85.cwe | package with yocto (= kernel + rootfs) | |||
yocto-legato_wp85.cwe | package with yocto (= kernel + rootfs) + legato |
Notes
- this information is not in the latest legato doc, this needs to be remedied
- What I am seeing also seems to contradict the Secure Boot guide, as that is my next effort. The guide deals heavely with the
boot*cwe
images
For WP76xx, I remember if i modify the file /kernel/arch/arm/boot/dts/qcom/mdm9607-wp76xx.dtsi, after that i type “make” command, the yocto image will be including my modification.
I am not quite understand what “boot” package you are referring to…
For secure boot, you can also see this document.
I tried it in WP76 FW R16 before:
I have showed two guides, Customer Secure Boot and Yocto Legato Builds , provided by Legato/Sierra that explain what the boot*cwe
packages are and also included your own yocto source file that seemingly at one point generates them, but then was commented out.
After make
, what generated output file are you uploading to the target? I will mimic your process exactly and report back results.
i just download the yocto_wp76xx.4k.cwe to my WP76 module for testing
using yocto_wp77xx
worked. Please update the mentioned guides, specifically the Secure Boot.