scripts/dtc: add missing libfdt and fixups to import script
authorGaurav Minocha <gaurav.minocha.os@gmail.com>
Sun, 26 Apr 2015 05:53:08 +0000 (22:53 -0700)
committerRob Herring <robh@kernel.org>
Wed, 29 Apr 2015 21:08:05 +0000 (16:08 -0500)
The following script is used to import dtc upstream
into kernel. It was missing import of dtc/libfdt, with
this commit it will include the same.

Also, currently in arch and driver code that needs early access to
the flattened device tree it is necessary to add specific CFLAGS
so that when scripts/dtc/libfdt/libfdt.h is included the C
preprocessor is able to locate the libfdt versions of libfdt_env.h
and fdt.h without generating an error. So, this script replaces
angular brackets with quotation used to include header files
fdt.h and libfdt_env.h

Signed-off-by: Gaurav Minocha <gaurav.minocha.os@gmail.com>
[robh: reword commit headline and add 'git add']
Signed-off-by: Rob Herring <robh@kernel.org>
scripts/dtc/update-dtc-source.sh

index feb01ef26be4f8b1766e4e8a6b9e21d977c41fd4..f5cde799db03f3154cf4fe93f0c7a715e5a617f4 100755 (executable)
@@ -34,6 +34,7 @@ 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 Makefile.dtc \
                dtc-lexer.l dtc-parser.y"
 DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h"
+LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_empty_tree.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
 
 # Build DTC
 cd $DTC_UPSTREAM_PATH
@@ -50,5 +51,13 @@ for f in $DTC_GENERATED; do
        cp ${DTC_UPSTREAM_PATH}/$f ${f}_shipped
        git add ${f}_shipped
 done
+for f in $LIBFDT_SOURCE; do
+       cp ${DTC_UPSTREAM_PATH}/libfdt/${f} libfdt/${f}
+       git add libfdt/${f}
+done
+
+sed -i -- 's/#include <libfdt_env.h>/#include "libfdt_env.h"/g' ./libfdt/libfdt.h
+sed -i -- 's/#include <fdt.h>/#include "fdt.h"/g' ./libfdt/libfdt.h
+git add ./libfdt/libfdt.h
 
 git commit -e -v -m "scripts/dtc: Update to upstream version [CHANGEME]"