Re: [RFC PATCH 1/4] scripts/dtc: update fdtget.c to upstream version v1.4.7-57-gf267e674d145

From: Rob Herring
Date: Thu Jan 30 2020 - 09:17:07 EST


On Thu, Jan 30, 2020 at 6:42 AM Åukasz Stelmach <l.stelmach@xxxxxxxxxxx> wrote:
>
> Build and fdtget and add fdtget.c to the list of update source files.

Why does the kernel need fdtget and why not use the version from your distro?

Please Cc the DT list next time.

> Signed-off-by: Åukasz Stelmach <l.stelmach@xxxxxxxxxxx>
> ---
> scripts/dtc/.gitignore | 4 +
> scripts/dtc/Makefile | 5 ++
> scripts/dtc/fdtget.c | 125 ++++++++++++++++++-------------
> scripts/dtc/update-dtc-source.sh | 4 +-

Separate changes by updates to this script, running the script (to get
fdtget.c), and updates to kernel files.

> 4 files changed, 82 insertions(+), 56 deletions(-)
>
> diff --git scripts/dtc/.gitignore scripts/dtc/.gitignore
> index 2e6e60d64ede..80f6b50fdf77 100644
> --- scripts/dtc/.gitignore
> +++ scripts/dtc/.gitignore
> @@ -1 +1,5 @@
> dtc
> +dtc-lexer.lex.c
> +dtc-parser.tab.c
> +dtc-parser.tab.h

These are needed regardless. Probably a treewide rule for *.lex.c,
*.tab.c, *.tab.h would be better.

> +fdtget
> diff --git scripts/dtc/Makefile scripts/dtc/Makefile
> index b5a5b1c548c9..74322d8dac25 100644
> --- scripts/dtc/Makefile
> +++ scripts/dtc/Makefile
> @@ -2,12 +2,15 @@
> # scripts/dtc makefile
>
> hostprogs-$(CONFIG_DTC) := dtc
> +hostprogs-$(CONFIG_DTC) += fdtget
> always := $(hostprogs-y)
>
> dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
> srcpos.o checks.o util.o
> dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
>
> +fdtget-objs := fdtget.o util.o
> +
> # Source files need to get at the userspace version of libfdt_env.h to compile
> HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
>
> @@ -26,5 +29,7 @@ endif
> HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
> HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
>
> +HOSTLDLIBS_fdtget := -L$(obj)/libfdt -lfdt -Wl,-rpath='$$ORIGIN/libfdt'
> +

We never build libfdt as a library, so how does this work unless it
pulls in the distro copy?

Rob