···11-U-Boot FDT Overlay FIT usage
22-============================
33-44-Introduction
55-------------
66-In many cases it is desirable to have a single FIT image support a multitude
77-of similar boards and their expansion options. The same kernel on DT enabled
88-platforms can support this easily enough by providing a DT blob upon boot
99-that matches the desired configuration.
1010-1111-This document focuses on specifically using overlays as part of a FIT image.
1212-General information regarding overlays including its syntax and building it
1313-can be found in doc/README.fdt-overlays
1414-1515-Configuration without overlays
1616-------------------------------
1717-1818-Take a hypothetical board named 'foo' where there are different supported
1919-revisions, reva and revb. Assume that both board revisions can use add a bar
2020-add-on board, while only the revb board can use a baz add-on board.
2121-2222-Without using overlays the configuration would be as follows for every case.
2323-2424- /dts-v1/;
2525- / {
2626- images {
2727- kernel {
2828- data = /incbin/("./zImage");
2929- type = "kernel";
3030- arch = "arm";
3131- os = "linux";
3232- load = <0x82000000>;
3333- entry = <0x82000000>;
3434- };
3535- fdt-1 {
3636- data = /incbin/("./foo-reva.dtb");
3737- type = "flat_dt";
3838- arch = "arm";
3939- };
4040- fdt-2 {
4141- data = /incbin/("./foo-revb.dtb");
4242- type = "flat_dt";
4343- arch = "arm";
4444- };
4545- fdt-3 {
4646- data = /incbin/("./foo-reva-bar.dtb");
4747- type = "flat_dt";
4848- arch = "arm";
4949- };
5050- fdt-4 {
5151- data = /incbin/("./foo-revb-bar.dtb");
5252- type = "flat_dt";
5353- arch = "arm";
5454- };
5555- fdt-5 {
5656- data = /incbin/("./foo-revb-baz.dtb");
5757- type = "flat_dt";
5858- arch = "arm";
5959- };
6060- fdt-6 {
6161- data = /incbin/("./foo-revb-bar-baz.dtb");
6262- type = "flat_dt";
6363- arch = "arm";
6464- };
6565- };
6666-6767- configurations {
6868- default = "foo-reva.dtb;
6969- foo-reva.dtb {
7070- kernel = "kernel";
7171- fdt = "fdt-1";
7272- };
7373- foo-revb.dtb {
7474- kernel = "kernel";
7575- fdt = "fdt-2";
7676- };
7777- foo-reva-bar.dtb {
7878- kernel = "kernel";
7979- fdt = "fdt-3";
8080- };
8181- foo-revb-bar.dtb {
8282- kernel = "kernel";
8383- fdt = "fdt-4";
8484- };
8585- foo-revb-baz.dtb {
8686- kernel = "kernel";
8787- fdt = "fdt-5";
8888- };
8989- foo-revb-bar-baz.dtb {
9090- kernel = "kernel";
9191- fdt = "fdt-6";
9292- };
9393- };
9494- };
9595-9696-Note the blob needs to be compiled for each case and the combinatorial explosion of
9797-configurations. A typical device tree blob is in the low hunderds of kbytes so a
9898-multitude of configuration grows the image quite a bit.
9999-100100-Booting this image is done by using
101101-102102- # bootm <addr>#<config>
103103-104104-Where config is one of:
105105- foo-reva.dtb, foo-revb.dtb, foo-reva-bar.dtb, foo-revb-bar.dtb,
106106- foo-revb-baz.dtb, foo-revb-bar-baz.dtb
107107-108108-This selects the DTB to use when booting.
109109-110110-Configuration using overlays
111111-----------------------------
112112-113113-Device tree overlays can be applied to a base DT and result in the same blob
114114-being passed to the booting kernel. This saves on space and avoid the combinatorial
115115-explosion problem.
116116-117117- /dts-v1/;
118118- / {
119119- images {
120120- kernel {
121121- data = /incbin/("./zImage");
122122- type = "kernel";
123123- arch = "arm";
124124- os = "linux";
125125- load = <0x82000000>;
126126- entry = <0x82000000>;
127127- };
128128- fdt-1 {
129129- data = /incbin/("./foo.dtb");
130130- type = "flat_dt";
131131- arch = "arm";
132132- load = <0x87f00000>;
133133- };
134134- fdt-2 {
135135- data = /incbin/("./reva.dtbo");
136136- type = "flat_dt";
137137- arch = "arm";
138138- load = <0x87fc0000>;
139139- };
140140- fdt-3 {
141141- data = /incbin/("./revb.dtbo");
142142- type = "flat_dt";
143143- arch = "arm";
144144- load = <0x87fc0000>;
145145- };
146146- fdt-4 {
147147- data = /incbin/("./bar.dtbo");
148148- type = "flat_dt";
149149- arch = "arm";
150150- load = <0x87fc0000>;
151151- };
152152- fdt-5 {
153153- data = /incbin/("./baz.dtbo");
154154- type = "flat_dt";
155155- arch = "arm";
156156- load = <0x87fc0000>;
157157- };
158158- };
159159-160160- configurations {
161161- default = "foo-reva.dtb;
162162- foo-reva.dtb {
163163- kernel = "kernel";
164164- fdt = "fdt-1", "fdt-2";
165165- };
166166- foo-revb.dtb {
167167- kernel = "kernel";
168168- fdt = "fdt-1", "fdt-3";
169169- };
170170- foo-reva-bar.dtb {
171171- kernel = "kernel";
172172- fdt = "fdt-1", "fdt-2", "fdt-4";
173173- };
174174- foo-revb-bar.dtb {
175175- kernel = "kernel";
176176- fdt = "fdt-1", "fdt-3", "fdt-4";
177177- };
178178- foo-revb-baz.dtb {
179179- kernel = "kernel";
180180- fdt = "fdt-1", "fdt-3", "fdt-5";
181181- };
182182- foo-revb-bar-baz.dtb {
183183- kernel = "kernel";
184184- fdt = "fdt-1", "fdt-3", "fdt-4", "fdt-5";
185185- };
186186- bar {
187187- fdt = "fdt-4";
188188- };
189189- baz {
190190- fdt = "fdt-5";
191191- };
192192- };
193193- };
194194-195195-Booting this image is exactly the same as the non-overlay example.
196196-u-boot will retrieve the base blob and apply the overlays in sequence as
197197-they are declared in the configuration.
198198-199199-Note the minimum amount of different DT blobs, as well as the requirement for
200200-the DT blobs to have a load address; the overlay application requires the blobs
201201-to be writeable.
202202-203203-Configuration using overlays and feature selection
204204---------------------------------------------------
205205-206206-Although the configuration in the previous section works is a bit inflexible
207207-since it requires all possible configuration options to be laid out before
208208-hand in the FIT image. For the add-on boards the extra config selection method
209209-might make sense.
210210-211211-Note the two bar & baz configuration nodes. To boot a reva board with
212212-the bar add-on board enabled simply use:
213213-214214- # bootm <addr>#foo-reva.dtb#bar
215215-216216-While booting a revb with bar and baz is as follows:
217217-218218- # bootm <addr>#foo-revb.dtb#bar#baz
219219-220220-The limitation for a feature selection configuration node is that a single
221221-fdt option is currently supported.
222222-223223-Pantelis Antoniou
224224-pantelis.antoniou@konsulko.com
225225-12/6/2017
···11+.. SPDX-License-Identifier: GPL-2.0+
22+33+U-Boot FDT Overlay FIT usage
44+============================
55+66+Introduction
77+------------
88+99+In many cases it is desirable to have a single FIT image support a multitude
1010+of similar boards and their expansion options. The same kernel on DT enabled
1111+platforms can support this easily enough by providing a DT blob upon boot
1212+that matches the desired configuration.
1313+1414+This document focuses on specifically using overlays as part of a FIT image.
1515+General information regarding overlays including its syntax and building it
1616+can be found in doc/README.fdt-overlays
1717+1818+Configuration without overlays
1919+------------------------------
2020+2121+Take a hypothetical board named 'foo' where there are different supported
2222+revisions, reva and revb. Assume that both board revisions can use add a bar
2323+add-on board, while only the revb board can use a baz add-on board.
2424+2525+Without using overlays the configuration would be as follows for every case::
2626+2727+ /dts-v1/;
2828+ / {
2929+ images {
3030+ kernel {
3131+ data = /incbin/("./zImage");
3232+ type = "kernel";
3333+ arch = "arm";
3434+ os = "linux";
3535+ load = <0x82000000>;
3636+ entry = <0x82000000>;
3737+ };
3838+ fdt-1 {
3939+ data = /incbin/("./foo-reva.dtb");
4040+ type = "flat_dt";
4141+ arch = "arm";
4242+ };
4343+ fdt-2 {
4444+ data = /incbin/("./foo-revb.dtb");
4545+ type = "flat_dt";
4646+ arch = "arm";
4747+ };
4848+ fdt-3 {
4949+ data = /incbin/("./foo-reva-bar.dtb");
5050+ type = "flat_dt";
5151+ arch = "arm";
5252+ };
5353+ fdt-4 {
5454+ data = /incbin/("./foo-revb-bar.dtb");
5555+ type = "flat_dt";
5656+ arch = "arm";
5757+ };
5858+ fdt-5 {
5959+ data = /incbin/("./foo-revb-baz.dtb");
6060+ type = "flat_dt";
6161+ arch = "arm";
6262+ };
6363+ fdt-6 {
6464+ data = /incbin/("./foo-revb-bar-baz.dtb");
6565+ type = "flat_dt";
6666+ arch = "arm";
6767+ };
6868+ };
6969+7070+ configurations {
7171+ default = "foo-reva.dtb;
7272+ foo-reva.dtb {
7373+ kernel = "kernel";
7474+ fdt = "fdt-1";
7575+ };
7676+ foo-revb.dtb {
7777+ kernel = "kernel";
7878+ fdt = "fdt-2";
7979+ };
8080+ foo-reva-bar.dtb {
8181+ kernel = "kernel";
8282+ fdt = "fdt-3";
8383+ };
8484+ foo-revb-bar.dtb {
8585+ kernel = "kernel";
8686+ fdt = "fdt-4";
8787+ };
8888+ foo-revb-baz.dtb {
8989+ kernel = "kernel";
9090+ fdt = "fdt-5";
9191+ };
9292+ foo-revb-bar-baz.dtb {
9393+ kernel = "kernel";
9494+ fdt = "fdt-6";
9595+ };
9696+ };
9797+ };
9898+9999+Note the blob needs to be compiled for each case and the combinatorial explosion of
100100+configurations. A typical device tree blob is in the low hunderds of kbytes so a
101101+multitude of configuration grows the image quite a bit.
102102+103103+Booting this image is done by using::
104104+105105+ # bootm <addr>#<config>
106106+107107+Where config is one of::
108108+109109+ foo-reva.dtb, foo-revb.dtb, foo-reva-bar.dtb, foo-revb-bar.dtb,
110110+ foo-revb-baz.dtb, foo-revb-bar-baz.dtb
111111+112112+This selects the DTB to use when booting.
113113+114114+Configuration using overlays
115115+----------------------------
116116+117117+Device tree overlays can be applied to a base DT and result in the same blob
118118+being passed to the booting kernel. This saves on space and avoid the combinatorial
119119+explosion problem::
120120+121121+ /dts-v1/;
122122+ / {
123123+ images {
124124+ kernel {
125125+ data = /incbin/("./zImage");
126126+ type = "kernel";
127127+ arch = "arm";
128128+ os = "linux";
129129+ load = <0x82000000>;
130130+ entry = <0x82000000>;
131131+ };
132132+ fdt-1 {
133133+ data = /incbin/("./foo.dtb");
134134+ type = "flat_dt";
135135+ arch = "arm";
136136+ load = <0x87f00000>;
137137+ };
138138+ fdt-2 {
139139+ data = /incbin/("./reva.dtbo");
140140+ type = "flat_dt";
141141+ arch = "arm";
142142+ load = <0x87fc0000>;
143143+ };
144144+ fdt-3 {
145145+ data = /incbin/("./revb.dtbo");
146146+ type = "flat_dt";
147147+ arch = "arm";
148148+ load = <0x87fc0000>;
149149+ };
150150+ fdt-4 {
151151+ data = /incbin/("./bar.dtbo");
152152+ type = "flat_dt";
153153+ arch = "arm";
154154+ load = <0x87fc0000>;
155155+ };
156156+ fdt-5 {
157157+ data = /incbin/("./baz.dtbo");
158158+ type = "flat_dt";
159159+ arch = "arm";
160160+ load = <0x87fc0000>;
161161+ };
162162+ };
163163+164164+ configurations {
165165+ default = "foo-reva.dtb;
166166+ foo-reva.dtb {
167167+ kernel = "kernel";
168168+ fdt = "fdt-1", "fdt-2";
169169+ };
170170+ foo-revb.dtb {
171171+ kernel = "kernel";
172172+ fdt = "fdt-1", "fdt-3";
173173+ };
174174+ foo-reva-bar.dtb {
175175+ kernel = "kernel";
176176+ fdt = "fdt-1", "fdt-2", "fdt-4";
177177+ };
178178+ foo-revb-bar.dtb {
179179+ kernel = "kernel";
180180+ fdt = "fdt-1", "fdt-3", "fdt-4";
181181+ };
182182+ foo-revb-baz.dtb {
183183+ kernel = "kernel";
184184+ fdt = "fdt-1", "fdt-3", "fdt-5";
185185+ };
186186+ foo-revb-bar-baz.dtb {
187187+ kernel = "kernel";
188188+ fdt = "fdt-1", "fdt-3", "fdt-4", "fdt-5";
189189+ };
190190+ bar {
191191+ fdt = "fdt-4";
192192+ };
193193+ baz {
194194+ fdt = "fdt-5";
195195+ };
196196+ };
197197+ };
198198+199199+Booting this image is exactly the same as the non-overlay example.
200200+u-boot will retrieve the base blob and apply the overlays in sequence as
201201+they are declared in the configuration.
202202+203203+Note the minimum amount of different DT blobs, as well as the requirement for
204204+the DT blobs to have a load address; the overlay application requires the blobs
205205+to be writeable.
206206+207207+Configuration using overlays and feature selection
208208+--------------------------------------------------
209209+210210+Although the configuration in the previous section works is a bit inflexible
211211+since it requires all possible configuration options to be laid out before
212212+hand in the FIT image. For the add-on boards the extra config selection method
213213+might make sense.
214214+215215+Note the two bar & baz configuration nodes. To boot a reva board with
216216+the bar add-on board enabled simply use::
217217+218218+ => bootm <addr>#foo-reva.dtb#bar
219219+220220+While booting a revb with bar and baz is as follows::
221221+222222+ => bootm <addr>#foo-revb.dtb#bar#baz
223223+224224+The limitation for a feature selection configuration node is that a single
225225+fdt option is currently supported.
226226+227227+.. sectionauthor:: Pantelis Antoniou <pantelis.antoniou@konsulko.com>, 12/6/2017