diff options
Diffstat (limited to 'arch/powerpc/boot/Makefile')
-rw-r--r-- | arch/powerpc/boot/Makefile | 122 |
1 files changed, 62 insertions, 60 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index dc779407de14..3716594ea33e 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -40,10 +40,11 @@ zliblinuxheader := zlib.h zconf.h zutil.h | |||
40 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ | 40 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ |
41 | $(addprefix $(obj)/,$(zlibheader)) | 41 | $(addprefix $(obj)/,$(zlibheader)) |
42 | 42 | ||
43 | src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ | 43 | src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ |
44 | ns16550.c serial.c simple_alloc.c div64.S util.S $(zlib) | 44 | ns16550.c serial.c simple_alloc.c div64.S util.S \ |
45 | src-plat := of.c | 45 | gunzip_util.c elf_util.c $(zlib) devtree.c |
46 | src-boot := crt0.S $(src-wlib) $(src-plat) empty.c | 46 | src-plat := of.c cuboot-83xx.c cuboot-85xx.c |
47 | src-boot := $(src-wlib) $(src-plat) empty.c | ||
47 | 48 | ||
48 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 49 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
49 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) | 50 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) |
@@ -75,7 +76,7 @@ $(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S | |||
75 | @cp $< $@ | 76 | @cp $< $@ |
76 | 77 | ||
77 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ | 78 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ |
78 | empty.c zImage zImage.coff.lds zImage.lds zImage.sandpoint | 79 | empty.c zImage.coff.lds zImage.lds |
79 | 80 | ||
80 | quiet_cmd_bootcc = BOOTCC $@ | 81 | quiet_cmd_bootcc = BOOTCC $@ |
81 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< | 82 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< |
@@ -84,23 +85,25 @@ quiet_cmd_bootas = BOOTAS $@ | |||
84 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< | 85 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< |
85 | 86 | ||
86 | quiet_cmd_bootar = BOOTAR $@ | 87 | quiet_cmd_bootar = BOOTAR $@ |
87 | cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $^; mv $@.$$$$ $@ | 88 | cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ |
88 | 89 | ||
89 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c | 90 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE |
90 | $(call if_changed_dep,bootcc) | 91 | $(call if_changed_dep,bootcc) |
91 | $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S | 92 | $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE |
92 | $(call if_changed_dep,bootas) | 93 | $(call if_changed_dep,bootas) |
93 | 94 | ||
94 | $(obj)/wrapper.a: $(obj-wlib) | 95 | $(obj)/wrapper.a: $(obj-wlib) FORCE |
95 | $(call cmd,bootar) | 96 | $(call if_changed,bootar) |
96 | 97 | ||
97 | hostprogs-y := addnote addRamDisk hack-coff mktree | 98 | hostprogs-y := addnote addRamDisk hack-coff mktree |
98 | 99 | ||
99 | extra-y := $(obj)/crt0.o $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ | 100 | targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) |
101 | extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ | ||
100 | $(obj)/zImage.lds $(obj)/zImage.coff.lds | 102 | $(obj)/zImage.lds $(obj)/zImage.coff.lds |
101 | 103 | ||
102 | wrapper :=$(srctree)/$(src)/wrapper | 104 | wrapper :=$(srctree)/$(src)/wrapper |
103 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) | 105 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ |
106 | $(wrapper) FORCE | ||
104 | 107 | ||
105 | ############# | 108 | ############# |
106 | # Bits for building various flavours of zImage | 109 | # Bits for building various flavours of zImage |
@@ -113,50 +116,10 @@ CROSSWRAP := -C "$(CROSS_COMPILE)" | |||
113 | endif | 116 | endif |
114 | endif | 117 | endif |
115 | 118 | ||
119 | # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd | ||
116 | quiet_cmd_wrap = WRAP $@ | 120 | quiet_cmd_wrap = WRAP $@ |
117 | cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux | 121 | cmd_wrap =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ |
118 | quiet_cmd_wrap_initrd = WRAP $@ | 122 | $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux |
119 | cmd_wrap_initrd =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ | ||
120 | -i $(obj)/ramdisk.image.gz vmlinux | ||
121 | |||
122 | $(obj)/zImage.chrp: vmlinux $(wrapperbits) | ||
123 | $(call cmd,wrap,chrp) | ||
124 | |||
125 | $(obj)/zImage.initrd.chrp: vmlinux $(wrapperbits) | ||
126 | $(call cmd,wrap_initrd,chrp) | ||
127 | |||
128 | $(obj)/zImage.pseries: vmlinux $(wrapperbits) | ||
129 | $(call cmd,wrap,pseries) | ||
130 | |||
131 | $(obj)/zImage.initrd.pseries: vmlinux $(wrapperbits) | ||
132 | $(call cmd,wrap_initrd,pseries) | ||
133 | |||
134 | $(obj)/zImage.pmac: vmlinux $(wrapperbits) | ||
135 | $(call cmd,wrap,pmac) | ||
136 | |||
137 | $(obj)/zImage.initrd.pmac: vmlinux $(wrapperbits) | ||
138 | $(call cmd,wrap_initrd,pmac) | ||
139 | |||
140 | $(obj)/zImage.coff: vmlinux $(wrapperbits) | ||
141 | $(call cmd,wrap,pmaccoff) | ||
142 | |||
143 | $(obj)/zImage.initrd.coff: vmlinux $(wrapperbits) | ||
144 | $(call cmd,wrap_initrd,pmaccoff) | ||
145 | |||
146 | $(obj)/zImage.miboot: vmlinux $(wrapperbits) | ||
147 | $(call cmd,wrap,miboot) | ||
148 | |||
149 | $(obj)/zImage.initrd.miboot: vmlinux $(wrapperbits) | ||
150 | $(call cmd,wrap_initrd,miboot) | ||
151 | |||
152 | $(obj)/zImage.ps3: vmlinux | ||
153 | $(STRIP) -s -R .comment $< -o $@ | ||
154 | |||
155 | $(obj)/zImage.initrd.ps3: vmlinux | ||
156 | @echo " WARNING zImage.initrd.ps3 not supported (yet)" | ||
157 | |||
158 | $(obj)/uImage: vmlinux $(wrapperbits) | ||
159 | $(call cmd,wrap,uboot) | ||
160 | 123 | ||
161 | image-$(CONFIG_PPC_PSERIES) += zImage.pseries | 124 | image-$(CONFIG_PPC_PSERIES) += zImage.pseries |
162 | image-$(CONFIG_PPC_MAPLE) += zImage.pseries | 125 | image-$(CONFIG_PPC_MAPLE) += zImage.pseries |
@@ -166,7 +129,7 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries | |||
166 | image-$(CONFIG_PPC_CHRP) += zImage.chrp | 129 | image-$(CONFIG_PPC_CHRP) += zImage.chrp |
167 | image-$(CONFIG_PPC_EFIKA) += zImage.chrp | 130 | image-$(CONFIG_PPC_EFIKA) += zImage.chrp |
168 | image-$(CONFIG_PPC_PMAC) += zImage.pmac | 131 | image-$(CONFIG_PPC_PMAC) += zImage.pmac |
169 | image-$(CONFIG_DEFAULT_UIMAGE) += uImage | 132 | image-$(CONFIG_DEFAULT_UIMAGE) += uImage cuImage |
170 | 133 | ||
171 | # For 32-bit powermacs, build the COFF and miboot images | 134 | # For 32-bit powermacs, build the COFF and miboot images |
172 | # as well as the ELF images. | 135 | # as well as the ELF images. |
@@ -174,16 +137,55 @@ ifeq ($(CONFIG_PPC32),y) | |||
174 | image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot | 137 | image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot |
175 | endif | 138 | endif |
176 | 139 | ||
140 | initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) | ||
177 | initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y)) | 141 | initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y)) |
142 | initrd-y := $(filter-out $(image-y), $(initrd-y)) | ||
143 | targets += $(image-y) $(initrd-y) | ||
144 | |||
145 | $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz | ||
146 | |||
147 | # Don't put the ramdisk on the pattern rule; when its missing make will try | ||
148 | # the pattern rule with less dependencies that also matches (even with the | ||
149 | # hard dependency listed). | ||
150 | $(obj)/zImage.initrd.%: vmlinux $(wrapperbits) | ||
151 | $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) | ||
152 | |||
153 | $(obj)/zImage.%: vmlinux $(wrapperbits) | ||
154 | $(call if_changed,wrap,$*) | ||
155 | |||
156 | $(obj)/zImage.ps3: vmlinux | ||
157 | $(STRIP) -s -R .comment $< -o $@ | ||
158 | |||
159 | $(obj)/zImage.initrd.ps3: vmlinux | ||
160 | @echo " WARNING zImage.initrd.ps3 not supported (yet)" | ||
161 | |||
162 | $(obj)/uImage: vmlinux $(wrapperbits) | ||
163 | $(call if_changed,wrap,uboot) | ||
164 | |||
165 | cuboot-plat-$(CONFIG_83xx) += 83xx | ||
166 | cuboot-plat-$(CONFIG_85xx) += 85xx | ||
167 | cuboot-plat-y += unknown-platform | ||
168 | |||
169 | dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\ | ||
170 | ,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE) | ||
171 | |||
172 | $(obj)/cuImage: vmlinux $(wrapperbits) | ||
173 | $(call if_changed,wrap,cuboot-$(word 1,$(cuboot-plat-y)),$(dts)) | ||
178 | 174 | ||
179 | $(obj)/zImage: $(addprefix $(obj)/, $(image-y)) | 175 | $(obj)/zImage: $(addprefix $(obj)/, $(image-y)) |
180 | @rm -f $@; ln $< $@ | 176 | @rm -f $@; ln $< $@ |
181 | $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) | 177 | $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) |
182 | @rm -f $@; ln $< $@ | 178 | @rm -f $@; ln $< $@ |
183 | 179 | ||
184 | install: $(CONFIGURE) $(image-y) | 180 | install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) |
185 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< | 181 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< |
186 | 182 | ||
187 | clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip.gz) | 183 | # anything not in $(targets) |
188 | clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.bin.gz) | 184 | clean-files += $(image-) $(initrd-) zImage zImage.initrd \ |
189 | clean-files += $(image-) | 185 | cuImage.elf cuImage.bin.gz |
186 | |||
187 | # clean up files cached by wrapper | ||
188 | clean-kernel := vmlinux.strip vmlinux.bin | ||
189 | clean-kernel += $(addsuffix .gz,$(clean-kernel)) | ||
190 | # If not absolute clean-files are relative to $(obj). | ||
191 | clean-files += $(addprefix $(objtree)/, $(clean-kernel)) | ||