Using FIT image and Device Tree Overlays

How it works

Using FIT with overlays

Since U-boot 2018.07, released with linux4sam_6.0, we have the feature of adding Device Tree overlays to the base Device Tree at boot time, from U-boot. To achieve this, we use a FIT image, which embeds the Kernel + Device Tree blobs in a single file.

Device Tree Overlays

Device Tree Overlays are available in our repository at Github. Compiling the Device Tree overlays with the corresponding kernel zImage results in a FIT image. The Makefile will do that for you.

Loading FIT image with U-boot

The FIT image is a placeholder that has the zImage and the base Device Tree, plus additional overlays that can be selected at boot time.

The following steps are required to boot the FIT Image from U-boot:

Load the FIT image like you would normally load the uImage or zImage.

There is no need to load additional Device Tree Blob, the FIT image includes it

When booting the FIT image, specify the FIT configuration to use. Several configurations can be appended to the basic configuration, which we name 'kernel_dtb'

Example:

bootm 0x24000000#kernel_dtb

This will load the FIT image from address 0x24000000 in memory and then run the configuration named 'kernel_dtb'. This configuration includes the kernel plus the base Device Tree Blob built with the kernel.

To load additional FIT configurations, just append another configuration to the command.

Example

Further more, if we inspect the U-boot environment (just an example)

The default U-boot environment adds loading commands for the screens TM7000, TM7000B, TM5000 and TM4300. If you have a different screen you need to similarly edit this environment and take your specific screen into consideration.

We can see that the variable 'bootcmd_boot' loads the FIT image from SD-Card, and then it boots it with the 'kernel_dtb' configuration, plus an additional configuration for a specific PDA if it's detected at boot-time

These tests check for the 'display' variable and configure the video mode correctly and the 'display_var' . This display_var is the actual name of the screen configuration for the overlays, that we pass to the overlay configuration.

This is the actual boot command, that will load the FIT image and add the configured overlays in the FIT boot sequence.

Extract parts of the FIT image with U-boot

With the use of the imxtract command in U-boot, we can extract parts of the FIT image into the memory and use them.

The imxtract command uses the syntax:

imxtract <FIT addr> <FIT subimage> <address in DRAM>

It will extract from the FIT image at FIT addr the subimage named FIT subimage and place it into the DRAM at address in DRAM
To obtain information about which subimages are in a FIT image, use the iminfo command .
Here is an example: