No matching DT, using my own machine/layer/dts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

No matching DT, using my own machine/layer/dts

3,186 Views
johnadamson
Contributor III

I'm trying to create my own machine/layer/devicetree based on the iMX8MQ EVK. For the moment, I'm not actually trying to change the devicetree, I'm simply copying the existing to my names and changing or adding Yocto recipes as seems appropriate. Everything builds in the Yocto system, but when I try to boot the resulting sdcard image, I get:

Trying to boot from MMC2
No matching DT out of these options:
   Configuration to load ATF before U-Boot
No matching DT out of these options:
   Configuration to load ATF before U-Boot
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Can anyone point me in the direction of what I'm missing based on the message?

The timing seems to point at u-boot-imx. I've:

  • added my own .dts, copied from the fsl-imx8mq-evk.dts for u-boot-imx
  • added my own _defconfig, but with CONFIG_DEFAULT_DEVICE_TREE set to my my dts name without the extension.
  • As a part of do_compile_prepend, I copy those files into the appropriate directories.

u-boot-imx builds without errors after a cleansstate.  For what it's worth, core-image-minimal does NOT build unless I also do a cleansstate on it.  I'm thinking there' s a dependency error somewhere.  

imx-boot was patched to use dtbs=$(UBOOT_DTB_NAME) instead of dtbs=fsl-$(PLAT)-evk.dtb, 

in my machine.conf, I set UBOOT_DTB_NAME, UBOOT_CONFIG[sd], and KERNEL_DEVICETREE 

The mention of "ATF" in the error message had me looking at imx-atf, but I haven't found any references to the _defconfig or dtb files anywhere in the imx-atf recipe or git files, so no changes there. 

This is only a partial list of the changes, I'm afraid. I can flesh this out more if needed.

John

3 Replies

2,539 Views
johnadamson
Contributor III

For what it's worth, I think I was able to successfully build the Linux kernel and get the kernel to boot with my dtb. 

What isn't working is changing the u-boot .dtb (as opposed to the kernel). With all the kernel changes in place, I
1) in mymachine.conf, set UBOOT_CONFIG = "my_defconfig,sdcard"
2) in mymachine.conf, set UBOOT_DTB_NAME = "mydtb.dtb"
3) in the u-boot-imx recipe, add the mydtb.dts file, and my_defconfig file during do_compile_prepend
(my_defconfig sets CONFIG_DEFAULT_DEVICE_TREE="mydtb")

Those three things are apparently not sufficient to get u-boot to use my dts (copied from the EVK u-boot dts) and I get the error noted at boot. But no errors during the build.

{The imx-boot patch noted in my first post is still in place, but since everything works when UBOOT_DTB_NAME is set to the original file, I'm assuming the patch doesn't break anything. }

So...any clues as to what I'm missing to change the u-boot .dts ?  There's not much in there, but as it does configure sai2, and there's a good chance I might want to re-purpose sai2 later, I'd like to get this figured out.  

John

0 Kudos

2,539 Views
johnadamson
Contributor III

>>{The imx-boot patch noted in my first post is still in place, but since everything works when UBOOT_DTB_NAME is set to the original file, I'm assuming the patch doesn't break anything. }

Yeah, not so much.  Apparently, UBOOT_DTB_NAME is not defined or somehow not available to soc.mak at the compile stage of imx-boot, so the mkimage_fit_atf.sh script was being fed an empty command line instead of the name of the dtb file.  It didn't complain, but would result in the original error on boot.  Changed the patch to instead directly feed it my .dtb filename, and it now boots.   

There's probably a much easier way to do this, but to summarize what worked for me and while preserving the originals...

* created my own layer and copied meta-fsl-bsp-release/imx/meta-bsp into mylayer/imx/meta-bsp.  Added my layer to bblayers.conf and commented out the meta-fsl-bsp-release/imx/meta-bsp inclusion

* added my own mymachine.conf to meta-bsp/conf/machine.  In it, I commented out the -evk.dtb and added my own dtb file name, changed UBOOT_CONFIG[sd] to point at my defconfig, and changed UBOOT_DTB_NAME to point to my own uboot dtb

* in the imx-boot recipe, I add a patch that changes soc.mak to use my uboot dtb 

* in the u-boot-imx recipe, add my defconfig file (with DEVICE_TREE set to my file), add my u-boot dts, and a modified imx8mq_evk.h file (so the u-boot params are changed).  All these get copied to the appropriate ${S} directory in a do_compile_prepend task.

* in the linux-imx recipe, add my linux dts (not the same as u-boot dts, u-boot doesn't like the syntax of everything in the linux dts (?)), and copy it to the appropriate source directory in a do_compile_prepend task.  add my dtb to the KERNEL_DEVICETREE variable here

*in the optee-os-imx recipe, add my machine name flavor (PLATFORM_FLAVOR_mymachine = "mx8mqevk")

* I didn't bother trying to modify the sdcard builder, so the dtb file has to be manually copied to the FAT partition from the deploy directory. 

Hope this is helpful... 

John

2,539 Views
Aurelien_BOUIN
Contributor III

I solve it with a file into a meta/recipe-bsp/imx-mkimage/imx-boot_%.bbappend

with inside :

-----

do_compile_prepend() {
    #patch when UBOOT_DTB_NAME not matching fsl-$(PLAT)-evk.dtb
    PLAT=$(echo ${SOC_TARGET} | tr '[:upper:]' '[:lower:]')
    cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${UBOOT_DTB_NAME} ${S}/${SOC_DIR}/fsl-${PLAT}-evk.dtb
}

-----

Regards,

Aurelien BOUIN

0 Kudos