diff options
Diffstat (limited to 'arch/powerpc/boot/Makefile')
-rw-r--r-- | arch/powerpc/boot/Makefile | 95 |
1 files changed, 91 insertions, 4 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 18e32719d0ed..9149bb8ed03c 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -33,7 +33,7 @@ ifeq ($(call cc-option-yn, -fstack-protector),y) | |||
33 | BOOTCFLAGS += -fno-stack-protector | 33 | BOOTCFLAGS += -fno-stack-protector |
34 | endif | 34 | endif |
35 | 35 | ||
36 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | 36 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt |
37 | 37 | ||
38 | $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 | 38 | $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 |
39 | $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 | 39 | $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 |
@@ -46,7 +46,9 @@ zliblinuxheader := zlib.h zconf.h zutil.h | |||
46 | $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ | 46 | $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ |
47 | $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) | 47 | $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) |
48 | 48 | ||
49 | src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ | 49 | src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c |
50 | src-wlib := string.S crt0.S stdio.c main.c \ | ||
51 | $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ | ||
50 | ns16550.c serial.c simple_alloc.c div64.S util.S \ | 52 | ns16550.c serial.c simple_alloc.c div64.S util.S \ |
51 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ | 53 | gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ |
52 | 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ | 54 | 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ |
@@ -101,24 +103,61 @@ quiet_cmd_bootar = BOOTAR $@ | |||
101 | cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ | 103 | cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ |
102 | 104 | ||
103 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE | 105 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE |
106 | $(Q)mkdir -p $(dir $@) | ||
104 | $(call if_changed_dep,bootcc) | 107 | $(call if_changed_dep,bootcc) |
105 | $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE | 108 | $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE |
109 | $(Q)mkdir -p $(dir $@) | ||
106 | $(call if_changed_dep,bootas) | 110 | $(call if_changed_dep,bootas) |
107 | 111 | ||
108 | $(obj)/wrapper.a: $(obj-wlib) FORCE | 112 | $(obj)/wrapper.a: $(obj-wlib) FORCE |
109 | $(call if_changed,bootar) | 113 | $(call if_changed,bootar) |
110 | 114 | ||
111 | hostprogs-y := addnote addRamDisk hack-coff mktree | 115 | hostprogs-y := addnote addRamDisk hack-coff mktree dtc |
112 | 116 | ||
113 | targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) | 117 | targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) |
114 | extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ | 118 | extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ |
115 | $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds | 119 | $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds |
116 | 120 | ||
117 | wrapper :=$(srctree)/$(src)/wrapper | 121 | wrapper :=$(srctree)/$(src)/wrapper |
118 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ | 122 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ |
119 | $(wrapper) FORCE | 123 | $(wrapper) FORCE |
120 | 124 | ||
121 | ############# | 125 | ############# |
126 | # Bits for building dtc | ||
127 | # DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output | ||
128 | |||
129 | dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o | ||
130 | dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o | ||
131 | dtc-objs := $(addprefix dtc-src/, $(dtc-objs)) | ||
132 | |||
133 | # prerequisites on generated files needs to be explicit | ||
134 | $(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h | ||
135 | $(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h | ||
136 | |||
137 | HOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/ | ||
138 | |||
139 | targets += dtc-src/dtc-parser.tab.c | ||
140 | targets += dtc-src/dtc-lexer.lex.c | ||
141 | |||
142 | ifdef DTC_GENPARSER | ||
143 | BISON = bison | ||
144 | FLEX = flex | ||
145 | |||
146 | quiet_cmd_bison = BISON $@ | ||
147 | cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped | ||
148 | quiet_cmd_flex = FLEX $@ | ||
149 | cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped | ||
150 | |||
151 | $(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE | ||
152 | $(call if_changed,bison) | ||
153 | |||
154 | $(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c | ||
155 | |||
156 | $(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE | ||
157 | $(call if_changed,flex) | ||
158 | endif | ||
159 | |||
160 | ############# | ||
122 | # Bits for building various flavours of zImage | 161 | # Bits for building various flavours of zImage |
123 | 162 | ||
124 | ifneq ($(CROSS32_COMPILE),) | 163 | ifneq ($(CROSS32_COMPILE),) |
@@ -243,3 +282,51 @@ clean-kernel := vmlinux.strip vmlinux.bin | |||
243 | clean-kernel += $(addsuffix .gz,$(clean-kernel)) | 282 | clean-kernel += $(addsuffix .gz,$(clean-kernel)) |
244 | # If not absolute clean-files are relative to $(obj). | 283 | # If not absolute clean-files are relative to $(obj). |
245 | clean-files += $(addprefix $(objtree)/, $(clean-kernel)) | 284 | clean-files += $(addprefix $(objtree)/, $(clean-kernel)) |
285 | |||
286 | WRAPPER_OBJDIR := /usr/lib/kernel-wrapper | ||
287 | WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts | ||
288 | WRAPPER_BINDIR := /usr/sbin | ||
289 | INSTALL := install | ||
290 | |||
291 | extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) | ||
292 | hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) | ||
293 | wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper | ||
294 | dts-installed := $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts)) | ||
295 | |||
296 | all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) | ||
297 | |||
298 | quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
299 | cmd_mkdir = mkdir -p $@ | ||
300 | |||
301 | quiet_cmd_install = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@) | ||
302 | cmd_install = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ | ||
303 | |||
304 | quiet_cmd_install_dts = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@) | ||
305 | cmd_install_dts = $(INSTALL) -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ | ||
306 | |||
307 | quiet_cmd_install_exe = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) | ||
308 | cmd_install_exe = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ | ||
309 | |||
310 | quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@) | ||
311 | cmd_install_wrapper = $(INSTALL) -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\ | ||
312 | sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \ | ||
313 | -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \ | ||
314 | |||
315 | |||
316 | $(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR): | ||
317 | $(call cmd,mkdir) | ||
318 | |||
319 | $(extra-installed) : $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR) | ||
320 | $(call cmd,install) | ||
321 | |||
322 | $(hostprogs-installed) : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR) | ||
323 | $(call cmd,install_exe) | ||
324 | |||
325 | $(dts-installed) : $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR) | ||
326 | $(call cmd,install_dts) | ||
327 | |||
328 | $(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR) | ||
329 | $(call cmd,install_wrapper) | ||
330 | |||
331 | $(obj)/bootwrapper_install: $(all-installed) | ||
332 | |||