[PATCH] scripts: dtc: Start building fdtoverlay and fdtdump

From: Viresh Kumar
Date: Wed Jan 06 2021 - 05:10:56 EST


We will start building overlays for platforms soon in the kernel and
would need these tools going forward. Lets fetch and build these.

Note that a copy of fdtdump.c was already copied back in the year 2012,
but it was never updated or built for some reason.

Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
scripts/dtc/Makefile | 8 +++++++-
scripts/dtc/update-dtc-source.sh | 6 +++---
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 4852bf44e913..c607980a5c17 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -1,12 +1,18 @@
# SPDX-License-Identifier: GPL-2.0
# scripts/dtc makefile

-hostprogs-always-$(CONFIG_DTC) += dtc
+hostprogs-always-$(CONFIG_DTC) += dtc fdtdump fdtoverlay
hostprogs-always-$(CHECK_DT_BINDING) += dtc

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
+fdtdump-objs := fdtdump.o util.o
+
+libfdt_dir = libfdt
+libfdt-objs := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
+libfdt = $(addprefix $(libfdt_dir)/,$(libfdt-objs))
+fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o

# Source files need to get at the userspace version of libfdt_env.h to compile
HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
diff --git a/scripts/dtc/update-dtc-source.sh b/scripts/dtc/update-dtc-source.sh
index bc704e2a6a4a..9bc4afb71415 100755
--- a/scripts/dtc/update-dtc-source.sh
+++ b/scripts/dtc/update-dtc-source.sh
@@ -31,9 +31,9 @@ set -ev
DTC_UPSTREAM_PATH=`pwd`/../dtc
DTC_LINUX_PATH=`pwd`/scripts/dtc

-DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c \
- srcpos.h treesource.c util.c util.h version_gen.h yamltree.c \
- dtc-lexer.l dtc-parser.y"
+DTC_SOURCE="checks.c data.c dtc.c dtc.h fdtdump.c fdtoverlay.c flattree.c \
+ fstree.c livetree.c srcpos.c srcpos.h treesource.c util.c \
+ util.h version_gen.h yamltree.c dtc-lexer.l dtc-parser.y"
LIBFDT_SOURCE="fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \
fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \
fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
--
2.25.0.rc1.19.g042ed3e048af