How to copy multiple DTB files via U-boot

Hi,

I seen that Using the Toradex utility we are able to copy multiple DTB files in DTB partition .

  1. imx6ull-colibri-wifi-eval-v3.dtb
  2. imx6ull-colibri-eval-v3.dtb
  3. imx6ull-colibri-aster.dtb

At run time U-boot is able to detect which hardware revision is used in module and according to that it will load DTB files.

I’m flashing the board using default u-boot command. ( like run setupdate and run update.)

What is the way to copy multiple dtb file in the dtb partition using u-boot command ??

I’m not able to read specific DTB according to baord.

check logs :

No size specified → Using max size (3174400)

Read 3174400 bytes from volume dtb to 82100000

Saving Environment to NAND… Erasing NAND… Erasing at 0x380000 – 100% complete.

Writing to NAND… OK

Kernel image @ 0x81000000 [ 0x000000 - 0x534f68 ]

ERROR: Did not find a cmdline Flattened Device Tree Could not find a valid device tree Booting from NAND rootfs partition…

ubi0: detaching mtd1 ubi0: mtd1 is detached

Regards,
Hitendra

Colibri iMX6ULL has a NAND chip for storage and utilize a UBI/UBIFS.
UBI volume has a several partition :
0 - For storing Linux Kernel
1 - For storing DTB
3 - For Root FS

You can check it by using command:
#cat /sys/class/ubi/ubi0/ubi0_1/name
dtb

or
#ubinfo -a

Linux Kernel and DTB partitions have no file system. So dtb stored as binary started with begging of partition.
U boot load DTB to specific address using command
ubi read ${fdt_addr_r} dtb

So you can’t store multiple DTB using different file names.
However DTB partition has a 248 KiB size while single DTB is around 40KB. So you can store multiple dtb using different offset.

Hi @alex.tx @jaski.tx

Thanks for quick reply.

How to create offset in dtb partition ??

Can you give me u-boot command for that ?

How can i see start and end addresses of any partition.(like rootfs, dtb, kernel.)

How you will copy multiple dtb via toradex utility ?? can you explain me ??

Regards,
HItendra

You can concatenate 2 binary files and write resulted file to a UBI partition, Then knowing size of each part you can load required dtb to proper memory location.

 Colibri iMX7 # ubi part ubi   *//init U-Boot UBI subsystem*
 Colibri iMX7 # fatload mmc 0:1 <addr> <your_file>  *//load file from 1st SD partition to RAM*  
 Colibri iMX7 # ubi write <addr> dtb ${filesize} *//write RAM content to UBI partition **dtb***
 Colibri iMX7 # ubi info l  *//UBI partitions info*

What “Toradex utility” you are talking about?

Hi @alex.tx

What “Toradex utility” you are talking
about?

I’m taking about ToradexEasyInstaller .

@alex.tx
I tried the solution you given , but check this below command:

ubiboot ’ ubi part ubi && ubi read ${kernel_addr_r} kernel && ubi read ${fdt_addr_r} dtb && bootz ${kernel_addr_r} - ${fdt_addr_r}’

I concatenate 2 dtb file (imx6ull.dtb + vf61.dtb ) and write into dtb partition.

I used below command for that.

cat vf500-colibri-dual-eth.dtb
imx6ull-colibri-eval-v3.dtb >
final.dtb

fatload ${interface} 0:1 ${fdt_addr_r}
${board_name}/final.dtb

ubi write ${fdt_addr_r} dtb
${filesize}

If 1st file is imx6ull.dtb file than it will load kernel and boot correctly. but if imx6ull.dtb file is 2nd then it is hang during kernel load means not able to start kernel.

How can i pass argument to read 2nd dtb or address for reading ?

Regards,

Hitendra Prajapati

>>How can i pass argument to read 2nd dtb or address for reading ?

U_boot boot script uses bootz command to start linux. Use help bootz for more details
You can also run a printenv U_boot command and check ubiboot variable

>>How you will copy multiple dtb via toradex utility ?

Toradex Easy installer documentation available here - https://developer.toradex.com/software/toradex-easy-installer#configuration-files

@alex.tx

U_boot boot script uses bootz command
to start linux. Use help bootz for
more details You can also run a
printenv U_boot command and check
ubiboot variable

That i know but it is reading from fdt address .

I’m asking , as per your suggestion if 2 dtb are merge and write into dtb partition then how would i will read 2nd dtb ??

ubi read ${fdt_addr_r} dtb && bootz
${kernel_addr_r} - ${fdt_addr_r}’

Above command always read entire dtb partition , not the address specific read.

My both dtb(imx6ull + vf61) are in dtb partition. then how you will read 2nd one, because it is store as one after another and in binary format .

can you explain command to me briefly to read both dtb separate??

FYI:

ubi read ${fdt_addr_r} dtb ==> this command read entire dtb partition or upto filesize value.

It will not read from the address specify by you (to read 2nd dtb).

per your suggestion if 2 dtb are merge and write into dtb partition then how would i will read 2nd dtb ??

You can read the whole concatenated file and pass needed address to to bootz command

My both dtb(imx6ull + vf61) are in dtb partition. then how you will read 2nd one, because it is store as one after another and in binary format .

Why do you need to mix imx6Ull DTB and vf61 dtb? Could you explain in details what exactly you are trying to achieve?

Hi @alex.tx

Why do you need to mix imx6Ull DTB and
vf61 dtb? Could you explain in details
what exactly you are trying to
achieve?

You only told to concatenated files. otherwise How will you copy 2 files in dtb partition.

Which command you will use to concatenated files ??

I try with this cat vf500-colibri-dual-eth.dtb imx6ull-colibri-wifi-eval-v3.dtb > final.dtb

Then it will copy the entire final dtb file in partition but not able to boot kernel.

What is your suggestion on that ?

hi @hitendra_prajapati

Could you tell us what exactly you have done?
Could you share the two different devicetree files you want to use?