Skip to content

Commit 43b6e38

Browse files
vdsaotrini
authored andcommitted
dts: add property removal option CONFIG_OF_REMOVE_PROPS
This can be used for device tree size reduction similar as CONFIG_OF_SPL_REMOVE_PROPS option. Some boards must pass the built-in DTB unchanged to the kernel, thus we may not cut it down unconditionally. Therefore enable the property removal list option only if CONFIG_OF_DTB_PROPS_REMOVE is selected. Signed-off-by: Anatolij Gustschin <[email protected]>
1 parent 051e03c commit 43b6e38

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

dts/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ config OF_SPL_REMOVE_PROPS
314314
can be discarded. This option defines the list of properties to
315315
discard.
316316

317+
config OF_DTB_PROPS_REMOVE
318+
bool "Enable removal of device tree properties"
319+
depends on OF_CONTROL
320+
help
321+
Some boards have restricted amount of storage for U-Boot image.
322+
If the generated binary doesn't fit into available image storage,
323+
the built-in device tree could probably be cut down by removing
324+
some not required device tree properties to reduce the image size.
325+
Enable this option and define the properties to be removed in the
326+
CONFIG_OF_REMOVE_PROPS list. Do not enable this option if you must
327+
pass the built-in DTB directly to the kernel!
328+
329+
config OF_REMOVE_PROPS
330+
string "List of device tree properties to drop"
331+
depends on OF_DTB_PROPS_REMOVE
332+
default "interrupt-parent interrupts" if PINCTRL
333+
help
334+
Some properties are not used by U-Boot and can be discarded.
335+
This option defines the list of properties to discard.
336+
317337
config SPL_OF_PLATDATA
318338
bool "Generate platform data for use in SPL"
319339
depends on SPL_OF_CONTROL

dts/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ endif
1919
$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
2020
$(call if_changed,fdtgrep)
2121

22+
ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y)
23+
$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
24+
$(call if_changed,fdt_rm_props)
25+
else
2226
$(obj)/dt.dtb: $(DTB) FORCE
2327
$(call if_changed,shipped)
28+
endif
2429

2530
targets += dt.dtb dt-spl.dtb
2631

scripts/Makefile.lib

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,3 +544,11 @@ quiet_cmd_fdtgrep = FDTGREP $@
544544
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
545545
-P u-boot,dm-pre-reloc -P u-boot,dm-spl -P u-boot,dm-tpl \
546546
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
547+
548+
# fdt_rm_props
549+
# ---------------------------------------------------------------------------
550+
# Pass the original device tree file through fdtgrep. This removes various
551+
# unused properties. The output is typically a smaller device tree file.
552+
quiet_cmd_fdt_rm_props = FDTGREP $@
553+
cmd_fdt_rm_props = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
554+
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_REMOVE_PROPS)))

0 commit comments

Comments
 (0)