summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-17 13:42:43 +0900
committerTom Rini <trini@konsulko.com>2017-11-17 07:43:32 -0500
commit15b97f5c5e6d88e0560c6928f3acd01c999a494d (patch)
tree4b2416c2278d5a8c1ca3248a594d68753eea5673 /tools
parent999a78d5cf00dfb8cd8342454933ea492e955377 (diff)
pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile
The pylibfdt is used by dtoc (and, indirectly by binman), but there is no reason why it must be generated in the tools/ directory. Recently, U-Boot switched over to the bundled DTC, and the directory structure under scripts/dtc/ now mirrors the upstream DTC project. So, scripts/dtc/pylibfdt is the best location. I also rewrote the Makefile in a cleaner Kbuild style. The scripts from the upstream have been moved as follows: lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped The .i_shipped is coped to .i during building because the .i must be located in the objtree when we build it out of tree. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/.gitignore4
-rw-r--r--tools/Makefile30
-rwxr-xr-xtools/binman/binman.py2
3 files changed, 1 insertions, 35 deletions
diff --git a/tools/.gitignore b/tools/.gitignore
index 5293d44697..6a487d2202 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -1,4 +1,3 @@
-/_libfdt.so
/atmel_pmecc_params
/bin2header
/bmp_logo
@@ -17,9 +16,6 @@
/img2srec
/kwboot
/lib/
-/libfdt.py
-/libfdt.pyc
-/libfdt_wrap.c
/mips-relocs
/mkenvimage
/mkexynosspl
diff --git a/tools/Makefile b/tools/Makefile
index 5db2a54225..2b87e184f3 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -63,15 +63,6 @@ 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
-# Unfortunately setup.py below cannot handle srctree being ".." which it often
-# is. It fails with an error like:
-# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
-# No such file or directory
-# To fix this, use an absolute path.
-libfdt_tree := $(shell readlink -f $(srctree)/lib/libfdt)
-
-LIBFDT_SRCS := $(addprefix $(libfdt_tree)/, $(LIBFDT_CSRCS))
-LIBFDT_SWIG := $(addprefix $(libfdt_tree)/, pylibfdt/libfdt.i)
LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS)))
RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
@@ -123,23 +114,6 @@ mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o
fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
-# Unfortunately setup.py (or actually the Python distutil implementation)
-# puts files into the same directory as the .i file. We cannot touch the source
-# directory, so we copy the .i file into the tools/ build subdirectory before
-# calling setup. This directory is safe to write to. This ensures that we get
-# all three files in $(obj)/tools: _libfdt.so, libfdt.py and libfdt_wrap.c
-# The latter is a temporary file which we could actually remove.
-tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG)
- $(Q)cp $(LIBFDT_SWIG) tools/.
- $(Q)unset CC; \
- unset CROSS_COMPILE; \
- LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= VERSION="u-boot-$(UBOOTVERSION)" \
- CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \
- SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \
- SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \
- $(PYTHON) $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \
- --build-lib tools
-
ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
# Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
# the mxsimage support within tools/mxsimage.c .
@@ -231,10 +205,6 @@ clean-dirs := lib common
always := $(hostprogs-y)
-# Build a libfdt Python module if swig is available
-# Use 'sudo apt-get install swig libpython-dev' to enable this
-always += $(if $(shell which swig 2> /dev/null),_libfdt.so)
-
# Generated LCD/video logo
LOGO_H = $(objtree)/include/bmp_logo.h
LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 09dc36a3f7..e75a59d951 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -21,7 +21,7 @@ for dirname in ['../patman', '../dtoc', '..']:
sys.path.insert(0, os.path.join(our_path, dirname))
# Bring in the libfdt module
-sys.path.insert(0, 'tools')
+sys.path.insert(0, 'scripts/dtc/pylibfdt')
# Also allow entry-type modules to be brought in from the etype directory.
sys.path.insert(0, os.path.join(our_path, 'etype'))