Merge dtc
cover Merge dtc
Here is a revised set of patches to merge dtc into the kernel tree.
The various methods suggested for doing some sort of automagic git pull of the dtc repository into the kernel git all appear to me to be more trouble than they're worth at this stage. So, at this stage this is just a raw patch importing the source. I have scripts which make it an easy job to produce a patch updating the embedded copy of dtc.
If at some future point we want to move dtc to a more general place so it can be used by microblaze or other architectures as well, we can revisit how the import is done at that time.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 1/2 Merge dtc upstream source
This large patch incorporates a copy of dtc into the kernel source, in arch/powerpc/boot/dtc-src. This patch only imports the upstream sources verbatim, a later patches is needed to actually link it into the kernel Makefiles and use the embedded code during the kernel build.
--- arch/powerpc/boot/dtc-src/Makefile.dtc | 25 arch/powerpc/boot/dtc-src/checks.c | 750 +++++++ arch/powerpc/boot/dtc-src/data.c | 321 +++ arch/powerpc/boot/dtc-src/dtc-lexer.l | 328 +++ arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped | 2174 +++++++++++++++++++++ arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped | 1983 +++++++++++++++++++ arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped | 111 + arch/powerpc/boot/dtc-src/dtc-parser.y | 336 +++ arch/powerpc/boot/dtc-src/dtc.c | 231 ++ arch/powerpc/boot/dtc-src/dtc.h | 269 ++ arch/powerpc/boot/dtc-src/flattree.c | 968 +++++++++ arch/powerpc/boot/dtc-src/fstree.c | 94 arch/powerpc/boot/dtc-src/livetree.c | 305 ++ arch/powerpc/boot/dtc-src/srcpos.c | 105 + arch/powerpc/boot/dtc-src/srcpos.h | 75 arch/powerpc/boot/dtc-src/treesource.c | 275 ++ arch/powerpc/boot/dtc-src/version_gen.h | 1 17 files changed, 8351 insertions(+)
Patch is too big for the list (224k). Download from:
http://ozlabs.org/~dgibson/home/merge-dtc.patch
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 2/2 Use embedded dtc in kernel builds
In reply to David GibsonThis patch alters the kernel makefiles to build dtc from the sources embedded in the previous patch. It also changes the arch/powerpc/boot/wrapper script to use the embedded dtc, rather than expecting a copy of dtc already installed on the system.
--- arch/powerpc/boot/Makefile | 39 +++++++++++++++++++++++++++++++++++++-- arch/powerpc/boot/wrapper | 2 +- 2 files changed, 38 insertions(+), 3 deletions(-)
arch/powerpc/boot/Makefile +37 -2
@@ -112,17 +112,52 @@ $(patsubst %.S,%.o, $(filter %.S, $(src- $(obj)/wrapper.a: $(obj-wlib) FORCE $(call if_changed,bootar) -hostprogs-y := addnote addRamDisk hack-coff mktree +hostprogs-y := addnote addRamDisk hack-coff mktree dtc targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds wrapper :=$(srctree)/$(src)/wrapper -wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ +wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ $(wrapper) FORCE ############# +# Bits for building dtc +# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output + +dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o +dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o +dtc-objs := $(addprefix dtc-src/, $(dtc-objs)) + +# prerequisites on generated files needs to be explicit +$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h +$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h + +HOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/ + +targets += dtc-src/dtc-parser.tab.c +targets += dtc-src/dtc-lexer.lex.c + +ifdef DTC_GENPARSER +BISON = bison +FLEX = flex + +quiet_cmd_bison = BISON $@ + cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped +quiet_cmd_flex = FLEX $@ + cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped + +$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE + $(call if_changed,bison) + +$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c + +$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE + $(call if_changed,flex) +endif + +############# # Bits for building various flavours of zImage ifneq ($(CROSS32_COMPILE),)
arch/powerpc/boot/wrapper +1 -1
@@ -124,7 +124,7 @@ if [ -n "$dts" ]; then if [ -z "$dtb" ]; then dtb="$platform.dtb" fi - dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" + $object/dtc -O dtb -o "$dtb" -b 0 "$dts" fi if [ -z "$kernel" ]; then
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson