[new uImage] Add libfdt support to mkimage
authorBartlomiej Sieka <tur@semihalf.com>
Fri, 29 Feb 2008 15:00:24 +0000 (16:00 +0100)
committerMarian Balakowicz <m8@semihalf.com>
Fri, 29 Feb 2008 15:00:24 +0000 (16:00 +0100)
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Makefile
include/libfdt_env.h
libfdt/fdt.c
libfdt/fdt_ro.c
libfdt/fdt_rw.c
libfdt/fdt_strerror.c
libfdt/fdt_wip.c
tools/.gitignore
tools/Makefile
tools/fdt_host.h [new file with mode: 0644]
tools/mkimage.h

index bacea3e3d318610d36e8bde085e6955a9d35fbd6..adfef9bbc0914a40c63eaa9731ff3a79a6b4dbd9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2927,6 +2927,9 @@ clobber:  clean
        @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
        @rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
        @rm -f $(obj)tools/sha1.c $(obj)tools/image.c
+       @rm -f $(obj)tools/fdt.c $(obj)tools/fdt_ro.c $(obj)tools/fdt_rw.c
+       @rm -f $(obj)tools/fdt_strerror.c $(obj)tools/fdt_wip.c
+       @rm -f $(obj)tools/libfdt_internal.h
        @rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
        @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
        @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f
index 78f725830da8b1a22b9682355df9ec320617f1b0..98c522ae42af7a5984d644548017576def326d2b 100644 (file)
 #include <stddef.h>
 #include <linux/types.h>
 #include <asm/byteorder.h>
+#ifdef USE_HOSTCC
+#include <string.h>
+#else
 #include <linux/string.h>
+#endif /* USE_HOSTCC */
 
 extern struct fdt_header *fdt;  /* Pointer to the working fdt */
 
index 586a36136db215fbffb450cfa475403d6755c311..071470dc94646b0575600d0b4852d4057dc635a7 100644 (file)
  */
 #include "libfdt_env.h"
 
+#ifndef USE_HOSTCC
 #include <fdt.h>
 #include <libfdt.h>
+#else
+#include "fdt_host.h"
+#endif
 
 #include "libfdt_internal.h"
 
index 12a37d59f96eba267235cf06962f7ccc7a6c2259..1ae3a5500394c32eea5d94ea99bb0faf08681bd7 100644 (file)
  */
 #include "libfdt_env.h"
 
+#ifndef USE_HOSTCC
 #include <fdt.h>
 #include <libfdt.h>
+#else
+#include "fdt_host.h"
+#endif
 
 #include "libfdt_internal.h"
 
index 6673f8ec962ad39510e25a36a56a3fd5cd5650d8..2fb81dd39888ce10d63c62983acb798d104e0aa9 100644 (file)
  */
 #include "libfdt_env.h"
 
+#ifndef USE_HOSTCC
 #include <fdt.h>
 #include <libfdt.h>
+#else
+#include "fdt_host.h"
+#endif
 
 #include "libfdt_internal.h"
 
index f9d32ef5360ab7acc84f23df066621b18f01f646..abf792e7de78faebb83ccd8c7b1267b4f21de2a8 100644 (file)
  */
 #include "libfdt_env.h"
 
+#ifndef USE_HOSTCC
 #include <fdt.h>
 #include <libfdt.h>
+#else
+#include "fdt_host.h"
+#endif
 
 #include "libfdt_internal.h"
 
index 88e24b8318f449e4ab7902fc27b4e7345948299d..24e172495aaeb63b4643ca4785d30f2b4451c682 100644 (file)
  */
 #include "libfdt_env.h"
 
+#ifndef USE_HOSTCC
 #include <fdt.h>
 #include <libfdt.h>
+#else
+#include "fdt_host.h"
+#endif
 
 #include "libfdt_internal.h"
 
index c33679a9d2778792549e4bbb6e77a2aaca74750d..0ce2e77bd6b8c7e7cdcbb98d81c8d177e585fde4 100644 (file)
@@ -7,3 +7,10 @@
 /mkimage
 /sha1.c
 /ubsha1
+/image.c
+/fdt.c
+/fdt_ro.c
+/fdt_rw.c
+/fdt_strerror.c
+/fdt_wip.c
+/libfdt_internal.h
index 0cc4cc9d174074374eabc4d42205a859dd27bb6b..aa4af1823b7810715e0afc1aae0eb6dee75a61ed 100644 (file)
@@ -37,6 +37,8 @@ endif
 #OBJ_FILES     += mpc86x_clk.o
 #endif
 
+LIBFDT_OBJ_FILES       = fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o
+
 LOGO_H = $(OBJTREE)/include/bmp_logo.h
 
 ifeq ($(LOGO_BMP),)
@@ -120,6 +122,10 @@ CPPFLAGS   = -idirafter $(SRCTREE)/include \
                -idirafter $(OBJTREE)/include \
                -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
 CFLAGS     = $(HOST_CFLAGS) $(CPPFLAGS) -O
+
+# No -pedantic switch to avoid libfdt compilation warnings
+FIT_CFLAGS = -Wall $(CPPFLAGS) -O
+
 AFLAGS    = -D__ASSEMBLY__ $(CPPFLAGS)
 CC        = $(HOSTCC)
 STRIP     = $(HOSTSTRIP)
@@ -137,7 +143,7 @@ $(obj)img2srec$(SFX):       $(obj)img2srec.o
                $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
                $(STRIP) $@
 
-$(obj)mkimage$(SFX):   $(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)sha1.o
+$(obj)mkimage$(SFX):   $(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)sha1.o $(LIBFDT_OBJ_FILES)
                $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
                $(STRIP) $@
 
@@ -174,10 +180,10 @@ $(obj)sha1.o:     $(obj)sha1.c
                $(CC) -g $(CFLAGS) -c -o $@ $<
 
 $(obj)image.o: $(obj)image.c
-               $(CC) -g $(CFLAGS) -c -o $@ $<
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)mkimage.o:       $(src)mkimage.c
-               $(CC) -g $(CFLAGS) -c -o $@ $<
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
 $(obj)ncb.o:           $(src)ncb.c
                $(CC) -g $(CFLAGS) -c -o $@ $<
@@ -191,6 +197,21 @@ $(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
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+
+$(obj)fdt_ro.o:        $(obj)fdt_ro.c
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+
+$(obj)fdt_rw.o:        $(obj)fdt_rw.c
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+
+$(obj)fdt_strerror.o:  $(obj)fdt_strerror.c
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+
+$(obj)fdt_wip.o:       $(obj)fdt_wip.c
+               $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+
 subdirs:
 ifeq ($(TOOLSUBDIRS),)
                @:
@@ -224,6 +245,30 @@ $(obj)image.c:
                @rm -f $(obj)image.c
                ln -s $(src)../common/image.c $(obj)image.c
 
+$(obj)fdt.c:   libfdt_internal.h
+               @rm -f $(obj)fdt.c
+               ln -s $(src)../libfdt/fdt.c $(obj)fdt.c
+
+$(obj)fdt_ro.c:        libfdt_internal.h
+               @rm -f $(obj)fdt_ro.c
+               ln -s $(src)../libfdt/fdt_ro.c $(obj)fdt_ro.c
+
+$(obj)fdt_rw.c:        libfdt_internal.h
+               @rm -f $(obj)fdt_rw.c
+               ln -s $(src)../libfdt/fdt_rw.c $(obj)fdt_rw.c
+
+$(obj)fdt_strerror.c:  libfdt_internal.h
+               @rm -f $(obj)fdt_strerror.c
+               ln -s $(src)../libfdt/fdt_strerror.c $(obj)fdt_strerror.c
+
+$(obj)fdt_wip.c:       libfdt_internal.h
+               @rm -f $(obj)fdt_wip.c
+               ln -s $(src)../libfdt/fdt_wip.c $(obj)fdt_wip.c
+
+$(obj)libfdt_internal.h:
+               @rm -f $(obj)libfdt_internal.h
+               ln -s $(src)../libfdt/libfdt_internal.h $(obj)libfdt_internal.h
+
 $(LOGO_H):     $(obj)bmp_logo $(LOGO_BMP)
                $(obj)./bmp_logo $(LOGO_BMP) >$@
 
diff --git a/tools/fdt_host.h b/tools/fdt_host.h
new file mode 100644 (file)
index 0000000..085013e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * (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__ */
index a01977ee65670c1a1541eba1e9680984bcc13011..cdd52bc9c2eae21d7bd7b74bf9badc0f0d6211bd 100644 (file)
@@ -33,6 +33,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <sha1.h>
+#include "fdt_host.h"
 
 #if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__)
 #include <inttypes.h>