diff mbox series

[3/5] tools: use files from scripts/dtc/libfdt where possible

Message ID 1508247020-28071-4-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit b38ad663a4b4ccd91a43b12e2d65179dbd2b40cb
Headers show
Series libfdt: Reduce duplicated copies of libfdt | expand

Commit Message

Masahiro Yamada Oct. 17, 2017, 1:30 p.m. UTC
Prior to this commit, tools/Makefile pulls all libfdt files from
lib/libfdt.

lib/libfdt/ and scripts/dtc/libfdt have the same copies for the
followings 6 files:
  fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c
  fdt_sw.c

This commit changes them to #include ones from scripts/dtc/libfdt.

Unfortunately, U-Boot locally modified the following 3 files:
  fdt_ro.c fdt_wip.c fdt_rw.c

I did not touch them in order to avoid unpredictable impact.

The fdt_region.c is U-Boot own file.  This is also borrowed from
lib/libfdt/.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 tools/Makefile                | 15 ++++++++++-----
 tools/libfdt/fdt.c            |  2 ++
 tools/libfdt/fdt_addresses.c  |  2 ++
 tools/libfdt/fdt_empty_tree.c |  2 ++
 tools/libfdt/fdt_overlay.c    |  2 ++
 tools/libfdt/fdt_strerror.c   |  2 ++
 tools/libfdt/fdt_sw.c         |  2 ++
 7 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 tools/libfdt/fdt.c
 create mode 100644 tools/libfdt/fdt_addresses.c
 create mode 100644 tools/libfdt/fdt_empty_tree.c
 create mode 100644 tools/libfdt/fdt_overlay.c
 create mode 100644 tools/libfdt/fdt_strerror.c
 create mode 100644 tools/libfdt/fdt_sw.c

Comments

Tom Rini Nov. 17, 2017, 3:43 p.m. UTC | #1
On Tue, Oct 17, 2017 at 10:30:18PM +0900, Masahiro Yamada wrote:

> Prior to this commit, tools/Makefile pulls all libfdt files from

> lib/libfdt.

> 

> lib/libfdt/ and scripts/dtc/libfdt have the same copies for the

> followings 6 files:

>   fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c

>   fdt_sw.c

> 

> This commit changes them to #include ones from scripts/dtc/libfdt.

> 

> Unfortunately, U-Boot locally modified the following 3 files:

>   fdt_ro.c fdt_wip.c fdt_rw.c

> 

> I did not touch them in order to avoid unpredictable impact.

> 

> The fdt_region.c is U-Boot own file.  This is also borrowed from

> lib/libfdt/.

> 

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/tools/Makefile b/tools/Makefile
index 2b87e18..acbcd87 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -58,12 +58,17 @@  hostprogs-y += dumpimage mkimage
 hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
 
 FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
-# Flattened device tree objects
-LIBFDT_CSRCS := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c  \
-			fdt_empty_tree.c fdt_addresses.c fdt_overlay.c \
-			fdt_region.c
 
-LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS)))
+# The following files are synced with upstream DTC.
+# Use synced versions from scripts/dtc/libfdt/.
+LIBFDT_SRCS_SYNCED := fdt.c fdt_sw.c fdt_strerror.c fdt_empty_tree.c \
+		      fdt_addresses.c fdt_overlay.c
+# The following files are locally modified for U-Boot (unfotunately).
+# Use U-Boot own versions from lib/libfdt/.
+LIBFDT_SRCS_UNSYNCED := fdt_ro.c fdt_wip.c fdt_rw.c fdt_region.c
+
+LIBFDT_OBJS := $(addprefix libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_SYNCED))) \
+	       $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_UNSYNCED)))
 
 RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
 					rsa-sign.o rsa-verify.o rsa-checksum.o \
diff --git a/tools/libfdt/fdt.c b/tools/libfdt/fdt.c
new file mode 100644
index 0000000..8ba8091
--- /dev/null
+++ b/tools/libfdt/fdt.c
@@ -0,0 +1,2 @@ 
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt.c"
diff --git a/tools/libfdt/fdt_addresses.c b/tools/libfdt/fdt_addresses.c
new file mode 100644
index 0000000..242a2c0
--- /dev/null
+++ b/tools/libfdt/fdt_addresses.c
@@ -0,0 +1,2 @@ 
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt_addresses.c"
diff --git a/tools/libfdt/fdt_empty_tree.c b/tools/libfdt/fdt_empty_tree.c
new file mode 100644
index 0000000..9ccbb1f
--- /dev/null
+++ b/tools/libfdt/fdt_empty_tree.c
@@ -0,0 +1,2 @@ 
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt_empty_tree.c"
diff --git a/tools/libfdt/fdt_overlay.c b/tools/libfdt/fdt_overlay.c
new file mode 100644
index 0000000..801ec37
--- /dev/null
+++ b/tools/libfdt/fdt_overlay.c
@@ -0,0 +1,2 @@ 
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt_overlay.c"
diff --git a/tools/libfdt/fdt_strerror.c b/tools/libfdt/fdt_strerror.c
new file mode 100644
index 0000000..d7ed70b
--- /dev/null
+++ b/tools/libfdt/fdt_strerror.c
@@ -0,0 +1,2 @@ 
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt_strerror.c"
diff --git a/tools/libfdt/fdt_sw.c b/tools/libfdt/fdt_sw.c
new file mode 100644
index 0000000..ed6b327
--- /dev/null
+++ b/tools/libfdt/fdt_sw.c
@@ -0,0 +1,2 @@ 
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt_sw.c"