uboot overlays, FIT image & unittest
v3 cover uboot overlays, FIT image & unittest
This patchset allows uboot to handle overlays in a manner that uses a base DT blob and an arbitrary number of DT overlays blobs.
While it is intended to be used with FIT images since handling a multitude of device tree blobs manually is a chore, manual fdt overlay application is supported and described.
Changes since v2:
* Addressed review comments by splitting patches and documenting methods.
* Patch preserving extra configuration on fit-load
The patchset is available at
https://github.com/pantoniou/u-boot/tree/uboot-overlays
and is against mainline u-boot as pulled today, 4/9/2017.
Franklin S Cooper Jr (1):
doc: overlays: Tweak documentation regarding overlays
Pantelis Antoniou (13):
Introduce fdt_setprop_placeholder() method
fdt: Introduce helper method fdt_overlay_apply_verbose()
fdt: Switch to using the verbose overlay application method
fdt: Allow stacked overlays phandle references
fit: Allow multiple images per property
fit: Do not throw away extra configuration on fit_image_load()
fit: Introduce methods for applying overlays on fit-load
fit: fdt overlays doc
doc: Document how to apply fdt overlays
dtbo: make dtbos special
config: sandbox: Add unit tests
ut: fix fdt_getprop_u32() change
test: overlay: Add unit test for stacked overlay
cmd/fdt.c | 7 +- common/fdt_support.c | 31 ++++ common/image-fdt.c | 7 +- common/image-fit.c | 210 ++++++++++++++++++++++-- configs/sandbox_defconfig | 2 + doc/README.fdt-overlays | 114 ++++++++++++++ doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 225 ++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- include/fdt_support.h | 2 + include/image.h | 25 +++ lib/libfdt/fdt_overlay.c | 228 ++++++++++++++++++++++++--- lib/libfdt/fdt_rw.c | 20 ++- lib/libfdt/libfdt.h | 31 ++++ scripts/Makefile.lib | 17 ++ test/overlay/Makefile | 1 + test/overlay/cmd_ut_overlay.c | 50 ++++-- test/overlay/test-fdt-overlay-stacked.dts | 21 +++ 18 files changed, 953 insertions(+), 56 deletions(-) create mode 100644 doc/README.fdt-overlays create mode 100644 doc/uImage.FIT/overlay-fdt-boot.txt create mode 100644 test/overlay/test-fdt-overlay-stacked.dts
Signature · 1 line
2.1.4
PATCH v3 1/14 Introduce fdt_setprop_placeholder() method
In some cases you need to add a property but the contents of it are not known at creation time, merely the extend of it.
This method allows you to create a property of a given size (filled with garbage) while a pointer to the property data will be provided.
--- lib/libfdt/fdt_rw.c | 20 +++++++++++++++++--- lib/libfdt/libfdt.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-)
lib/libfdt/fdt_rw.c +17 -3
@@ -228,8 +228,8 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name)return 0 ; } -int fdt_setprop (void *fdt,int nodeoffset,const char *name, -const void *val,int len) +int fdt_setprop_placeholder (void *fdt,int nodeoffset,const char *name, +int len,void **prop_data) {struct fdt_property *prop;int err;
@@ -242,8 +242,22 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,if (err)return err; + *prop_data = prop->data; +return 0 ; +} + +int fdt_setprop (void *fdt,int nodeoffset,const char *name, +const void *val,int len) +{ +void *prop_data; +int err; + + err =fdt_setprop_placeholder (fdt, nodeoffset, name, len, &prop_data); +if (err) +return err; +if (len) -memcpy (prop->data, val, len); +memcpy (prop_data, val, len);return 0 ; }
lib/libfdt/libfdt.h +31 -0
@@ -1405,6 +1405,37 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, const void *val, int len);/** +* fdt_setprop _placeholder - allocate space for a property +* @fdt: pointer to the device tree blob +* @nodeoffset: offset of the node whose property to change +* @name: name of the property to change +* @len: length of the property value +* @prop_data: return pointer to property data +* +* fdt_setprop_placeholer() allocates the named property in the given node. +* If the property exists it is resized. In either case a pointer to the +* property data is returned. +* +* This function may insert or delete data from the blob, and will +* therefore change the offsets of some existing nodes. +* +* returns: +* 0, on success +* -FDT_ERR_NOSPACE, there is insufficient free space in the blob to +* contain the new property value +* -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag +* -FDT_ERR_BADLAYOUT, +* -FDT_ERR_BADMAGIC, +* -FDT_ERR_BADVERSION, +* -FDT_ERR_BADSTATE, +* -FDT_ERR_BADSTRUCTURE, +* -FDT_ERR_BADLAYOUT, +* -FDT_ERR_TRUNCATED, standard meanings +*/ +int fdt_setprop_placeholder (void *fdt,int nodeoffset,const char *name, +int len,void **prop_data); + +/** * fdt_setprop_u32 - set a property to a 32-bit integer * @fdt: pointer to the device tree blob * @nodeoffset: offset of the node whose property to change
Signature · 1 line
2.1.4
PATCH v3 1/14 Introduce fdt_setprop_placeholder() method
Quoted 6 lines · Pantelis Antoniou
In some cases you need to add a property but the contents of it are not known at creation time, merely the extend of it.
This method allows you to create a property of a given size (filled with garbage) while a pointer to the property data will be provided.
Quoted 7 lines
Signed-off-by Pantelis Antoniou <[email protected]>[dwg: Corrected commit message]Signed-off-by David Gibson <[email protected]>--- lib/libfdt/fdt_rw.c | 20 +++++++++++++++++--- lib/libfdt/libfdt.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-)
PATCH v3 1/14 Introduce fdt_setprop_placeholder() method
Quoted 6 lines · Pantelis Antoniou
In some cases you need to add a property but the contents of it are not known at creation time, merely the extend of it.
This method allows you to create a property of a given size (filled with garbage) while a pointer to the property data will be provided.
Quoted 7 lines
Signed-off-by Pantelis Antoniou <[email protected]>[dwg: Corrected commit message]Signed-off-by David Gibson <[email protected]>--- lib/libfdt/fdt_rw.c | 20 +++++++++++++++++--- lib/libfdt/libfdt.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-)
Applied to u-boot-fdt thanks!
PATCH v3 2/14 fdt: Introduce helper method fdt_overlay_apply_verbose()
In reply to Pantelis AntoniouIntroduce fdt_overlay_apply_verbose, a method that applies an overlay but in the case of an error produces a helpful message.
In addition if a base tree is found to be missing the __symbols__ node the message will point out that the probable reason is that the base tree was miscompiled without the -@ option.
--- common/fdt_support.c | 31 +++++++++++++++++++++++++++++++ include/fdt_support.h | 2 ++ 2 files changed, 33 insertions(+)
common/fdt_support.c +31 -0
@@ -1655,3 +1655,34 @@ int fdt_fixup_display(void *blob, const char *path, const char *display) }return toff; } + +#ifdef CONFIG_OF_LIBFDT_OVERLAY +/** +* fdt_overlay_apply_verbose - Apply an overlay with verbose error reporting +* +* @fdt: ptr to device tree +* @fdto: ptr to device tree overlay +* +* Convenience function to apply an overlay and display helpful messages +* in the case of an error +*/ +int fdt_overlay_apply_verbose (void *fdt,void *fdto) +{ +int err; +bool has_symbols; + + err =fdt_path_offset (fdt,"/__symbols__" ); + has_symbols = err >=0 ; + + err =fdt_overlay_apply (fdt, fdto); +if (err <0 ) { +printf ("failed on fdt_overlay_apply(): %s\n" , +fdt_strerror (err)); +if (!has_symbols) { +printf ("base fdt does did not have a /__symbols__ node\n" ); +printf ("make sure you've compiled with -@\n" ); + } + } +return err; +} +#endif
include/fdt_support.h +2 -0
@@ -264,6 +264,8 @@ int arch_fixup_memory_node(void *blob);int fdt_setup_simplefb_node (void *fdt,int node,u64 base_address,u32 width,u32 height,u32 stride,const char *format); +int fdt_overlay_apply_verbose (void *fdt,void *fdto); +#endif /* ifdef CONFIG_OF_LIBFDT */ #ifdef USE_HOSTCC
Signature · 1 line
2.1.4
PATCH v3 2/14 fdt: Introduce helper method fdt_overlay_apply_verbose()
Quoted 7 lines · Pantelis Antoniou
Introduce
fdt_overlay_apply_verbose, a method that applies an overlay but in the case of an error produces a helpful message.In addition if a base tree is found to be missing the
__symbols__node the message will point out that the probable reason is that the base tree was miscompiled without the -@ option.
Quoted 5 lines
Signed-off-by Pantelis Antoniou <[email protected]>--- common/fdt_support.c | 31 +++++++++++++++++++++++++++++++ include/fdt_support.h | 2 ++ 2 files changed, 33 insertions(+)
BTW I'd prefer to have the function comments in the header, but this file is mixed, so OK.
PATCH v3 2/14 fdt: Introduce helper method fdt_overlay_apply_verbose()
Quoted 7 lines · Pantelis Antoniou
Introduce
fdt_overlay_apply_verbose, a method that applies an overlay but in the case of an error produces a helpful message.In addition if a base tree is found to be missing the
__symbols__node the message will point out that the probable reason is that the base tree was miscompiled without the -@ option.
Quoted 5 lines
Signed-off-by Pantelis Antoniou <[email protected]>--- common/fdt_support.c | 31 +++++++++++++++++++++++++++++++ include/fdt_support.h | 2 ++ 2 files changed, 33 insertions(+)
BTW I'd prefer to have the function comments in the header, but this file is mixed, so OK.
Applied to u-boot-fdt thanks!
PATCH v3 3/14 fdt: Switch to using the verbose overlay application method
In reply to Pantelis AntoniouThe verbose overlay application method prints out more helpful messages, so switch to it.
--- cmd/fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
cmd/fdt.c +3 -4
@@ -669,11 +669,10 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (!fdt_valid (&blob))return CMD_RET_FAILURE ; - ret =fdt_overlay_apply (working_fdt, blob); -if (ret) { -printf ("fdt_overlay_apply(): %s\n" ,fdt_strerror (ret)); +/* apply method prints messages on error */ + ret =fdt_overlay_apply_verbose (working_fdt, blob); +if (ret) return CMD_RET_FAILURE; - } }#endif /* resize the fdt */
Signature · 1 line
2.1.4
PATCH v3 3/14 fdt: Switch to using the verbose overlay application method
Quoted 7 lines · Pantelis Antoniou
The verbose overlay application method prints out more helpful messages, so switch to it.
Signed-off-by Pantelis Antoniou <[email protected]>--- cmd/fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
PATCH v3 3/14 fdt: Switch to using the verbose overlay application method
Quoted 11 lines · Simon Glass
Quoted 7 lines · Pantelis Antoniou
The verbose overlay application method prints out more helpful messages, so switch to it.
Signed-off-by Pantelis Antoniou <[email protected]>--- cmd/fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)Acked-by Simon Glass <[email protected]>
Applied to u-boot-fdt, thanks!
PATCH v3 4/14 fdt: Allow stacked overlays phandle references
In reply to Pantelis AntoniouThis patch enables an overlay to refer to a previous overlay's labels by performing a merge of symbol information at application time.
In a nutshell it allows an overlay to refer to a symbol that a previous overlay has defined. It requires both the base and all the overlays to be compiled with the -@ command line switch so that symbol information is included.
base.dts
--------
/dts-v1/;
/ {
foo: foonode {
foo-property;
};
};
$ dtc -@ -I dts -O dtb -o base.dtb base.dtsbar.dts
-------
/dts-v1/;
/plugin/;
/ {
fragment at 1 {
target = <&foo>;
__overlay__ {
overlay-1-property;
bar: barnode {
bar-property;
};
};
};
};
$ dtc -@ -I dts -O dtb -o bar.dtb bar.dtsbaz.dts
-------
/dts-v1/;
/plugin/;
/ {
fragment at 1 {
target = <&bar>;
__overlay__ {
overlay-2-property;
baz: baznode {
baz-property;
};
};
};
};
$ dtc -@ -I dts -O dtb -o baz.dtb baz.dtsApplying the overlays:
$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb
Dumping:
$ fdtdump target.dtb
/ {
foonode {
overlay-1-property;
foo-property;
linux,phandle = <0x00000001>;
phandle = <0x00000001>;
barnode {
overlay-2-property;
phandle = <0x00000002>;
linux,phandle = <0x00000002>;
bar-property;
baznode {
phandle = <0x00000003>;
linux,phandle = <0x00000003>;
baz-property;
};
};
};
__symbols__ {
baz = "/foonode/barnode/baznode";
bar = "/foonode/barnode";
foo = "/foonode";
};
};--- lib/libfdt/fdt_overlay.c | 228 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 206 insertions(+), 22 deletions(-)
lib/libfdt/fdt_overlay.c +206 -22
@@ -39,6 +39,7 @@ static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)* @fdt: Base device tree blob * @fdto: Device tree overlay blob * @fragment: node offset of the fragment in the overlay +* @pathp: pointer which receives the path of the target (or NULL) * * overlay_get_target() retrieves the target offset in the base * device tree of a fragment, no matter how the actual targetting is
@@ -49,37 +50,47 @@ static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)* Negative error code on error */ static int overlay_get_target (const void *fdt,const void *fdto, -int fragment) +int fragment,char const **pathp) {uint32_t phandle; -const char *path; -int path_len; +const char *path =NULL ; +int path_len =0 , ret;/* Try first to do a phandle based lookup */ phandle =overlay_get_target_phandle (fdto, fragment);if (phandle == (uint32_t )-1 )return -FDT_ERR_BADPHANDLE ; -if (phandle) -return fdt_node_offset_by_phandle (fdt, phandle); +/* no phandle, try path */ +if (!phandle) { +/* And then a path based lookup */ + path =fdt_getprop (fdto, fragment,"target-path" , &path_len); +if (path) + ret =fdt_path_offset (fdt, path); +else + ret = path_len; + }else + ret =fdt_node_offset_by_phandle (fdt, phandle); -/* And then a path based lookup */ - path =fdt_getprop (fdto, fragment,"target-path" , &path_len); -if (!path) { -/* -* If we haven't found either a target or a -* target-path property in a node that contains a -* __overlay__ subnode (we wouldn't be called -* otherwise), consider it a improperly written -* overlay -*/ -if (path_len == -FDT_ERR_NOTFOUND ) -return -FDT_ERR_BADOVERLAY ; +/* +* If we haven't found either a target or a +* target-path property in a node that contains a +* __overlay__ subnode (we wouldn't be called +* otherwise), consider it a improperly written +* overlay +*/ +if (ret <0 && path_len == -FDT_ERR_NOTFOUND ) + ret = -FDT_ERR_BADOVERLAY ; + +/* return on error */ +if (ret <0 ) +return ret; -return path_len; - } +/* return pointer to path (if available) */ +if (pathp) + *pathp = path ? path :NULL ; -return fdt_path_offset (fdt, path); +return ret; }/**
@@ -590,7 +601,7 @@ static int overlay_apply_node(void *fdt, int target,* * overlay_merge() merges an overlay into its base device tree. * -* This is the final step in the device tree overlay application +* This is the next to last step in the device tree overlay application * process, when all the phandles have been adjusted and resolved and * you just have to merge overlay into the base device tree. *
@@ -618,7 +629,7 @@ static int overlay_merge(void *fdt, void *fdto)if (overlay <0 )return overlay; - target =overlay_get_target (fdt, fdto, fragment); + target =overlay_get_target (fdt, fdto, fragment,NULL );if (target <0 )return target;
@@ -630,6 +641,175 @@ static int overlay_merge(void *fdt, void *fdto)return 0 ; } +static int get_path_len (const void *fdt,int nodeoffset) +{ +int len =0 , namelen; +const char *name; + +FDT_CHECK_HEADER (fdt); + +for (;;) { + name =fdt_get_name (fdt, nodeoffset, &namelen); +if (!name) +return namelen; + +/* root? we're done */ +if (namelen ==0 ) +break ; + + nodeoffset =fdt_parent_offset (fdt, nodeoffset); +if (nodeoffset <0 ) +return nodeoffset; + len += namelen +1 ; + } + +/* in case of root pretend it's "/" */ +if (len ==0 ) + len++; +return len; +} + +/** +* overlay_symbol_update - Update the symbols of base tree after a merge +* @fdt: Base Device Tree blob +* @fdto: Device tree overlay blob +* +* overlay_symbol_update() updates the symbols of the base tree with the +* symbols of the applied overlay +* +* This is the last step in the device tree overlay application +* process, allowing the reference of overlay symbols by subsequent +* overlay operations. +* +* returns: +* 0 on success +* Negative error code on failure +*/ +static int overlay_symbol_update (void *fdt,void *fdto) +{ +int root_sym, ov_sym, prop, path_len, fragment, target; +int len, frag_name_len, ret, rel_path_len; +const char *s, *e; +const char *path; +const char *name; +const char *frag_name; +const char *rel_path; +const char *target_path; +char *buf; +void *p; + + ov_sym =fdt_subnode_offset (fdto,0 ,"__symbols__" ); + +/* if no overlay symbols exist no problem */ +if (ov_sym <0 ) +return 0 ; + + root_sym =fdt_subnode_offset (fdt,0 ,"__symbols__" ); + +/* it no root symbols exist we should create them */ +if (root_sym == -FDT_ERR_NOTFOUND ) + root_sym =fdt_add_subnode (fdt,0 ,"__symbols__" ); + +/* any error is fatal now */ +if (root_sym <0 ) +return root_sym; + +/* iterate over each overlay symbol */ +fdt_for_each_property_offset (prop, fdto, ov_sym) { + path =fdt_getprop_by_offset (fdto, prop, &name, &path_len); +if (!path) +return path_len; + +/* verify it's a string property (terminated by a single \0) */ +if (path_len <1 ||memchr (path,'\0' , path_len) != &path[path_len -1 ]) +return -FDT_ERR_BADVALUE ; + +/* keep end marker to avoid strlen() */ + e = path + path_len; + +/* format: /<fragment-name>/__overlay__/<relative-subnode-path> */ + +if (*path !='/' ) +return -FDT_ERR_BADVALUE ; + +/* get fragment name first */ + s =strchr (path +1 ,'/' ); +if (!s) +return -FDT_ERR_BADOVERLAY ; + + frag_name = path +1 ; + frag_name_len = s - path -1 ; + +/* verify format; safe since "s" lies in \0 terminated prop */ + len =sizeof ("/__overlay__/" ) -1 ; +if ((e - s) < len ||memcmp (s,"/__overlay__/" , len)) +return -FDT_ERR_BADOVERLAY ; + + rel_path = s + len; + rel_path_len = e - rel_path; + +/* find the fragment index in which the symbol lies */ + ret =fdt_subnode_offset_namelen (fdto,0 , frag_name, + frag_name_len); +/* not found? */ +if (ret <0 ) +return -FDT_ERR_BADOVERLAY ; + fragment = ret; + +/* an __overlay__ subnode must exist */ + ret =fdt_subnode_offset (fdto, fragment,"__overlay__" ); +if (ret <0 ) +return -FDT_ERR_BADOVERLAY ; + +/* get the target of the fragment */ + ret =overlay_get_target (fdt, fdto, fragment, &target_path); +if (ret <0 ) +return ret; + target = ret; + +/* if we have a target path use */ +if (!target_path) { + ret =get_path_len (fdt, target); +if (ret <0 ) +return ret; + len = ret; + }else { + len =strlen (target_path); + } + + ret =fdt_setprop_placeholder (fdt, root_sym, name, + len + (len >1 ) + rel_path_len +1 , &p); +if (ret <0 ) +return ret; + +if (!target_path) { +/* again in case setprop_placeholder changed it */ + ret =overlay_get_target (fdt, fdto, fragment, &target_path); +if (ret <0 ) +return ret; + target = ret; + } + + buf = p; +if (len >1 ) {/* target is not root */ +if (!target_path) { + ret =fdt_get_path (fdt, target, buf, len +1 ); +if (ret <0 ) +return ret; + }else +memcpy (buf, target_path, len +1 ); + + }else + len--; + + buf[len] ='/' ; +memcpy (buf + len +1 , rel_path, rel_path_len); + buf[len +1 + rel_path_len] ='\0' ; + } + +return 0 ; +} +int fdt_overlay_apply (void *fdt,void *fdto) {uint32_t delta =fdt_get_max_phandle (fdt);
@@ -654,6 +834,10 @@ int fdt_overlay_apply(void *fdt, void *fdto)if (ret) goto err; + ret =overlay_symbol_update (fdt, fdto); +if (ret) + goto err; +/* * The overlay has been damaged, erase its magic. */
Signature · 1 line
2.1.4
PATCH v3 4/14 fdt: Allow stacked overlays phandle references
Quoted 91 lines · Pantelis Antoniou
This patch enables an overlay to refer to a previous overlay's labels by performing a merge of symbol information at application time.
In a nutshell it allows an overlay to refer to a symbol that a previous overlay has defined. It requires both the base and all the overlays to be compiled with the -@ command line switch so that symbol information is included.
base.dts
--------/dts-v1/; / { foo: foonode { foo-property; }; }; $ dtc -@ -I dts -O dtb -o base.dtb base.dts
bar.dts
-------/dts-v1/; /plugin/; / { fragment at 1 { target = <&foo>; __overlay__ { overlay-1-property; bar: barnode { bar-property; }; }; }; }; $ dtc -@ -I dts -O dtb -o bar.dtb bar.dts
baz.dts
-------/dts-v1/; /plugin/; / { fragment at 1 { target = <&bar>; __overlay__ { overlay-2-property; baz: baznode { baz-property; }; }; }; }; $ dtc -@ -I dts -O dtb -o baz.dtb baz.dtsApplying the overlays:
$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtbDumping:
$ fdtdump target.dtb / { foonode { overlay-1-property; foo-property; linux,phandle = <0x00000001>; phandle = <0x00000001>; barnode { overlay-2-property; phandle = <0x00000002>; linux,phandle = <0x00000002>; bar-property; baznode { phandle = <0x00000003>; linux,phandle = <0x00000003>; baz-property; }; }; }; __symbols__ { baz = "/foonode/barnode/baznode"; bar = "/foonode/barnode"; foo = "/foonode"; }; };
Quoted 6 lines
Signed-off-by Pantelis Antoniou <[email protected]>Signed-off-by David Gibson <[email protected]>--- lib/libfdt/fdt_overlay.c | 228 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 206 insertions(+), 22 deletions(-)
PATCH v3 4/14 fdt: Allow stacked overlays phandle references
Quoted 91 lines · Pantelis Antoniou
This patch enables an overlay to refer to a previous overlay's labels by performing a merge of symbol information at application time.
In a nutshell it allows an overlay to refer to a symbol that a previous overlay has defined. It requires both the base and all the overlays to be compiled with the -@ command line switch so that symbol information is included.
base.dts
--------/dts-v1/; / { foo: foonode { foo-property; }; }; $ dtc -@ -I dts -O dtb -o base.dtb base.dts
bar.dts
-------/dts-v1/; /plugin/; / { fragment at 1 { target = <&foo>; __overlay__ { overlay-1-property; bar: barnode { bar-property; }; }; }; }; $ dtc -@ -I dts -O dtb -o bar.dtb bar.dts
baz.dts
-------/dts-v1/; /plugin/; / { fragment at 1 { target = <&bar>; __overlay__ { overlay-2-property; baz: baznode { baz-property; }; }; }; }; $ dtc -@ -I dts -O dtb -o baz.dtb baz.dtsApplying the overlays:
$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtbDumping:
$ fdtdump target.dtb / { foonode { overlay-1-property; foo-property; linux,phandle = <0x00000001>; phandle = <0x00000001>; barnode { overlay-2-property; phandle = <0x00000002>; linux,phandle = <0x00000002>; bar-property; baznode { phandle = <0x00000003>; linux,phandle = <0x00000003>; baz-property; }; }; }; __symbols__ { baz = "/foonode/barnode/baznode"; bar = "/foonode/barnode"; foo = "/foonode"; }; };
Quoted 6 lines
Signed-off-by Pantelis Antoniou <[email protected]>Signed-off-by David Gibson <[email protected]>--- lib/libfdt/fdt_overlay.c | 228 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 206 insertions(+), 22 deletions(-)
Applied to u-boot-fdt thanks!
PATCH v3 5/14 fit: Allow multiple images per property
In reply to Pantelis AntoniouAs part of the fdt overlay support which need it, allow a list of configurations per property.
--- common/image-fit.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
common/image-fit.c +15 -3
@@ -1484,20 +1484,32 @@ int fit_conf_get_node(const void *fit, const char *conf_uname)return noffset; } -int fit_conf_get_prop_node (const void *fit,int noffset, +int fit_conf_get_prop_node_count (const void *fit,int noffset,const char *prop_name) { -char *uname; +return fdt_stringlist_count (fit, noffset, prop_name); +} + +int fit_conf_get_prop_node_index (const void *fit,int noffset, +const char *prop_name,int index) +{ +const char *uname;int len;/* get kernel image unit name from configuration kernel property */ - uname = (char *)fdt_getprop (fit, noffset, prop_name, &len); + uname =fdt_stringlist_get (fit, noffset, prop_name, index, &len);if (uname ==NULL )return len;return fit_image_get_node (fit, uname); } +int fit_conf_get_prop_node (const void *fit,int noffset, +const char *prop_name) +{ +return fit_conf_get_prop_node_index (fit, noffset, prop_name,0 ); +} +/** * fit_conf_print - prints out the FIT configuration details * @fit: pointer to the FIT format image header
Signature · 1 line
2.1.4
PATCH v3 5/14 fit: Allow multiple images per property
Quoted 7 lines · Pantelis Antoniou
As part of the fdt overlay support which need it, allow a list of configurations per property.
Signed-off-by Pantelis Antoniou <[email protected]>--- common/image-fit.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
PATCH v3 5/14 fit: Allow multiple images per property
Quoted 7 lines · Pantelis Antoniou
As part of the fdt overlay support which need it, allow a list of configurations per property.
Signed-off-by Pantelis Antoniou <[email protected]>--- common/image-fit.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
Applied to u-boot-fdt thanks!
PATCH v3 6/14 fit: Do not throw away extra configuration on fit_image_load()
In reply to Pantelis Antonioufit_image_load() threw away the extra configuration parts when loading. We need them around for applying extra overlays for building the boot fdt.
--- common/image-fit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
common/image-fit.c +7 -4
@@ -1653,6 +1653,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,int cfg_noffset, noffset;const char *fit_uname;const char *fit_uname_config; +const char *fit_base_uname_config;const void *fit;const void *buf;size_t size;
@@ -1668,6 +1669,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr, fit =map_sysmem (addr,0 ); fit_uname = fit_unamep ? *fit_unamep :NULL ; fit_uname_config = fit_uname_configp ? *fit_uname_configp :NULL ; + fit_base_uname_config =NULL ; prop_name =fit_get_image_type_property (image_type);printf ("## Loading %s from FIT Image at %08lx ...\n" , prop_name, addr);
@@ -1701,11 +1703,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr, BOOTSTAGE_SUB_NO_UNIT_NAME);return -ENOENT ; } - fit_uname_config =fdt_get_name (fit, cfg_noffset,NULL ); -printf (" Using '%s' configuration\n" , fit_uname_config); + fit_base_uname_config =fdt_get_name (fit, cfg_noffset,NULL ); +printf (" Using '%s' configuration\n" , fit_base_uname_config);if (image_type ==IH_TYPE_KERNEL ) {/* Remember (and possibly verify) this config */ - images->fit_uname_cfg = fit_uname_config; + images->fit_uname_cfg = fit_base_uname_config;if (IMAGE_ENABLE_VERIFY && images->verify) {puts (" Verifying Hash Integrity ... " );if (fit_config_verify (fit, cfg_noffset)) {
@@ -1861,7 +1863,8 @@ int fit_image_load(bootm_headers_t *images, ulong addr,if (fit_unamep) *fit_unamep = (char *)fit_uname;if (fit_uname_configp) - *fit_uname_configp = (char *)fit_uname_config; + *fit_uname_configp = (char *)(fit_uname_config ? : + fit_base_uname_config);return noffset; }
Signature · 1 line
2.1.4
PATCH v3 6/14 fit: Do not throw away extra configuration on fit_image_load()
Hi,
Quoted 8 lines · Pantelis Antoniou
fit_image_load()threw away the extra configuration parts when loading. We need them around for applying extra overlays for building the boot fdt.Signed-off-by Pantelis Antoniou <[email protected]>--- common/image-fit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Quoted 37 lines
common/image-fit.c +5
-3@@ -1653,6 +1653,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,int cfg_noffset, noffset;const char *fit_uname;const char *fit_uname_config; +const char *fit_base_uname_config;const void *fit;const void *buf;size_t size;@@ -1668,6 +1669,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr, fit =map_sysmem (addr,0 ); fit_uname = fit_unamep ? *fit_unamep :NULL ; fit_uname_config = fit_uname_configp ? *fit_uname_configp :NULL ; + fit_base_uname_config =NULL ; prop_name =fit_get_image_type_property (image_type);printf ("## Loading %s from FIT Image at %08lx ...\n" , prop_name, addr);@@ -1701,11 +1703,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr, BOOTSTAGE_SUB_NO_UNIT_NAME);return -ENOENT ; } - fit_uname_config =fdt_get_name (fit, cfg_noffset,NULL ); -printf (" Using '%s' configuration\n" , fit_uname_config); + fit_base_uname_config =fdt_get_name (fit, cfg_noffset,NULL ); +printf (" Using '%s' configuration\n" , fit_base_uname_config);if (image_type ==IH_TYPE_KERNEL ) {/* Remember (and possibly verify) this config */ - images->fit_uname_cfg = fit_uname_config; + images->fit_uname_cfg = fit_base_uname_config;if (IMAGE_ENABLE_VERIFY && images->verify) {puts (" Verifying Hash Integrity ... " );if (fit_config_verify (fit, cfg_noffset)) {
common/image-fit.c int fit_image_load(bootm_headers_t *images, ulong addr, · line 1867
Quoted 6 lines
common/image-fit.c +2
-1@@ -1861,7 +1863,8 @@ int fit_image_load(bootm_headers_t *images, ulong addr,if (fit_unamep) *fit_unamep = (char *)fit_uname;if (fit_uname_configp) - *fit_uname_configp = (char *)fit_uname_config; + *fit_uname_configp = (char *)(fit_uname_config ? : + fit_base_uname_config);
I just learned something I didn't know about C.
Quoted 6 lines
common/image-fit.c +0
-1return noffset; } --2.1.4
PATCH v3 6/14 fit: Do not throw away extra configuration on fit_image_load()
Hi,
Quoted 8 lines · Pantelis Antoniou
fit_image_load()threw away the extra configuration parts when loading. We need them around for applying extra overlays for building the boot fdt.Signed-off-by Pantelis Antoniou <[email protected]>--- common/image-fit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Quoted 1 line
Applied to u-boot-fdt thanks!
PATCH v3 7/14 fit: Introduce methods for applying overlays on fit-load
In reply to Pantelis AntoniouIntroduce an overlay based method for constructing a base DT blob to pass to the kernel.
It is based on a specific method now to get the FDT from a FIT image named boot_get_fdt_fit().
--- common/image-fdt.c | 7 +-- common/image-fit.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++-- include/image.h | 25 ++++++++ 3 files changed, 205 insertions(+), 8 deletions(-)
common/image-fdt.c +3 -4
@@ -356,17 +356,16 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,if (fit_check_format (buf)) {ulong load, len; - fdt_noffset =fit_image_load (images, + fdt_noffset =boot_get_fdt_fit (images, fdt_addr, &fit_uname_fdt, &fit_uname_config, - arch,IH_TYPE_FLATDT , -BOOTSTAGE_ID_FIT_FDT_START , -FIT_LOAD_OPTIONAL , &load, &len); + arch, &load, &len); images->fit_hdr_fdt =map_sysmem (fdt_addr,0 ); images->fit_uname_fdt = fit_uname_fdt; images->fit_noffset_fdt = fdt_noffset; fdt_addr = load; +break ; } else#endif
common/image-fit.c +177 -4
226 lines not on this page · raw message
include/image.h +25 -0
@@ -593,6 +593,31 @@ int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch, ulong *setup_start, ulong *setup_len);/** +* boot_get_fdt_fit() - load a DTB from a FIT file (applying overlays) +* +* This deals with all aspects of loading an DTB from a FIT. +* The correct base image based on configuration will be selected, and +* then any overlays specified will be applied (as present in fit_uname_configp). +* +* @param images Boot images structure +* @param addr Address of FIT in memory +* @param fit_unamep On entry this is the requested image name +* (e.g. "kernel at 1") or NULL to use the default. On exit +* points to the selected image name +* @param fit_uname_configp On entry this is the requested configuration +* name (e.g. "conf@1") or NULL to use the default. On +* exit points to the selected configuration name. +* @param arch Expected architecture (IH_ARCH_...) +* @param datap Returns address of loaded image +* @param lenp Returns length of loaded image +* +* @return node offset of base image, or -ve error code on error +*/ +int boot_get_fdt_fit (bootm_headers_t *images,ulong addr, +const char **fit_unamep,const char **fit_uname_configp, +int arch,ulong *datap,ulong *lenp); + +/** * fit_image_load() - load an image from a FIT * * This deals with all aspects of loading an image from a FIT, including
Signature · 1 line
2.1.4
PATCH v3 7/14 fit: Introduce methods for applying overlays on fit-load
Quoted 6 lines · Pantelis Antoniou
Introduce an overlay based method for constructing a base DT blob to pass to the kernel.
It is based on a specific method now to get the FDT from a FIT image named
boot_get_fdt_fit().
Quoted 6 lines
Signed-off-by Pantelis Antoniou <[email protected]>--- common/image-fdt.c | 7 +-- common/image-fit.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++-- include/image.h | 25 ++++++++ 3 files changed, 205 insertions(+), 8 deletions(-)
I wonder if you can use if (IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)) instead of #if ?
PATCH v3 7/14 fit: Introduce methods for applying overlays on fit-load
Quoted 6 lines · Pantelis Antoniou
Introduce an overlay based method for constructing a base DT blob to pass to the kernel.
It is based on a specific method now to get the FDT from a FIT image named
boot_get_fdt_fit().
Quoted 6 lines
Signed-off-by Pantelis Antoniou <[email protected]>--- common/image-fdt.c | 7 +-- common/image-fit.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++-- include/image.h | 25 ++++++++ 3 files changed, 205 insertions(+), 8 deletions(-)
I wonder if you can use if (IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)) instead of #if ?
Applied to u-boot-fdt thanks!
PATCH v3 8/14 fit: fdt overlays doc
In reply to Pantelis Antoniou--- doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 221 +++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- 3 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 doc/uImage.FIT/overlay-fdt-boot.txt
doc/uImage.FIT/command_syntax_extensions.txt +11 -1
@@ -36,7 +36,7 @@ Old uImage: New uImage: 8. bootm <addr1> 9. bootm [<addr1>]:<subimg1> -10. bootm [<addr1>]#<conf> +10. bootm [<addr1>]#<conf>[#<extra-conf[#...]] 11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> 12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3> 13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>
@@ -129,6 +129,12 @@ following syntax: - new uImage configuration specification <addr>#<configuration unit_name> +- new uImage configuration specification with extra configuration components +<addr>#<configuration unit_name>[#<extra configuration unit_name>[#..]] + +The extra configuration currently is supported only for additional device tree +overlays to apply on the base device tree supplied by the first configuration +unit. Examples:
@@ -138,6 +144,10 @@ bootm 200000:kernel at 1 - boot configuration "cfg at 1" from a new uImage located at 200000: bootm 200000#cfg at 1 +- boot configuration "cfg at 1" with extra "cfg at 2" from a new uImage located + at 200000: +bootm 200000#cfg at 1#cfg at 2 + - boot "kernel at 1" from a new uImage at 200000 with initrd "ramdisk at 2" found in some other new uImage stored at address 800000: bootm 200000:kernel at 1 800000:ramdisk at 2
doc/uImage.FIT/overlay-fdt-boot.txt new file +221 -0
221 lines not on this page · raw message
doc/uImage.FIT/source_file_format.txt +4 -2
@@ -235,7 +235,7 @@ o config at 1 |- description = "configuration description" |- kernel = "kernel sub-node unit name" |- ramdisk = "ramdisk sub-node unit name" - |- fdt = "fdt sub-node unit-name" + |- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...] |- fpga = "fpga sub-node unit-name" |- loadables = "loadables sub-node unit-name"
@@ -249,7 +249,9 @@ o config at 1 - ramdisk : Unit name of the corresponding ramdisk image (component image node of a "ramdisk" type). - fdt : Unit name of the corresponding fdt blob (component image node of a - "fdt type"). + "fdt type"). Additional fdt overlay nodes can be supplied which signify + that the resulting device tree blob is generated by the first base fdt + blob with all subsequent overlays applied. - setup : Unit name of the corresponding setup binary (used for booting an x86 kernel). This contains the setup.bin file built by the kernel. - fpga : Unit name of the corresponding fpga bitstream blob
Signature · 1 line
2.1.4
PATCH v3 8/14 fit: fdt overlays doc
Quoted 287 lines · Pantelis Antoniou
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 221 +++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- 3 files changed, 236 insertions(+), 3 deletions(-)create mode 100644
doc/uImage.FIT/overlay-fdt-boot.txtdoc/uImage.FIT/command_syntax_extensions.txt +11
-1@@ -36,7 +36,7 @@ Old uImage: New uImage: 8. bootm <addr1> 9. bootm [<addr1>]:<subimg1> -10. bootm [<addr1>]#<conf> +10. bootm [<addr1>]#<conf>[#<extra-conf[#...]] 11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> 12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3> 13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>@@ -129,6 +129,12 @@ following syntax: - new uImage configuration specification <addr>#<configuration unit_name> +- new uImage configuration specification with extra configuration components +<addr>#<configuration unit_name>[#<extra configuration unit_name>[#..]] + +The extra configuration currently is supported only for additional device tree +overlays to apply on the base device tree supplied by the first configuration +unit. Examples:@@ -138,6 +144,10 @@ bootm 200000:kernel at 1 - boot configuration "cfg at 1" from a new uImage located at 200000: bootm 200000#cfg at 1 +- boot configuration "cfg at 1" with extra "cfg at 2" from a new uImage located + at 200000: +bootm 200000#cfg at 1#cfg at 2 + - boot "kernel at 1" from a new uImage at 200000 with initrd "ramdisk at 2" found in some other new uImage stored at address 800000: bootm 200000:kernel at 1 800000:ramdisk at 2doc/uImage.FIT/overlay-fdt-boot.txt new file +221
-0@@ -0,0 +1,221 @@ +U-Boot FDT Overlay usage +======================== + +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. + +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 { + kernel at 1 { + data = /incbin/("./zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + load = <0x82000000>; + entry = <0x82000000>; + }; + fdt at 1 { + data = /incbin/("./foo-reva.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 2 { + data = /incbin/("./foo-revb.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 3 { + data = /incbin/("./foo-reva-bar.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 4 { + data = /incbin/("./foo-revb-bar.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 5 { + data = /incbin/("./foo-revb-baz.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 6 { + data = /incbin/("./foo-revb-bar-baz.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + }; + + configurations { + default = "foo-reva.dtb; + foo-reva.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1"; + }; + foo-revb.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 2"; + }; + foo-reva-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 3"; + }; + foo-revb-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 4"; + }; + foo-revb-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 5"; + }; + foo-revb-bar-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 6"; + }; + }; + }; + +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 { + kernel at 1 { + data = /incbin/("./zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + load = <0x82000000>; + entry = <0x82000000>; + }; + fdt at 1 { + data = /incbin/("./foo.dtb"); + type = "flat_dt"; + arch = "arm"; + load = <0x87f00000>; + }; + fdt at 2 { + data = /incbin/("./reva.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + fdt at 3 { + data = /incbin/("./revb.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + fdt at 4 { + data = /incbin/("./bar.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + fdt at 5 { + data = /incbin/("./baz.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + }; + + configurations { + default = "foo-reva.dtb; + foo-reva.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 2"; + }; + foo-revb.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3"; + }; + foo-reva-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 2", "fdt at 4"; + }; + foo-revb-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3", "fdt at 4"; + }; + foo-revb-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3", "fdt at 5"; + }; + foo-revb-bar-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3", "fdt at 4", "fdt at 5"; + }; + bar { + fdt = "fdt at 4"; + }; + baz { + fdt = "fdt at 5"; + }; + }; + }; + +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 at konsulko.com +12/6/2017doc/uImage.FIT/source_file_format.txt +1
-1@@ -235,7 +235,7 @@ o config at 1 |- description = "configuration description" |- kernel = "kernel sub-node unit name" |- ramdisk = "ramdisk sub-node unit name" - |- fdt = "fdt sub-node unit-name" + |- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...] |- fpga = "fpga sub-node unit-name" |- loadables = "loadables sub-node unit-name"
doc/uImage.FIT/source_file_format.txt o config at 1 · line 257
Quoted 10 lines
doc/uImage.FIT/source_file_format.txt +3
-1@@ -249,7 +249,9 @@ o config at 1 - ramdisk : Unit name of the corresponding ramdisk image (component image node of a "ramdisk" type). - fdt : Unit name of the corresponding fdt blob (component image node of a - "fdt type"). + "fdt type"). Additional fdt overlay nodes can be supplied which signify + that the resulting device tree blob is generated by the first base fdt + blob with all subsequent overlays applied. - setup : Unit name of the corresponding setup binary (used for booting an x86 kernel). This contains the setup.bin file built by the kernel. - fpga : Unit name of the corresponding fpga bitstream blob
I'm just curious - what was the fit image size reduction on your test setup?
Signature · 9 lines
Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v3 8/14 fit: fdt overlays doc
Hi Lukasz,
Quoted 302 lines · Łukasz Majewski
Quoted 287 lines · Pantelis Antoniou
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 221 +++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- 3 files changed, 236 insertions(+), 3 deletions(-)create mode 100644
doc/uImage.FIT/overlay-fdt-boot.txtdoc/uImage.FIT/command_syntax_extensions.txt +11
-1@@ -36,7 +36,7 @@ Old uImage: New uImage: 8. bootm <addr1> 9. bootm [<addr1>]:<subimg1> -10. bootm [<addr1>]#<conf> +10. bootm [<addr1>]#<conf>[#<extra-conf[#...]] 11. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> 12. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> [<addr3>]:<subimg3> 13. bootm [<addr1>]:<subimg1> [<addr2>]:<subimg2> <addr3>@@ -129,6 +129,12 @@ following syntax: - new uImage configuration specification <addr>#<configuration unit_name> +- new uImage configuration specification with extra configuration components +<addr>#<configuration unit_name>[#<extra configuration unit_name>[#..]] + +The extra configuration currently is supported only for additional device tree +overlays to apply on the base device tree supplied by the first configuration +unit. Examples:@@ -138,6 +144,10 @@ bootm 200000:kernel at 1 - boot configuration "cfg at 1" from a new uImage located at 200000: bootm 200000#cfg at 1 +- boot configuration "cfg at 1" with extra "cfg at 2" from a new uImage located + at 200000: +bootm 200000#cfg at 1#cfg at 2 + - boot "kernel at 1" from a new uImage at 200000 with initrd "ramdisk at 2" found in some other new uImage stored at address 800000: bootm 200000:kernel at 1 800000:ramdisk at 2doc/uImage.FIT/overlay-fdt-boot.txt new file +221
-0@@ -0,0 +1,221 @@ +U-Boot FDT Overlay usage +======================== + +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. + +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 { + kernel at 1 { + data = /incbin/("./zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + load = <0x82000000>; + entry = <0x82000000>; + }; + fdt at 1 { + data = /incbin/("./foo-reva.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 2 { + data = /incbin/("./foo-revb.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 3 { + data = /incbin/("./foo-reva-bar.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 4 { + data = /incbin/("./foo-revb-bar.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 5 { + data = /incbin/("./foo-revb-baz.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + fdt at 6 { + data = /incbin/("./foo-revb-bar-baz.dtb"); + type = "flat_dt"; + arch = "arm"; + }; + }; + + configurations { + default = "foo-reva.dtb; + foo-reva.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1"; + }; + foo-revb.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 2"; + }; + foo-reva-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 3"; + }; + foo-revb-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 4"; + }; + foo-revb-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 5"; + }; + foo-revb-bar-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 6"; + }; + }; + }; + +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 { + kernel at 1 { + data = /incbin/("./zImage"); + type = "kernel"; + arch = "arm"; + os = "linux"; + load = <0x82000000>; + entry = <0x82000000>; + }; + fdt at 1 { + data = /incbin/("./foo.dtb"); + type = "flat_dt"; + arch = "arm"; + load = <0x87f00000>; + }; + fdt at 2 { + data = /incbin/("./reva.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + fdt at 3 { + data = /incbin/("./revb.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + fdt at 4 { + data = /incbin/("./bar.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + fdt at 5 { + data = /incbin/("./baz.dtbo"); + type = "flat_dt"; + arch = "arm"; + load = <0x87fc0000>; + }; + }; + + configurations { + default = "foo-reva.dtb; + foo-reva.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 2"; + }; + foo-revb.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3"; + }; + foo-reva-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 2", "fdt at 4"; + }; + foo-revb-bar.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3", "fdt at 4"; + }; + foo-revb-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3", "fdt at 5"; + }; + foo-revb-bar-baz.dtb { + kernel = "kernel at 1"; + fdt = "fdt at 1", "fdt at 3", "fdt at 4", "fdt at 5"; + }; + bar { + fdt = "fdt at 4"; + }; + baz { + fdt = "fdt at 5"; + }; + }; + }; + +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 at konsulko.com +12/6/2017doc/uImage.FIT/source_file_format.txt +1
-1@@ -235,7 +235,7 @@ o config at 1 |- description = "configuration description" |- kernel = "kernel sub-node unit name" |- ramdisk = "ramdisk sub-node unit name" - |- fdt = "fdt sub-node unit-name" + |- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...] |- fpga = "fpga sub-node unit-name" |- loadables = "loadables sub-node unit-name"doc/uImage.FIT/source_file_format.txt o config at 1 · line 257
Quoted 10 lines
doc/uImage.FIT/source_file_format.txt +3
-1@@ -249,7 +249,9 @@ o config at 1 - ramdisk : Unit name of the corresponding ramdisk image (component image node of a "ramdisk" type). - fdt : Unit name of the corresponding fdt blob (component image node of a - "fdt type"). + "fdt type"). Additional fdt overlay nodes can be supplied which signify + that the resulting device tree blob is generated by the first base fdt + blob with all subsequent overlays applied. - setup : Unit name of the corresponding setup binary (used for booting an x86 kernel). This contains the setup.bin file built by the kernel. - fpga : Unit name of the corresponding fpga bitstream blobReviewed-by Łukasz Majewski
Quoted 2 lines
I'm just curious - what was the fit image size reduction on your test setup?
I haven't measured, but it's easy to calculate.
Assume each base blob is B bytes in average with each additional overlay being Oi extra bytes when included in the base and O bytes (in average) when compiled as an overlay (with O > Oi, overhead is almost constant - O = Oi + C). Then for n cases:
The size of a non-overlay case is:
Si = (B + Oi) * n = B * n + Oi * n
The size of an overlay case is
So = B + O * n = B + (Oi + C) * n = B + Oi * n + C * n
The delta in size is:
d = Si - So = B * n + Qi * n - B - Oi * n - C * n =
= B * (n - 1) - C * n
For contemporary device trees (which are in the 140K sizes) and the average overhead at about 200 bytes.
d = 140K * (n - 1) - 200 * n
It's pretty much a win even at n = 2.
For example for n = 5 (a common case).
d = 140K * (5 - 1) - 200 * 5 = 559K
It's not earth-shattering smaller, but it's significant.
Regards
-- Pantelis
PATCH v3 8/14 fit: fdt overlays doc
In reply to Pantelis AntoniouQuoted 8 lines · Pantelis Antoniou
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 221 +++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- 3 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 doc/uImage.FIT/overlay-fdt-boot.txt
PATCH v3 8/14 fit: fdt overlays doc
Quoted 8 lines · Pantelis Antoniou
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 221 +++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- 3 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 doc/uImage.FIT/overlay-fdt-boot.txt
Applied to u-boot-fdt thanks!
PATCH v3 9/14 doc: Document how to apply fdt overlays
In reply to Pantelis AntoniouWe have the capability to apply overlays on the command line but we didn't have a document explaining how.
--- doc/README.fdt-overlays | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 doc/README.fdt-overlays
doc/README.fdt-overlays new file +37 -0
@@ -0,0 +1,37 @@ +U-Boot FDT Overlay usage (without FIT images) +============================================= + +FDT overlays are now available for use even without FIT images. +It is not as automagic as with FIT images though and require a few +manual steps. + +1. Figure out where to place both the base device tree blob and the +overlay. Make sure you have enough space to grow the base tree without +overlapping anything. + +=> setenv fdtaddr 0x87f00000 +=> setenv fdtovaddr 0x87fc0000 + +2. Load the base blob and overlay blobs + +=> load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/base.dtb +=> load ${devtype} ${bootpart} ${fdtovaddr} ${bootdir}/overlay.dtb + +3. Set it as the working fdt tree. + +=> fdtaddr $fdtaddr + +4. Grow it enough so it can 'fit' all the applied overlays + +=> fdt resize 8192 + +5. You are now ready to apply the overlay. + +=> fdt apply $fdtovaddr + +Please note that in case of an error, both the base and overlays are going +to be invalidated, so keep copies to avoid reloading. + +Pantelis Antoniou +pantelis.antoniou at konsulko.com +11/7/2017
Signature · 1 line
2.1.4
PATCH v3 9/14 doc: Document how to apply fdt overlays
Quoted 43 lines · Pantelis Antoniou
We have the capability to apply overlays on the command line but we didn't have a document explaining how.
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/README.fdt-overlays | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)create mode 100644 doc/README.fdt-overlays
doc/README.fdt-overlays new file +27
-0@@ -0,0 +1,37 @@ +U-Boot FDT Overlay usage (without FIT images) +============================================= + +FDT overlays are now available for use even without FIT images. +It is not as automagic as with FIT images though and require a few +manual steps. + +1. Figure out where to place both the base device tree blob and the +overlay. Make sure you have enough space to grow the base tree without +overlapping anything. + +=> setenv fdtaddr 0x87f00000 +=> setenv fdtovaddr 0x87fc0000 + +2. Load the base blob and overlay blobs + +=> load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/base.dtb +=> load ${devtype} ${bootpart} ${fdtovaddr} ${bootdir}/overlay.dtb + +3. Set it as the working fdt tree. + +=> fdtaddr $fdtaddr + +4. Grow it enough so it can 'fit' all the applied overlays + +=> fdt resize 8192 +
doc/README.fdt-overlays line 37
Quoted 10 lines
doc/README.fdt-overlays new file +10
-0+5. You are now ready to apply the overlay. + +=> fdt apply $fdtovaddr + +Please note that in case of an error, both the base and overlays are going +to be invalidated, so keep copies to avoid reloading. + +Pantelis Antoniou +pantelis.antoniou at konsulko.com +11/7/2017
Signature · 9 lines
Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v3 9/14 doc: Document how to apply fdt overlays
In reply to Pantelis AntoniouQuoted 9 lines · Pantelis Antoniou
We have the capability to apply overlays on the command line but we didn't have a document explaining how.
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/README.fdt-overlays | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 doc/README.fdt-overlays
PATCH v3 9/14 doc: Document how to apply fdt overlays
Quoted 9 lines · Pantelis Antoniou
We have the capability to apply overlays on the command line but we didn't have a document explaining how.
Signed-off-by Pantelis Antoniou <[email protected]>--- doc/README.fdt-overlays | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 doc/README.fdt-overlays
Applied to u-boot-fdt thanks!
PATCH v3 10/14 doc: overlays: Tweak documentation regarding overlays
In reply to Pantelis AntoniouFrom: Franklin S Cooper Jr <[email protected]>
Pull some information regarding overlays from commit messages and put them directly within the documentation. Also add some information regarding required dtc version to properly use overlays.
--- doc/README.fdt-overlays | 85 +++++++++++++++++++++++++++++++++++-- doc/uImage.FIT/overlay-fdt-boot.txt | 8 +++- 2 files changed, 87 insertions(+), 6 deletions(-)
doc/README.fdt-overlays +81 -4
@@ -1,9 +1,76 @@ -U-Boot FDT Overlay usage (without FIT images) +U-Boot FDT Overlay usage ============================================= -FDT overlays are now available for use even without FIT images. -It is not as automagic as with FIT images though and require a few -manual steps. +Overlays Syntax +--------------- + +Overlays require slightly different syntax compared to traditional overlays. +Please refer to dt-object-internal.txt in the dtc sources for information +regarding the internal format of overlays: +https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/Documentation/dt-object-internal.txt + +Building Overlays +----------------- + +In a nutshell overlays provides a means to manipulate a symbol a previous dtb +or overlay has defined. It requires both the base and all the overlays +to be compiled with the -@ command line switch so that symbol information is +included. + +Note support for -@ option can only be found in dtc version 1.4.4 or newer. +Only version 4.14 or higher of the Linux kernel includes a built in version +of dtc that meets this requirement. + +Building an overlay follows the same process as building a traditional dtb. + +For example: + +base.dts +-------- + + /dts-v1/; + / { + foo: foonode { + foo-property; + }; + }; + + $ dtc -@ -I dts -O dtb -o base.dtb base.dts + +bar.dts +------- + + /dts-v1/; + /plugin/; + / { + fragment at 1 { + target = <&foo>; + __overlay__ { + overlay-1-property; + bar: barnode { + bar-property; + }; + }; + }; + }; + + $ dtc -@ -I dts -O dtb -o bar.dtb bar.dts + +Ways to Utilize Overlays in U-boot +---------------------------------- + +There are two ways to apply overlays in U-boot. +1. Include and define overlays within a FIT image and have overlays + automatically applied. + +2. Manually load and apply overlays + +The remainder of this document will discuss using overlays via the manual +approach. For information on using overlays as part of a FIT image please see: +doc/uImage.FIT/overlay-fdt-boot.txt + +Manually Loading and Applying Overlays +-------------------------------------- 1. Figure out where to place both the base device tree blob and the overlay. Make sure you have enough space to grow the base tree without
@@ -29,6 +96,16 @@ overlapping anything. => fdt apply $fdtovaddr +6. Boot system like you would do with a traditional dtb. + +For bootm: + +=> bootm ${kerneladdr} - ${fdtaddr} + +For bootz: + +=> bootz ${kerneladdr} - ${fdtaddr} + Please note that in case of an error, both the base and overlays are going to be invalidated, so keep copies to avoid reloading.
doc/uImage.FIT/overlay-fdt-boot.txt +6 -2
@@ -1,5 +1,5 @@ -U-Boot FDT Overlay usage -======================== +U-Boot FDT Overlay FIT usage +============================ Introduction ------------
@@ -8,6 +8,10 @@ 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. +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 + Configuration without overlays ------------------------------
Signature · 1 line
2.1.4
PATCH v3 10/14 doc: overlays: Tweak documentation regarding overlays
Quoted 128 lines · Pantelis Antoniou
From: Franklin S Cooper Jr <[email protected]>
Pull some information regarding overlays from commit messages and put them directly within the documentation. Also add some information regarding required dtc version to properly use overlays.
Signed-off-by Franklin S Cooper Jr <[email protected]>--- doc/README.fdt-overlays | 85 +++++++++++++++++++++++++++++++++++-- doc/uImage.FIT/overlay-fdt-boot.txt | 8 +++- 2 files changed, 87 insertions(+), 6 deletions(-)doc/README.fdt-overlays +81
-4@@ -1,9 +1,76 @@ -U-Boot FDT Overlay usage (without FIT images) +U-Boot FDT Overlay usage ============================================= -FDT overlays are now available for use even without FIT images. -It is not as automagic as with FIT images though and require a few -manual steps. +Overlays Syntax +--------------- + +Overlays require slightly different syntax compared to traditional overlays. +Please refer to dt-object-internal.txt in the dtc sources for information +regarding the internal format of overlays: +https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/Documentation/dt-object-internal.txt + +Building Overlays +----------------- + +In a nutshell overlays provides a means to manipulate a symbol a previous dtb +or overlay has defined. It requires both the base and all the overlays +to be compiled with the -@ command line switch so that symbol information is +included. + +Note support for -@ option can only be found in dtc version 1.4.4 or newer. +Only version 4.14 or higher of the Linux kernel includes a built in version +of dtc that meets this requirement. + +Building an overlay follows the same process as building a traditional dtb. + +For example: + +base.dts +-------- + + /dts-v1/; + / { + foo: foonode { + foo-property; + }; + }; + + $ dtc -@ -I dts -O dtb -o base.dtb base.dts + +bar.dts +------- + + /dts-v1/; + /plugin/; + / { + fragment at 1 { + target = <&foo>; + __overlay__ { + overlay-1-property; + bar: barnode { + bar-property; + }; + }; + }; + }; + + $ dtc -@ -I dts -O dtb -o bar.dtb bar.dts + +Ways to Utilize Overlays in U-boot +---------------------------------- + +There are two ways to apply overlays in U-boot. +1. Include and define overlays within a FIT image and have overlays + automatically applied. + +2. Manually load and apply overlays + +The remainder of this document will discuss using overlays via the manual +approach. For information on using overlays as part of a FIT image please see: +doc/uImage.FIT/overlay-fdt-boot.txt + +Manually Loading and Applying Overlays +-------------------------------------- 1. Figure out where to place both the base device tree blob and the overlay. Make sure you have enough space to grow the base tree without@@ -29,6 +96,16 @@ overlapping anything. => fdt apply $fdtovaddr +6. Boot system like you would do with a traditional dtb. + +For bootm: + +=> bootm ${kerneladdr} - ${fdtaddr} + +For bootz: + +=> bootz ${kerneladdr} - ${fdtaddr} + Please note that in case of an error, both the base and overlays are going to be invalidated, so keep copies to avoid reloading.doc/uImage.FIT/overlay-fdt-boot.txt +2
-2@@ -1,5 +1,5 @@ -U-Boot FDT Overlay usage -======================== +U-Boot FDT Overlay FIT usage +============================ Introduction ------------
doc/uImage.FIT/overlay-fdt-boot.txt of similar boards and their expansion options. The same kernel on DT enabled · line 17
Quoted 10 lines
doc/uImage.FIT/overlay-fdt-boot.txt +4
-0@@ -8,6 +8,10 @@ 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. +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 + Configuration without overlays ------------------------------
Reviwed-by: �ukasz Majewski
Signature · 9 lines
Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v3 10/14 doc: overlays: Tweak documentation regarding overlays
In reply to Pantelis AntoniouQuoted 11 lines · Pantelis Antoniou
From: Franklin S Cooper Jr <[email protected]>
Pull some information regarding overlays from commit messages and put them directly within the documentation. Also add some information regarding required dtc version to properly use overlays.
Signed-off-by Franklin S Cooper Jr <[email protected]>--- doc/README.fdt-overlays | 85 +++++++++++++++++++++++++++++++++++-- doc/uImage.FIT/overlay-fdt-boot.txt | 8 +++- 2 files changed, 87 insertions(+), 6 deletions(-)
PATCH v3 10/14 doc: overlays: Tweak documentation regarding overlays
Quoted 11 lines · Pantelis Antoniou
From: Franklin S Cooper Jr <[email protected]>
Pull some information regarding overlays from commit messages and put them directly within the documentation. Also add some information regarding required dtc version to properly use overlays.
Signed-off-by Franklin S Cooper Jr <[email protected]>--- doc/README.fdt-overlays | 85 +++++++++++++++++++++++++++++++++++-- doc/uImage.FIT/overlay-fdt-boot.txt | 8 +++- 2 files changed, 87 insertions(+), 6 deletions(-)
Applied to u-boot-fdt thanks!
PATCH v3 11/14 dtbo: make dtbos special
In reply to Pantelis AntoniouSpecial rule for dtbo generation
--- scripts/Makefile.lib | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
scripts/Makefile.lib +17 -0
@@ -321,6 +321,23 @@ $(obj)/%.dtb: $(src)/%.dts FORCE dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) +# DTCO +# --------------------------------------------------------------------------- + +quiet_cmd_dtco = DTCO $@ +# Rule for objects only; does not put specific u-boot include at the end +# No generation of assembly file either +# Modified for U-Boot +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(DTC) -@ -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +$(obj)/%.dtbo: $(src)/%.dts FORCE + $(call if_changed_dep,dtco) + # Fonts # ---------------------------------------------------------------------------
Signature · 1 line
2.1.4
PATCH v3 11/14 dtbo: make dtbos special
Quoted 7 lines · Pantelis Antoniou
Special rule for dtbo generation
Signed-off-by Pantelis Antoniou <[email protected]>--- scripts/Makefile.lib | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v3 11/14 dtbo: make dtbos special
In reply to Pantelis Antoniouscripts/Makefile.lib $(obj)/%.dtb: $(src)/%.dts FORCE · line 335
Quoted 13 lines · Pantelis Antoniou
Special rule for dtbo generation
scripts/Makefile.lib +9
-0+quiet_cmd_dtco = DTCO $@ +# Rule for objects only; does not put specific u-boot include at the end +# No generation of assembly file either +# Modified for U-Boot +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(DTC) -@ -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \
As of u-boot-fdt/master commit 503afc3ca1e5 "test: overlay: Add unit test for stacked overlay", the U-Boot build fails for sandbox with the error below. I guess it's due to this commit. Does U-Boot now intentionally rely on a newer dtc or is this an accident?
DTC test/overlay/test-fdt-base.dtb LD lib/libfdt/built-in.o CC lib/charset.o CC lib/rsa/rsa-verify.o
dtc: invalid option -- '@'
Usage: dtc [options] <input file>
Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
...
PATCH v3 11/14 dtbo: make dtbos special
Quoted 24 lines · Stephen Warren
scripts/Makefile.lib $(obj)/%.dtb: $(src)/%.dts FORCE · line 335
Quoted 13 lines · Pantelis Antoniou
Special rule for dtbo generation
scripts/Makefile.lib +9
-0+quiet_cmd_dtco = DTCO $@ +# Rule for objects only; does not put specific u-boot include at the end +# No generation of assembly file either +# Modified for U-Boot +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(DTC) -@ -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \As of u-boot-fdt/master commit
503afc3ca1e5"test: overlay: Add unit test for stacked overlay", the U-Boot build fails for sandbox with the error below. I guess it's due to this commit. Does U-Boot now intentionally rely on a newer dtc or is this an accident?DTC test/overlay/test-fdt-base.dtb LD lib/libfdt/built-in.o CC lib/charset.o CC lib/rsa/rsa-verify.o
Quoted 7 lines
dtc: invalid option -- '@'
Usage: dtc [options] <input file>Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
...
Related, the following check in Makefile doesn't trigger:
checkdtc:
@if test $(call dtc-version) -lt 0104; then \ echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ false; \ fi
... because I have dtc 1.4.0. If U-Boot requires a new version now, that Makefile chunk should be updated.
PATCH v3 11/14 dtbo: make dtbos special
Quoted 35 lines · Stephen Warren
Quoted 24 lines · Stephen Warren
scripts/Makefile.lib $(obj)/%.dtb: $(src)/%.dts FORCE · line 335
Quoted 13 lines · Pantelis Antoniou
Special rule for dtbo generation
scripts/Makefile.lib +9
-0+quiet_cmd_dtco = DTCO $@ +# Rule for objects only; does not put specific u-boot include at the end +# No generation of assembly file either +# Modified for U-Boot +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(DTC) -@ -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \As of u-boot-fdt/master commit
503afc3ca1e5"test: overlay: Add unit test for stacked overlay", the U-Boot build fails for sandbox with the error below. I guess it's due to this commit. Does U-Boot now intentionally rely on a newer dtc or is this an accident?DTC test/overlay/test-fdt-base.dtb LD lib/libfdt/built-in.o CC lib/charset.o CC lib/rsa/rsa-verify.oQuoted 7 lines
dtc: invalid option -- '@'
Usage: dtc [options] <input file>Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
...Related, the following check in
Makefiledoesn't trigger:
Quoted 8 lines
checkdtc:
@if test $(call dtc-version) -lt 0104; then \ echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ false; \ fi... because I have dtc 1.4.0. If U-Boot requires a new version now, that
Makefilechunk should be updated.
Ah, this is what needs updating, yes, it needs to cehck for 1.4.3 or newer.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170915/734f733b/attachment.sig>
PATCH v3 11/14 dtbo: make dtbos special
Quoted 42 lines · Tom Rini
Quoted 41 lines · Stephen Warren
Quoted 24 lines · Stephen Warren
scripts/Makefile.lib $(obj)/%.dtb: $(src)/%.dts FORCE · line 335
Quoted 13 lines · Pantelis Antoniou
Special rule for dtbo generation
scripts/Makefile.lib +9
-0+quiet_cmd_dtco = DTCO $@ +# Rule for objects only; does not put specific u-boot include at the end +# No generation of assembly file either +# Modified for U-Boot +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(DTC) -@ -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \As of u-boot-fdt/master commit
503afc3ca1e5"test: overlay: Add unit test for stacked overlay", the U-Boot build fails for sandbox with the error below. I guess it's due to this commit. Does U-Boot now intentionally rely on a newer dtc or is this an accident?DTC test/overlay/test-fdt-base.dtb LD lib/libfdt/built-in.o CC lib/charset.o CC lib/rsa/rsa-verify.oQuoted 7 lines
dtc: invalid option -- '@'
Usage: dtc [options] <input file>Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
...Related, the following check in
Makefiledoesn't trigger:checkdtc:
@if test $(call dtc-version) -lt 0104; then \ echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ false; \ fi
Quoted 5 lines
Quoted 2 lines
... because I have dtc 1.4.0. If U-Boot requires a new version now, that
Makefilechunk should be updated.Ah, this is what needs updating, yes, it needs to cehck for 1.4.3 or newer.
Related: The Travis systems run Ubuntu 14.04 (same as my systems) and hence have dtc 1.4.0. If u-boot-fdt/master is merged into u-boot/master, the build will break in Travis.
The logic in .travis.yml to use a newer dtc (built from upstream dtc source) is disabled since apparently more recent dtc spew lots of warnings and make the logs too long for Travis. Ideally, .travis.yml would check out and build the exact same dtc version/tag that Makefile dictates as the minimum, but I'm not sure that's possible given the log spew issue.
PATCH v3 11/14 dtbo: make dtbos special
Quoted 53 lines · Stephen Warren
Quoted 42 lines · Tom Rini
Quoted 41 lines · Stephen Warren
Quoted 24 lines · Stephen Warren
scripts/Makefile.lib $(obj)/%.dtb: $(src)/%.dts FORCE · line 335
Quoted 13 lines · Pantelis Antoniou
Special rule for dtbo generation
scripts/Makefile.lib +9
-0+quiet_cmd_dtco = DTCO $@ +# Rule for objects only; does not put specific u-boot include at the end +# No generation of assembly file either +# Modified for U-Boot +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(DTC) -@ -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \As of u-boot-fdt/master commit
503afc3ca1e5"test: overlay: Add unit test for stacked overlay", the U-Boot build fails for sandbox with the error below. I guess it's due to this commit. Does U-Boot now intentionally rely on a newer dtc or is this an accident?DTC test/overlay/test-fdt-base.dtb LD lib/libfdt/built-in.o CC lib/charset.o CC lib/rsa/rsa-verify.oQuoted 7 lines
dtc: invalid option -- '@'
Usage: dtc [options] <input file>Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv]
-q, --quiet
Quiet: -q suppress warnings, -qq errors, -qqq all
...Related, the following check in
Makefiledoesn't trigger:checkdtc:
@if test $(call dtc-version) -lt 0104; then \ echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ false; \ fiQuoted 5 lines
Quoted 2 lines
... because I have dtc 1.4.0. If U-Boot requires a new version now, that
Makefilechunk should be updated.Ah, this is what needs updating, yes, it needs to cehck for 1.4.3 or newer.
Related: The Travis systems run Ubuntu 14.04 (same as my systems) and hence have dtc 1.4.0. If u-boot-fdt/master is merged into u-boot/master, the build will break in Travis.
Quoted 6 lines
The logic in .travis.yml to use a newer dtc (built from upstream dtc source) is disabled since apparently more recent dtc spew lots of warnings and make the logs too long for Travis. Ideally, .travis.yml would check out and build the exact same dtc version/tag that
Makefiledictates as the minimum, but I'm not sure that's possible given the log spew issue.
Right, it was a problem, but it's not now and Simon is I believe grabbing the patch that brings us back to using dtc git. I'm working on patching dtc-version.sh now to give the patchlevel.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170915/3f6df58a/attachment.sig>
PATCH v3 11/14 dtbo: make dtbos special
Quoted 6 lines · Stephen Warren
Quoted 5 lines · Tom Rini
Quoted 4 lines · Stephen Warren
Quoted 3 lines · Stephen Warren
Quoted 1 line · Pantelis Antoniou
Special rule for dtbo generation
Applied to u-boot-fdt thanks!
PATCH v3 12/14 config: sandbox: Add unit tests
In reply to Pantelis AntoniouAdd unit tests for sandbox default config.
--- configs/sandbox_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/sandbox_defconfig +2 -0
@@ -189,7 +189,9 @@ CONFIG_CMD_DHRYSTONE=y CONFIG_TPM=y CONFIG_LZ4=y CONFIG_ERRNO_STR=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y CONFIG_UT_ENV=y +CONFIG_UT_OVERLAY=y
Signature · 1 line
2.1.4
PATCH v3 12/14 config: sandbox: Add unit tests
Quoted 7 lines · Pantelis Antoniou
Add unit tests for sandbox default config.
Signed-off-by Pantelis Antoniou <[email protected]>--- configs/sandbox_defconfig | 2 ++ 1 file changed, 2 insertions(+)
PATCH v3 12/14 config: sandbox: Add unit tests
Quoted 7 lines · Pantelis Antoniou
Add unit tests for sandbox default config.
Signed-off-by Pantelis Antoniou <[email protected]>--- configs/sandbox_defconfig | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-fdt thanks!
PATCH v3 13/14 ut: fix fdt_getprop_u32() change
In reply to Pantelis Antonioufdt_getprop_u32 is not exported and it's different than what the unit test uses. Rename u32 prop access methods to something that's unit test specific.
--- test/overlay/cmd_ut_overlay.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
test/overlay/cmd_ut_overlay.c +8 -8
@@ -21,7 +21,7 @@extern u32 __dtb_test_fdt_base_begin;extern u32 __dtb_test_fdt_overlay_begin; -static int fdt_getprop_u32_by_index (void *fdt,const char *path, +static int ut_fdt_getprop_u32_by_index (void *fdt,const char *path,const char *name,int index,u32 *out) {
@@ -42,10 +42,10 @@ static int fdt_getprop_u32_by_index(void *fdt, const char *path,return 0 ; } -static int fdt_getprop_u32 (void *fdt,const char *path,const char *name, +static int ut_fdt_getprop_u32 (void *fdt,const char *path,const char *name,u32 *out) { -return fdt_getprop_u32_by_index (fdt, path, name,0 , out); +return ut_fdt_getprop_u32_by_index (fdt, path, name,0 , out); } static int fdt_getprop_str(void *fdt, const char *path, const char *name,
@@ -68,7 +68,7 @@ static int fdt_overlay_change_int_property(struct unit_test_state *uts)void *fdt = uts->priv;u32 val =0 ; -ut_assertok (fdt_getprop_u32 (fdt,"/test-node" ,"test-int-property" , +ut_assertok (ut_fdt_getprop_u32 (fdt,"/test-node" ,"test-int-property" , &val));ut_asserteq (43 , val);
@@ -158,11 +158,11 @@ static int fdt_overlay_local_phandle(struct unit_test_state *uts) local_phandle =fdt_get_phandle (fdt, off);ut_assert (local_phandle); -ut_assertok (fdt_getprop_u32_by_index (fdt,"/" ,"test-several-phandle" , +ut_assertok (ut_fdt_getprop_u32_by_index (fdt,"/" ,"test-several-phandle" ,0 , &val));ut_asserteq (local_phandle, val); -ut_assertok (fdt_getprop_u32_by_index (fdt,"/" ,"test-several-phandle" , +ut_assertok (ut_fdt_getprop_u32_by_index (fdt,"/" ,"test-several-phandle" ,1 , &val));ut_asserteq (local_phandle, val);
@@ -189,11 +189,11 @@ static int fdt_overlay_local_phandles(struct unit_test_state *uts) test_phandle =fdt_get_phandle (fdt, off);ut_assert (test_phandle); -ut_assertok (fdt_getprop_u32_by_index (fdt,"/" ,"test-phandle" ,0 , +ut_assertok (ut_fdt_getprop_u32_by_index (fdt,"/" ,"test-phandle" ,0 , &val));ut_asserteq (test_phandle, val); -ut_assertok (fdt_getprop_u32_by_index (fdt,"/" ,"test-phandle" ,1 , +ut_assertok (ut_fdt_getprop_u32_by_index (fdt,"/" ,"test-phandle" ,1 , &val));ut_asserteq (local_phandle, val);
Signature · 1 line
2.1.4
PATCH v3 13/14 ut: fix fdt_getprop_u32() change
Quoted 9 lines · Pantelis Antoniou
fdt_getprop_u32is not exported and it's different than what the unit test uses. Rename u32 prop access methods to something that's unit test specific.Signed-off-by Pantelis Antoniou <[email protected]>--- test/overlay/cmd_ut_overlay.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
PATCH v3 13/14 ut: fix fdt_getprop_u32() change
Quoted 9 lines · Pantelis Antoniou
fdt_getprop_u32is not exported and it's different than what the unit test uses. Rename u32 prop access methods to something that's unit test specific.Signed-off-by Pantelis Antoniou <[email protected]>--- test/overlay/cmd_ut_overlay.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Applied to u-boot-fdt thanks!
PATCH v3 14/14 test: overlay: Add unit test for stacked overlay
In reply to Pantelis AntoniouVerify that stacked overlays work.
--- test/overlay/Makefile | 1 + test/overlay/cmd_ut_overlay.c | 34 ++++++++++++++++++++++++++++++- test/overlay/test-fdt-overlay-stacked.dts | 21 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/overlay/test-fdt-overlay-stacked.dts
test/overlay/Makefile +1 -0
@@ -13,3 +13,4 @@ DTC_FLAGS += -@ # DT overlays obj-y += test-fdt-base.dtb.o obj-y += test-fdt-overlay.dtb.o +obj-y += test-fdt-overlay-stacked.dtb.o
test/overlay/cmd_ut_overlay.c +33 -1
@@ -20,6 +20,7 @@extern u32 __dtb_test_fdt_base_begin;extern u32 __dtb_test_fdt_overlay_begin; +extern u32 __dtb_test_fdt_overlay_stacked_begin; static int ut_fdt_getprop_u32_by_index(void *fdt, const char *path, const char *name, int index,
@@ -201,6 +202,19 @@ static int fdt_overlay_local_phandles(struct unit_test_state *uts) }OVERLAY_TEST (fdt_overlay_local_phandles,0 ); +static int fdt_overlay_stacked (struct unit_test_state *uts) +{ +void *fdt = uts->priv; +u32 val =0 ; + +ut_assertok (ut_fdt_getprop_u32 (fdt,"/new-local-node" , +"stacked-test-int-property" , &val)); +ut_asserteq (43 , val); + +return CMD_RET_SUCCESS ; +} +OVERLAY_TEST (fdt_overlay_stacked,0 ); +int do_ut_overlay (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { struct unit_test *tests = ll_entry_start(struct unit_test,
@@ -210,7 +224,8 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])struct unit_test *test;void *fdt_base = &__dtb_test_fdt_base_begin;void *fdt_overlay = &__dtb_test_fdt_overlay_begin; -void *fdt_base_copy, *fdt_overlay_copy; +void *fdt_overlay_stacked = &__dtb_test_fdt_overlay_stacked_begin; +void *fdt_base_copy, *fdt_overlay_copy, *fdt_overlay_stacked_copy; uts =calloc (1 ,sizeof (*uts));if (!uts)
@@ -228,6 +243,10 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (!fdt_overlay_copy)return -ENOMEM ; + fdt_overlay_stacked_copy =malloc (FDT_COPY_SIZE ); +if (!fdt_overlay_stacked_copy) +return -ENOMEM ; +/* * Resize the FDT to 4k so that we have room to operate on *
@@ -245,9 +264,21 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])ut_assertok (fdt_open_into (fdt_overlay, fdt_overlay_copy,FDT_COPY_SIZE )); +/* +* Resize the stacked overlay to 4k so that we have room to operate on +* +* (and relocate it since the memory might be mapped +* read-only) +*/ +ut_assertok (fdt_open_into (fdt_overlay_stacked, fdt_overlay_stacked_copy, +FDT_COPY_SIZE )); +/* Apply the overlay */ ut_assertok (fdt_overlay_apply (fdt_base_copy, fdt_overlay_copy)); +/* Apply the stacked overlay */ +ut_assertok (fdt_overlay_apply (fdt_base_copy, fdt_overlay_stacked_copy)); +if (argc ==1 )printf ("Running %d environment tests\n" , n_ents);
@@ -263,6 +294,7 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])printf ("Failures: %d\n" , uts->fail_count); +free (fdt_overlay_stacked_copy);free (fdt_overlay_copy);free (fdt_base_copy);free (uts);
test/overlay/test-fdt-overlay-stacked.dts new file +21 -0
@@ -0,0 +1,21 @@ +/* + * Copyright (c) 2016 NextThing Co + * Copyright (c) 2016 Free Electrons + * Copyright (c) 2018 Konsulko Group + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; +/plugin/; + +/ { + /* Test that we can reference an overlay symbol */ + fragment at 0 { + target = <&local>; + + __overlay__ { + stacked-test-int-property = <43>; + }; + }; +};
Signature · 1 line
2.1.4
PATCH v3 14/14 test: overlay: Add unit test for stacked overlay
Quoted 9 lines · Pantelis Antoniou
Verify that stacked overlays work.
Signed-off-by Pantelis Antoniou <[email protected]>--- test/overlay/Makefile | 1 + test/overlay/cmd_ut_overlay.c | 34 ++++++++++++++++++++++++++++++- test/overlay/test-fdt-overlay-stacked.dts | 21 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/overlay/test-fdt-overlay-stacked.dts
PATCH v3 14/14 test: overlay: Add unit test for stacked overlay
Quoted 9 lines · Pantelis Antoniou
Verify that stacked overlays work.
Signed-off-by Pantelis Antoniou <[email protected]>--- test/overlay/Makefile | 1 + test/overlay/cmd_ut_overlay.c | 34 ++++++++++++++++++++++++++++++- test/overlay/test-fdt-overlay-stacked.dts | 21 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/overlay/test-fdt-overlay-stacked.dts
Applied to u-boot-fdt thanks!
v3 cover uboot overlays, FIT image & unittest
In reply to Pantelis AntoniouHi Pantelis,
Quoted 20 lines · Pantelis Antoniou
This patchset allows uboot to handle overlays in a manner that uses a base DT blob and an arbitrary number of DT overlays blobs.
While it is intended to be used with FIT images since handling a multitude of device tree blobs manually is a chore, manual fdt overlay application is supported and described.
Changes since v2:
* Addressed review comments by splitting patches and documenting methods.
* Patch preserving extra configuration on fit-loadThe patchset is available at
https://github.com/pantoniou/u-boot/tree/uboot-overlays
and is against mainline u-boot as pulled today, 4/9/2017.
Franklin S Cooper Jr (1):
doc: overlays: Tweak documentation regarding overlays
Quoted 14 lines
Pantelis Antoniou (13):
Introducefdt_setprop_placeholder()method
fdt: Introduce helper methodfdt_overlay_apply_verbose()
fdt: Switch to using the verbose overlay application method
fdt: Allow stacked overlays phandle references
fit: Allow multiple images per property
fit: Do not throw away extra configuration onfit_image_load()
fit: Introduce methods for applying overlays on fit-load
fit: fdt overlays doc
doc: Document how to apply fdt overlays
dtbo: make dtbos special
config: sandbox: Add unit tests
ut: fixfdt_getprop_u32()change
test: overlay: Add unit test for stacked overlay
I applied this series (to u-boot-fdt/testing) but it requires a later version of dtc than we use in our travis tests:
https://travis-ci.org/sglass68/u-boot/jobs/275239527
Could you please take a look? I don't think I can pull this in until I know it can make it to mainline.
The good news is that with the new dtc my buildman test went through with no errors.
Quoted 24 lines
cmd/fdt.c | 7 +- common/fdt_support.c | 31 ++++ common/image-fdt.c | 7 +- common/image-fit.c | 210 ++++++++++++++++++++++-- configs/sandbox_defconfig | 2 + doc/README.fdt-overlays | 114 ++++++++++++++ doc/uImage.FIT/command_syntax_extensions.txt | 12 +- doc/uImage.FIT/overlay-fdt-boot.txt | 225 ++++++++++++++++++++++++++ doc/uImage.FIT/source_file_format.txt | 6 +- include/fdt_support.h | 2 + include/image.h | 25 +++ lib/libfdt/fdt_overlay.c | 228 ++++++++++++++++++++++++--- lib/libfdt/fdt_rw.c | 20 ++- lib/libfdt/libfdt.h | 31 ++++ scripts/Makefile.lib | 17 ++ test/overlay/Makefile | 1 + test/overlay/cmd_ut_overlay.c | 50 ++++-- test/overlay/test-fdt-overlay-stacked.dts | 21 +++ 18 files changed, 953 insertions(+), 56 deletions(-) create mode 100644 doc/README.fdt-overlays create mode 100644 doc/uImage.FIT/overlay-fdt-boot.txt create mode 100644 test/overlay/test-fdt-overlay-stacked.dts
Quoted 3 lines
--
2.1.4
Regards,
Simon
v3 cover uboot overlays, FIT image & unittest
Quoted 39 lines · Simon Glass
Hi Pantelis,
Quoted 20 lines · Pantelis Antoniou
This patchset allows uboot to handle overlays in a manner that uses a base DT blob and an arbitrary number of DT overlays blobs.
While it is intended to be used with FIT images since handling a multitude of device tree blobs manually is a chore, manual fdt overlay application is supported and described.
Changes since v2:
* Addressed review comments by splitting patches and documenting methods.
* Patch preserving extra configuration on fit-loadThe patchset is available at
https://github.com/pantoniou/u-boot/tree/uboot-overlays
and is against mainline u-boot as pulled today, 4/9/2017.
Franklin S Cooper Jr (1):
doc: overlays: Tweak documentation regarding overlaysQuoted 14 lines
Pantelis Antoniou (13):
Introducefdt_setprop_placeholder()method
fdt: Introduce helper methodfdt_overlay_apply_verbose()
fdt: Switch to using the verbose overlay application method
fdt: Allow stacked overlays phandle references
fit: Allow multiple images per property
fit: Do not throw away extra configuration onfit_image_load()
fit: Introduce methods for applying overlays on fit-load
fit: fdt overlays doc
doc: Document how to apply fdt overlays
dtbo: make dtbos special
config: sandbox: Add unit tests
ut: fixfdt_getprop_u32()change
test: overlay: Add unit test for stacked overlay
Quoted 4 lines
I applied this series (to u-boot-fdt/testing) but it requires a later version of dtc than we use in our travis tests:
The -@ flag has been around for a long time, relatively speaking. Is there a problem in our .travis.yml perhaps where it's not picking up the dtc we're building from git?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170913/37dc2ef9/attachment.sig>
v3 cover uboot overlays, FIT image & unittest
Quoted 40 lines · Tom Rini
Quoted 39 lines · Simon Glass
Hi Pantelis,
Quoted 34 lines · Pantelis Antoniou
This patchset allows uboot to handle overlays in a manner that uses a base DT blob and an arbitrary number of DT overlays blobs.
While it is intended to be used with FIT images since handling a multitude of device tree blobs manually is a chore, manual fdt overlay application is supported and described.
Changes since v2:
* Addressed review comments by splitting patches and documenting methods.
* Patch preserving extra configuration on fit-loadThe patchset is available at
https://github.com/pantoniou/u-boot/tree/uboot-overlays
and is against mainline u-boot as pulled today, 4/9/2017.
Franklin S Cooper Jr (1):
doc: overlays: Tweak documentation regarding overlaysPantelis Antoniou (13):
Introducefdt_setprop_placeholder()method
fdt: Introduce helper methodfdt_overlay_apply_verbose()
fdt: Switch to using the verbose overlay application method
fdt: Allow stacked overlays phandle references
fit: Allow multiple images per property
fit: Do not throw away extra configuration onfit_image_load()
fit: Introduce methods for applying overlays on fit-load
fit: fdt overlays doc
doc: Document how to apply fdt overlays
dtbo: make dtbos special
config: sandbox: Add unit tests
ut: fixfdt_getprop_u32()change
test: overlay: Add unit test for stacked overlay
Quoted 8 lines
Quoted 4 lines
I applied this series (to u-boot-fdt/testing) but it requires a later version of dtc than we use in our travis tests:
The -@ flag has been around for a long time, relatively speaking. Is there a problem in our .travis.yml perhaps where it's not picking up the dtc we're building from git?
Yeah, it's not:
https://travis-ci.org/trini/u-boot/builds/275424745
I bet this got broken recently too, I'll see what we need to fix in the travis environment.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170914/28e850ff/attachment.sig>
v3 cover uboot overlays, FIT image & unittest
Quoted 50 lines · Tom Rini
Quoted 40 lines · Tom Rini
Quoted 39 lines · Simon Glass
Hi Pantelis,
Quoted 34 lines · Pantelis Antoniou
This patchset allows uboot to handle overlays in a manner that uses a base DT blob and an arbitrary number of DT overlays blobs.
While it is intended to be used with FIT images since handling a multitude of device tree blobs manually is a chore, manual fdt overlay application is supported and described.
Changes since v2:
* Addressed review comments by splitting patches and documenting methods.
* Patch preserving extra configuration on fit-loadThe patchset is available at
https://github.com/pantoniou/u-boot/tree/uboot-overlays
and is against mainline u-boot as pulled today, 4/9/2017.
Franklin S Cooper Jr (1):
doc: overlays: Tweak documentation regarding overlaysPantelis Antoniou (13):
Introducefdt_setprop_placeholder()method
fdt: Introduce helper methodfdt_overlay_apply_verbose()
fdt: Switch to using the verbose overlay application method
fdt: Allow stacked overlays phandle references
fit: Allow multiple images per property
fit: Do not throw away extra configuration onfit_image_load()
fit: Introduce methods for applying overlays on fit-load
fit: fdt overlays doc
doc: Document how to apply fdt overlays
dtbo: make dtbos special
config: sandbox: Add unit tests
ut: fixfdt_getprop_u32()change
test: overlay: Add unit test for stacked overlayQuoted 8 lines
Quoted 4 lines
I applied this series (to u-boot-fdt/testing) but it requires a later version of dtc than we use in our travis tests:
The -@ flag has been around for a long time, relatively speaking. Is there a problem in our .travis.yml perhaps where it's not picking up the dtc we're building from git?
Quoted 5 lines
Yeah, it's not:
https://travis-ci.org/trini/u-boot/builds/275424745I bet this got broken recently too, I'll see what we need to fix in the travis environment.
Nope, it's related to me disabling newer dtc due to all of the warnings which in turn caused travis-ci to fail due to log sizes.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170914/28cbba5b/attachment.sig>
v3 cover uboot overlays, FIT image & unittest
In reply to Simon GlassQuoted 42 lines · Simon Glass
Hi Pantelis,
Quoted 20 lines · Pantelis Antoniou
This patchset allows uboot to handle overlays in a manner that uses a base DT blob and an arbitrary number of DT overlays blobs.
While it is intended to be used with FIT images since handling a multitude of device tree blobs manually is a chore, manual fdt overlay application is supported and described.
Changes since v2:
* Addressed review comments by splitting patches and documenting methods.
* Patch preserving extra configuration on fit-loadThe patchset is available at
https://github.com/pantoniou/u-boot/tree/uboot-overlays
and is against mainline u-boot as pulled today, 4/9/2017.
Franklin S Cooper Jr (1):
doc: overlays: Tweak documentation regarding overlaysQuoted 14 lines
Pantelis Antoniou (13):
Introducefdt_setprop_placeholder()method
fdt: Introduce helper methodfdt_overlay_apply_verbose()
fdt: Switch to using the verbose overlay application method
fdt: Allow stacked overlays phandle references
fit: Allow multiple images per property
fit: Do not throw away extra configuration onfit_image_load()
fit: Introduce methods for applying overlays on fit-load
fit: fdt overlays doc
doc: Document how to apply fdt overlays
dtbo: make dtbos special
config: sandbox: Add unit tests
ut: fixfdt_getprop_u32()change
test: overlay: Add unit test for stacked overlayI applied this series (to u-boot-fdt/testing) but it requires a later version of dtc than we use in our travis tests:
Quoted 7 lines
https://travis-ci.org/sglass68/u-boot/jobs/275239527
Could you please take a look? I don't think I can pull this in until I know it can make it to mainline.
The good news is that with the new dtc my buildman test went through with no errors.
OK, please add https://patchwork.ozlabs.org/patch/813888/ into your PR, make sure it still works (as it should), and then send it along to me. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170914/2837e0e2/attachment.sig>