Basic Understanding the Build Process & DT

Hi Toradex-Team,

Intro:
I have studied your manual own Yocto image (e.g. Build a Reference Image with Yocto Project/OpenEmbedded | Toradex Developer Center). Everything works fine and no errors etc… got all these files like zImage, .imx, .dtb then I put them on a SD card and via Easyinstaller flashed the Colibri-imx6ull Module. Power off on, system boots fine without errors. Done a several builds where I set the root passwd or added some stuff like ltp… build works quite reliable, the passwd or packages will be added and working fine.
So we build our own PCB according your documentation and pinout-designer believe it or not it works fine I used the standard pinout for the LCD and if I take a own flashed SoC I see boot messages on it - pug in a keyboard works also, login works too (see pic). Of cause not all the Hardware works and therefore I studied the Devicetree docs on your page.
Then left the .dtsi files untouched to validate the process and just generated an DT file .dtb name: imx6ull-colibri-eval-3vx.dtb done with: 1.) source export_compiler 2.) make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- imx6ull-colibri-eval-v3x.dtb works no errors, generated me the mentioned DT. Note: I use the build directory for that: ~/oe-core/build/tmp/work-shared/colibri-imx6ull/kernel-source. After that I replaced the dtb file on the SD Card and via Easyinstaller flashed it… install process no errors. On the Toradex-Board or our own board the system does not boot, I got the u-boot message then “Starting kernel…” nothing. I conclude it does not work because i see no messages on the display.

Q: Is the .dtb file after the build process the same as the one I generated via: make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- imx6ull-colibri-eval-v3x.dtb without any changes in .dtsi files done?

Q: Is it possible to to do make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- imx6ull-colibri-eval-xyz.dtb and use this file instead the file done during the build process?

I also done a zImage according to your doc this means I replaced both zImage and .dtb file on SD Card and flashed it but no success… maybe it works and I do not see it?

Q: If I generate a .dtb file do I need to generate an zImage too?

Thanx for all your help.

St.

alt text

/ # [ 291.217309] reboot: Power down

U-Boot 2020.07-0+git.2a68bb1926d6 (Apr 01 2021 - 16:56:40 +0000)

CPU: Freescale i.MX6ULL rev1.1 792 MHz (running at 396 MHz) CPU: Industrial temperature grade (-40C to 105C) at 51C Reset cause: POR DRAM: 512 MiB NAND: 512 MiB MMC: FSL_SDHC: 0 Loading Environment from NAND... OK In: serial Out: serial Err: serial Model: Toradex Colibri iMX6ULL 512MB IT V1.1A, Serial# 06734219 Net: Could not get PHY for FEC1: addr 2 No ethernet found.

Hit any key to stop autoboot: 0 Booting from NAND... 
ubi0: default fastmap pool size: 200 ubi0: default fastmap WL pool size: 100 
ubi0: attaching mtd5 ubi0: scanning is finished ubi0: attached mtd5 (name "ubi", size 508 MiB) 
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes 
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048 
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096 
ubi0: good PEBs: 4058, bad PEBs: 6, corrupted PEBs: 0 
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128 
ubi0: max/mean erase counter: 75/37, WL threshold: 4096, image sequenc2 
ubi0: available PEBs: 0, total reserved PEBs: 4058, PEBs reserved for 4 No size specified -> Using max size
 (8491520) Read 8491520 bytes from volume kernel to 81000000 
No size specified -> Using max size (47909) Read 47909 bytes from volume dtb to 82100000
Kernel image @ 0x81000000 [ 0x000000 - 0x819200 ] 
## Flattened Device Tree blob at 82100000 
Booting using the fdt blob at 0x82100000 
Using Device Tree in place at 82100000, 
end 8210eb24 Updating MTD partitions...
        
Starting kernel ...

Hi @Stephan,

Thanks for using the Toradex Community.

I am happy to hear that following our guides was a first success. Even the process of designing hardware seemed to be working pretty well.

How was the experience while following these articles and guides? We would really appreciate your feedback on that.

I recommend looking at our developer article about device tree customization here:

The device tree file you as a person can read, ergo the source file has the ending “.dts”. Device tree source. When you build one of these files, it becomes a binary file unreadable for humans. They will have the ending “.dtb”. Device tree binary. Additionally you face files with the ending “.dtsi” which is an additional include file to the “.dts” file.

Yes the file will be the same. By performing the “make” command , you converted the file from “.dts” to “.dtb”.

Regarding the second question. You can use any “.dtb” file, as long as it is configured for the hardware you are using. If you based your version on of Toradex’ device tree files, chances are high that it will work. But since you report, the module holds at the “Starting Kernel….” message, it is highly likely that there might be an issue with the newly created device tree files. It is important that you use the files out of the same git branch. If this is the case the files will be the same indeed.

To your third question. This depends on what changes you introduced in the dtb file. For example if your adding or removing drivers, then it is necessary to build a need zImage. However if you are only enabling or disabling specific features then there is no need to actually build a new image.

If you share your device tree file as well as your kernel configuration, we could take a closer look at it.

Does this already help you? Feel free to reach out again, we are here to help

Best Regards
Kevin

Ok, I messed up different topics in the past so I setup a complete new build.

I Test in the build dir:
XXX
~/oe-core/build/tmp/work-shared/colibri-imx6ull/kernel-source$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- imx6ull-colibri-eval-v3.dtb
make: arm-none-linux-gnueabihf-gcc: Kommando nicht gefunden


*** Configuration file “.config” not found!


*** Please run some configurator (e.g. “make oldconfig” or
*** “make menuconfig” or “make xconfig”).


Makefile:678: include/config/auto.conf.cmd: Datei oder Verzeichnis nicht gefunden
make: *** [Makefile:687: .config] Fehler 1
XXX
Conclusion, the cross compiler is not installed so the yocto build dir its something compleatly different!

Installed the toolchain via: Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center

II Test in the build dir:
~/oe-core/build/tmp/work-shared/colibri-imx6ull/kernel-source$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- imx6ull-colibri-eval-v3.dtb


*** Configuration file “.config” not found!


*** Please run some configurator (e.g. “make oldconfig” or
*** “make menuconfig” or “make xconfig”).


Makefile:678: include/config/auto.conf.cmd: Datei oder Verzeichnis nicht gefunden
make: *** [Makefile:687: .config] Fehler 1

Conclusion, the crosscompiler is there but no kernel config for my imx6ull-colibri module. To use the yocto build dir will not work here without the kernel config file.

So, I found the kernel config in the yocto build dir lets go:

toradex2@sykam:~/oe-core/build/tmp/work-shared/colibri-imx6ull/kernel-source$ make colibri-imx6ull_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTLD scripts/kconfig/conf

configuration written to .config

toradex2@sykam:~/oe-core/build/tmp/work-shared/colibri-imx6ull/kernel-source$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- imx6ull-colibri-eval-v3.dtb
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
LEX scripts/dtc/dtc-lexer.lex.c
YACC scripts/dtc/dtc-parser.tab.[ch]
HOSTCC scripts/dtc/dtc-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
UPD include/config/kernel.release
DTC arch/arm/boot/dts/imx6ull-colibri-eval-v3.dtb
toradex2@sykam:~/oe-core/build/tmp/work-shared/colibri-imx6ull/kernel-source$

…cool it seems to work, ok then compare them before flash with dtdiff:

toradex2@sykam:~/01_DeviceTreeBin$ dtdiff dtb-manual-done/imx6ull-colibri-eval-v3.dtb dtb-yocto-done/imx6ull-colibri-eval-v3–5.4.115+gitAUTOINC+64dbf17bb3-r0-colibri-imx6ull-20210623152158.dtb

…ok no diffs sounds good dude! Lets check and validate dtdiff with a different file:

toradex2@sykam:~/01_DeviceTreeBin$ dtdiff dtb-manual-done/imx6ull-colibri-eval-v3.dtb dtb-yocto-done/imx6ull-colibri-wifi-eval-v3–5.4.115+gitAUTOINC+64dbf17bb3-r0-colibri-imx6ull-20210623152158.dtb
— /dev/fd/63 2021-06-24 11:00:28.059051387 +0200
+++ /dev/fd/62 2021-06-24 11:00:28.059051387 +0200
@@ -3,8 +3,8 @@…

…ok, dtdiff found differences. Ok then lets take this file and replace this file with the dtb-Build file and flash it.

[Concluson:]
KEVIN.tx was right! It is possible to use the build directory to generate a dtb-file as long as you install the cross-compiler according TDX I mentioned it before. I replaced the yocto done dtb with the manual made dtb on the SD card and flashed it and also successfully booted it on the Eval- and my own board. In the next step I’ll modify the dtsi files and generate dtb again.

Ok, thank you for your support so let us do small steps to shape my understanding. Let us go back to the point of the yocto build. I have a build done and may goal is to generate an device tree bin (dtb) of the current dtsi files without touching them just to validate that I’m able to get the same as the build has done. Again, the dtb-file which was gernated by the build works this means booting is possible, all the modifications for my own board I’ll do later.

In the build directory /build…kernel-source/arch/arm/boot/dts lay all the dtsi, dts,…

Q: Is it possible to use the build directory to generate with make an dtb-file or do I have to follow Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center and install the toolchain on my host machine separate?

Hi @Stephan,

I’m glad that you could register some progress. As I see you already figured out how it works with the toolchain.

Is there anything you would like to know, which might be unclear?

Let me know.

Best Regards
Kevin