From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix out-of-tree tools/fdt build
Date: Mon, 8 Sep 2008 00:10:43 -0400 [thread overview]
Message-ID: <20080908041043.GA12846@cideas.com> (raw)
In-Reply-To: <20080906212150.D54D9248BB@gemini.denx.de>
The fdt header files must come from the u-boot versions when building
the tools (we must use the same definitions in the tools as in the
u-boot image). To ensure this, generate the "fdt_host.h" file in the
Makefile to use the full path to the u-boot fdt header files.
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
---
This is *NOT* a final answer. I'm still getting a build error that I
cannot figure out so I figured I would appeal to the Wisdom of the List.
In this patch, I'm auto-generating the fdt_host.h header to specifically
include the u-boot fdt headers (as opposed to the host's headers).
There may be better way(s) of doing this and there are the aforementioned
errors to fix. Treat this as a challenge for improvements. ;-)
Thanks,
gvb
Makefile | 1 +
include/image.h | 4 ++++
tools/Makefile | 36 ++++++++++++++++++++++++++----------
tools/fdt_host.h | 28 ----------------------------
tools/mkimage.h | 2 +-
5 files changed, 32 insertions(+), 39 deletions(-)
delete mode 100644 tools/fdt_host.h
diff --git a/Makefile b/Makefile
index 8d82ef5..be08685 100644
--- a/Makefile
+++ b/Makefile
@@ -3152,6 +3152,7 @@ clean:
@rm -f $(obj)nand_spl/{u-boot-spl,u-boot-spl.map,System.map}
@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map}
@rm -f $(obj)api_examples/demo $(VERSION_FILE)
+ @rm -f $(SRCTREE)/tools/fdt_host.h
@find $(OBJTREE) -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' \
-o -name '*.o' -o -name '*.a' \) -print \
diff --git a/include/image.h b/include/image.h
index 9be806e..f28e9fc 100644
--- a/include/image.h
+++ b/include/image.h
@@ -55,9 +55,13 @@
#endif
#if defined(CONFIG_FIT)
+#ifndef USE_HOSTCC
#include <fdt.h>
#include <libfdt.h>
#include <fdt_support.h>
+#else
+#include <fdt_host.h>
+#endif
#define CONFIG_MD5 /* FIT images need MD5 support */
#endif
diff --git a/tools/Makefile b/tools/Makefile
index 21ea1c2..5ab5456 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -124,9 +124,11 @@ BINS := $(addprefix $(obj),$(BIN_FILES))
CPPFLAGS = -idirafter $(SRCTREE)/include \
-idirafter $(OBJTREE)/include2 \
-idirafter $(OBJTREE)/include \
+ -idirafter $(OBJTREE)/tools \
-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O
+
# No -pedantic switch to avoid libfdt compilation warnings
FIT_CFLAGS = -Wall $(CPPFLAGS) -O
@@ -190,10 +192,10 @@ $(obj)md5.o: $(obj)md5.c
$(obj)sha1.o: $(obj)sha1.c
$(CC) -g $(CFLAGS) -c -o $@ $<
-$(obj)image.o: $(obj)image.c
+$(obj)image.o: $(obj)image.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-$(obj)mkimage.o: $(src)mkimage.c
+$(obj)mkimage.o: $(src)mkimage.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
$(obj)ncb.o: $(src)ncb.c
@@ -208,19 +210,19 @@ $(obj)inca-swap-bytes.o: $(src)inca-swap-bytes.c
$(obj)mpc86x_clk.o: $(src)mpc86x_clk.c
$(CC) -g $(CFLAGS) -c -o $@ $<
-$(obj)fdt.o: $(obj)fdt.c
+$(obj)fdt.o: $(obj)fdt.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-$(obj)fdt_ro.o: $(obj)fdt_ro.c
+$(obj)fdt_ro.o: $(obj)fdt_ro.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-$(obj)fdt_rw.o: $(obj)fdt_rw.c
+$(obj)fdt_rw.o: $(obj)fdt_rw.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-$(obj)fdt_strerror.o: $(obj)fdt_strerror.c
+$(obj)fdt_strerror.o: $(obj)fdt_strerror.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-$(obj)fdt_wip.o: $(obj)fdt_wip.c
+$(obj)fdt_wip.o: $(obj)fdt_wip.c $(obj)fdt_host.h
$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
subdirs:
@@ -266,9 +268,6 @@ $(obj)image.c:
if [ ! -f $(obj)mkimage.h ] ; then \
ln -s $(src)../tools/mkimage.h $(obj)mkimage.h; \
fi
- if [ ! -f $(obj)fdt_host.h ] ; then \
- ln -s $(src)../tools/fdt_host.h $(obj)fdt_host.h; \
- fi
$(obj)fdt.c: $(obj)libfdt_internal.h
@rm -f $(obj)fdt.c
@@ -297,6 +296,23 @@ $(obj)libfdt_internal.h:
$(LOGO_H): $(obj)bmp_logo $(LOGO_BMP)
$(obj)./bmp_logo $(LOGO_BMP) >$@
+#
+# fdt_host.h has to point to the u-boot version of the libfdt headers
+#
+$(obj)fdt_host.h:
+ echo "Auto-generating fdt_host.h"
+ @echo "/* AUTO GENERATED, do not edit manually */" > $@
+ @echo "" >> $@
+ @echo "#ifndef __FDT_HOST_H__" >> $@
+ @echo "#define __FDT_HOST_H__" >> $@
+ @echo "" >> $@
+ @echo "/* Include u-boot, *not* the host, version of libfdt include files */" >> $@
+ @echo "#include \"$(SRCTREE)/include/fdt.h\"" >> $@
+ @echo "#include \"$(SRCTREE)/include/libfdt.h\"" >> $@
+ @echo "#include \"$(SRCTREE)/include/fdt_support.h\"" >> $@
+ @echo "" >> $@
+ @echo "#endif /* __FDT_HOST_H__ */" >> $@
+
#########################################################################
# defines $(obj).depend target
diff --git a/tools/fdt_host.h b/tools/fdt_host.h
deleted file mode 100644
index 085013e..0000000
--- a/tools/fdt_host.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * (C) Copyright 2008 Semihalf
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef __FDT_HOST_H__
-#define __FDT_HOST_H__
-
-/* Make sure to include u-boot version of libfdt include files */
-#include "../include/fdt.h"
-#include "../include/libfdt.h"
-#include "../include/fdt_support.h"
-
-#endif /* __FDT_HOST_H__ */
diff --git a/tools/mkimage.h b/tools/mkimage.h
index a2d5248..be94a02 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -33,7 +33,7 @@
#include <time.h>
#include <unistd.h>
#include <sha1.h>
-#include "fdt_host.h"
+#include <fdt_host.h>
#define MKIMAGE_DEBUG
--
1.5.6.5
next prev parent reply other threads:[~2008-09-08 4:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 0:13 [U-Boot] libfdt/fdt_ro.c build issues Wolfgang Denk
2008-08-27 2:04 ` Jerry Van Baren
2008-08-27 7:42 ` Wolfgang Denk
2008-08-27 8:04 ` Wolfgang Denk
2008-08-27 11:42 ` JerryVanBaren
2008-09-06 21:21 ` Wolfgang Denk
2008-09-08 4:10 ` Jerry Van Baren [this message]
2008-09-08 4:28 ` [U-Boot] [PATCH] Fix out-of-tree tools/fdt build Jerry Van Baren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080908041043.GA12846@cideas.com \
--to=gvb.uboot@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.