2017-09-04 20:12:19 +00:00
|
|
|
U-Boot FDT Overlay FIT usage
|
|
|
|
============================
|
2017-09-04 20:12:17 +00:00
|
|
|
|
|
|
|
Introduction
|
|
|
|
------------
|
|
|
|
In many cases it is desirable to have a single FIT image support a multitude
|
|
|
|
of similar boards and their expansion options. The same kernel on DT enabled
|
|
|
|
platforms can support this easily enough by providing a DT blob upon boot
|
|
|
|
that matches the desired configuration.
|
|
|
|
|
2017-09-04 20:12:19 +00:00
|
|
|
This document focuses on specifically using overlays as part of a FIT image.
|
|
|
|
General information regarding overlays including its syntax and building it
|
|
|
|
can be found in doc/README.fdt-overlays
|
|
|
|
|
2017-09-04 20:12:17 +00:00
|
|
|
Configuration without overlays
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
Take a hypothetical board named 'foo' where there are different supported
|
|
|
|
revisions, reva and revb. Assume that both board revisions can use add a bar
|
|
|
|
add-on board, while only the revb board can use a baz add-on board.
|
|
|
|
|
|
|
|
Without using overlays the configuration would be as follows for every case.
|
|
|
|
|
|
|
|
/dts-v1/;
|
|
|
|
/ {
|
|
|
|
images {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./zImage");
|
|
|
|
type = "kernel";
|
|
|
|
arch = "arm";
|
|
|
|
os = "linux";
|
|
|
|
load = <0x82000000>;
|
|
|
|
entry = <0x82000000>;
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-1 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo-reva.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-2 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo-revb.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-3 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo-reva-bar.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-4 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo-revb-bar.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-5 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo-revb-baz.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-6 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo-revb-bar-baz.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
default = "foo-reva.dtb;
|
|
|
|
foo-reva.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-2";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-reva-bar.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-3";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb-bar.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-4";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb-baz.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-5";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb-bar-baz.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-6";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
Note the blob needs to be compiled for each case and the combinatorial explosion of
|
|
|
|
configurations. A typical device tree blob is in the low hunderds of kbytes so a
|
|
|
|
multitude of configuration grows the image quite a bit.
|
|
|
|
|
|
|
|
Booting this image is done by using
|
|
|
|
|
|
|
|
# bootm <addr>#<config>
|
|
|
|
|
|
|
|
Where config is one of:
|
|
|
|
foo-reva.dtb, foo-revb.dtb, foo-reva-bar.dtb, foo-revb-bar.dtb,
|
|
|
|
foo-revb-baz.dtb, foo-revb-bar-baz.dtb
|
|
|
|
|
|
|
|
This selects the DTB to use when booting.
|
|
|
|
|
|
|
|
Configuration using overlays
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
Device tree overlays can be applied to a base DT and result in the same blob
|
|
|
|
being passed to the booting kernel. This saves on space and avoid the combinatorial
|
|
|
|
explosion problem.
|
|
|
|
|
|
|
|
/dts-v1/;
|
|
|
|
/ {
|
|
|
|
images {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./zImage");
|
|
|
|
type = "kernel";
|
|
|
|
arch = "arm";
|
|
|
|
os = "linux";
|
|
|
|
load = <0x82000000>;
|
|
|
|
entry = <0x82000000>;
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-1 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./foo.dtb");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
load = <0x87f00000>;
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-2 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./reva.dtbo");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
load = <0x87fc0000>;
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-3 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./revb.dtbo");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
load = <0x87fc0000>;
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-4 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./bar.dtbo");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
load = <0x87fc0000>;
|
|
|
|
};
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt-5 {
|
2017-09-04 20:12:17 +00:00
|
|
|
data = /incbin/("./baz.dtbo");
|
|
|
|
type = "flat_dt";
|
|
|
|
arch = "arm";
|
|
|
|
load = <0x87fc0000>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
default = "foo-reva.dtb;
|
|
|
|
foo-reva.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1", "fdt-2";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1", "fdt-3";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-reva-bar.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1", "fdt-2", "fdt-4";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb-bar.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1", "fdt-3", "fdt-4";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb-baz.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1", "fdt-3", "fdt-5";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
foo-revb-bar-baz.dtb {
|
2017-12-04 02:05:07 +00:00
|
|
|
kernel = "kernel";
|
|
|
|
fdt = "fdt-1", "fdt-3", "fdt-4", "fdt-5";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
bar {
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt = "fdt-4";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
baz {
|
2017-12-04 02:05:07 +00:00
|
|
|
fdt = "fdt-5";
|
2017-09-04 20:12:17 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
Booting this image is exactly the same as the non-overlay example.
|
|
|
|
u-boot will retrieve the base blob and apply the overlays in sequence as
|
|
|
|
they are declared in the configuration.
|
|
|
|
|
|
|
|
Note the minimum amount of different DT blobs, as well as the requirement for
|
|
|
|
the DT blobs to have a load address; the overlay application requires the blobs
|
|
|
|
to be writeable.
|
|
|
|
|
|
|
|
Configuration using overlays and feature selection
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Although the configuration in the previous section works is a bit inflexible
|
|
|
|
since it requires all possible configuration options to be laid out before
|
|
|
|
hand in the FIT image. For the add-on boards the extra config selection method
|
|
|
|
might make sense.
|
|
|
|
|
|
|
|
Note the two bar & baz configuration nodes. To boot a reva board with
|
|
|
|
the bar add-on board enabled simply use:
|
|
|
|
|
|
|
|
# bootm <addr>#foo-reva.dtb#bar
|
|
|
|
|
|
|
|
While booting a revb with bar and baz is as follows:
|
|
|
|
|
|
|
|
# bootm <addr>#foo-revb.dtb#bar#baz
|
|
|
|
|
|
|
|
The limitation for a feature selection configuration node is that a single
|
|
|
|
fdt option is currently supported.
|
|
|
|
|
|
|
|
Pantelis Antoniou
|
|
|
|
pantelis.antoniou@konsulko.com
|
|
|
|
12/6/2017
|