mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
9fffb55f66
The powerpc kernel always requires an Open Firmware like device tree to supply device information. On systems without OF, this comes from a flattened device tree blob. This blob is usually generated by dtc, a tool which compiles a text description of the device tree into the flattened format used by the kernel. Sometimes, the bootwrapper makes small changes to the pre-compiled device tree blob (e.g. filling in the size of RAM). To do this it uses the libfdt library. Because these are only used on powerpc, the code for both these tools is included under arch/powerpc/boot (these were imported and are periodically updated from the upstream dtc tree). However, the microblaze architecture, currently being prepared for merging to mainline also uses dtc to produce device tree blobs. A few other archs have also mentioned some interest in using dtc. Therefore, this patch moves dtc and libfdt from arch/powerpc into scripts, where it can be used by any architecture. The vast bulk of this patch is a literal move, the rest is adjusting the various Makefiles to use dtc and libfdt correctly from their new locations. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
55 lines
1.5 KiB
Makefile
55 lines
1.5 KiB
Makefile
# scripts/dtc makefile
|
|
|
|
hostprogs-y := dtc
|
|
always := $(hostprogs-y)
|
|
|
|
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
|
|
|
|
# Source files need to get at the userspace version of libfdt_env.h to compile
|
|
|
|
HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
|
|
|
|
HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
|
|
|
|
HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
|
|
HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
|
|
|
|
# dependencies on generated files need to be listed explicitly
|
|
$(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h
|
|
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h
|
|
|
|
targets += dtc-parser.tab.c dtc-lexer.lex.c
|
|
|
|
clean-files += dtc-parser.tab.h
|
|
|
|
# GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output
|
|
|
|
ifdef GENERATE_PARSER
|
|
|
|
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-parser.tab.c: $(src)/dtc-parser.y FORCE
|
|
$(call if_changed,bison)
|
|
|
|
$(obj)/dtc-parser.tab.h: $(obj)/dtc-parser.tab.c
|
|
|
|
$(obj)/dtc-lexer.lex.c: $(src)/dtc-lexer.l FORCE
|
|
$(call if_changed,flex)
|
|
|
|
endif
|