[PATCH 1/2] dts: add property removal option CONFIG_OF_REMOVE_PROPS

Masahiro Yamada masahiroy at kernel.org
Fri Jan 10 18:01:27 CET 2020


On Sat, Jan 11, 2020 at 1:39 AM Tom Rini <trini at konsulko.com> wrote:
>
> On Wed, Jan 08, 2020 at 10:38:32PM +0100, Anatolij Gustschin wrote:
>
> > This can be used for device tree size reduction similar as
> > CONFIG_OF_SPL_REMOVE_PROPS option. For tbs2910 board this
> > shrinks the image size: all -2304.0 bss -16.0 text -2288.0
> >
> > Signed-off-by: Anatolij Gustschin <agust at denx.de>
> > ---
> >  dts/Kconfig          | 8 ++++++++
> >  scripts/Makefile.lib | 3 ++-
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/dts/Kconfig b/dts/Kconfig
> > index 64c98dd723..49224bee93 100644
> > --- a/dts/Kconfig
> > +++ b/dts/Kconfig
> > @@ -311,6 +311,14 @@ config OF_SPL_REMOVE_PROPS
> >         can be discarded. This option defines the list of properties to
> >         discard.
> >
> > +config OF_REMOVE_PROPS
> > +     string "List of device tree properties to drop"
> > +     depends on OF_CONTROL
> > +     default "interrupt-parent interrupts" if PINCTRL
> > +     help
> > +       Some properties are not used by U-Boot and can be discarded.
> > +       This option defines the list of properties to discard.
> > +
> >  config SPL_OF_PLATDATA
> >       bool "Generate platform data for use in SPL"
> >       depends on SPL_OF_CONTROL
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 4ea898a421..3b124369ad 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -235,7 +235,8 @@ $(obj)/%.tab.h: $(src)/%.y FORCE
> >  # ===========================================================================
> >
> >  quiet_cmd_shipped = SHIPPED $@
> > -cmd_shipped = cat $< > $@
> > +cmd_shipped = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - -o $@    \
> > +             $(addprefix -P ,$(subst $\",,$(CONFIG_OF_REMOVE_PROPS)))
> >
> >  $(obj)/%: $(src)/%_shipped
> >       $(call cmd,shipped)
>
> On further thinking, this will make it harder in the case of passing the
> DTB directly to the kernel.  We should guard this option by something
> else first.
>
> --
> Tom


More importantly, this patch breaks targets
that compile pylibfdt, for example, qemu-x86_defconfig.


$ make qemu-x86_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
masahiro at grover:~/ref/u-boot$ make
scripts/kconfig/conf  --syncconfig Kconfig
  CHK     include/config.h
  UPD     include/config.h
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CHK     include/config/uboot.release
  UPD     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
  CHK     include/generated/generic-asm-offsets.h
  UPD     include/generated/generic-asm-offsets.h
  CC      arch/x86/lib/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  UPD     include/generated/asm-offsets.h
  SHIPPED scripts/dtc/pylibfdt/libfdt.i
/bin/sh: 1: ./tools/fdtgrep: not found
make[3]: *** [scripts/Makefile.lib:242: scripts/dtc/pylibfdt/libfdt.i] Error 127
make[2]: *** [scripts/Makefile.build:432: scripts/dtc/pylibfdt] Error 2
make[1]: *** [scripts/Makefile.build:432: scripts/dtc] Error 2
make: *** [Makefile:551: scripts] Error 2


Please do not touch cmd_shipped.

If this feature is desired,
please implement it in dts/Makefile.


-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list