diff options
Diffstat (limited to 'arch/powerpc/boot/Makefile')
-rw-r--r-- | arch/powerpc/boot/Makefile | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index b53d677f6742..840ae595a617 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -25,8 +25,9 @@ HOSTCC := gcc | |||
25 | BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ | 25 | BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ |
26 | $(shell $(CROSS32CC) -print-file-name=include) -fPIC | 26 | $(shell $(CROSS32CC) -print-file-name=include) -fPIC |
27 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc | 27 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
28 | BOOTLFLAGS := -T $(srctree)/$(src)/zImage.lds | ||
29 | OBJCOPYFLAGS := contents,alloc,load,readonly,data | 28 | OBJCOPYFLAGS := contents,alloc,load,readonly,data |
29 | OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 | ||
30 | OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment | ||
30 | 31 | ||
31 | zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c | 32 | zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c |
32 | zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h | 33 | zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h |
@@ -35,7 +36,7 @@ zliblinuxheader := zlib.h zconf.h zutil.h | |||
35 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) | 36 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) |
36 | #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) | 37 | #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) |
37 | 38 | ||
38 | src-boot := string.S prom.c main.c div64.S crt0.S | 39 | src-boot := crt0.S string.S prom.c stdio.c main.c div64.S |
39 | src-boot += $(zlib) | 40 | src-boot += $(zlib) |
40 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 41 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
41 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) | 42 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) |
@@ -70,7 +71,7 @@ quiet_cmd_bootas = BOOTAS $@ | |||
70 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< | 71 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< |
71 | 72 | ||
72 | quiet_cmd_bootld = BOOTLD $@ | 73 | quiet_cmd_bootld = BOOTLD $@ |
73 | cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2) | 74 | cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2) |
74 | 75 | ||
75 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c | 76 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c |
76 | $(call if_changed_dep,bootcc) | 77 | $(call if_changed_dep,bootcc) |
@@ -87,12 +88,14 @@ obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) | |||
87 | src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) | 88 | src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) |
88 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) | 89 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) |
89 | 90 | ||
90 | hostprogs-y := addnote addRamDisk | 91 | hostprogs-y := addnote addRamDisk hack-coff |
91 | targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ | 92 | |
92 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ | 93 | targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ |
93 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ | 94 | zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \ |
94 | $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ | 95 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ |
95 | vmlinux.initrd | 96 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ |
97 | $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ | ||
98 | vmlinux.initrd dummy.o | ||
96 | extra-y := initrd.o | 99 | extra-y := initrd.o |
97 | 100 | ||
98 | quiet_cmd_ramdisk = RAMDISK $@ | 101 | quiet_cmd_ramdisk = RAMDISK $@ |
@@ -114,6 +117,14 @@ quiet_cmd_addsection = ADDSEC $@ | |||
114 | quiet_cmd_addnote = ADDNOTE $@ | 117 | quiet_cmd_addnote = ADDNOTE $@ |
115 | cmd_addnote = $(obj)/addnote $@ | 118 | cmd_addnote = $(obj)/addnote $@ |
116 | 119 | ||
120 | quiet_cmd_gen-miboot = GEN $@ | ||
121 | cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \ | ||
122 | --add-section=$1=$(word 2, $^) $< $@ | ||
123 | |||
124 | quiet_cmd_gencoff = COFF $@ | ||
125 | cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \ | ||
126 | $(obj)/hack-coff $@ | ||
127 | |||
117 | $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % | 128 | $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % |
118 | $(call if_changed,gzip) | 129 | $(call if_changed,gzip) |
119 | 130 | ||
@@ -127,22 +138,47 @@ $(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c | |||
127 | $(call if_changed_dep,bootcc) | 138 | $(call if_changed_dep,bootcc) |
128 | $(call cmd,addsection) | 139 | $(call cmd,addsection) |
129 | 140 | ||
130 | $(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required)) | 141 | $(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required)) |
131 | $(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds | 142 | $(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds |
132 | $(call cmd,bootld,$(obj-boot)) | 143 | $(call cmd,bootld,$(obj-boot),zImage.lds) |
133 | 144 | ||
134 | $(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd)) | 145 | $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd)) |
135 | $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds | 146 | $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds |
136 | $(call cmd,bootld,$(obj-boot)) | 147 | $(call cmd,bootld,$(obj-boot),zImage.lds) |
148 | |||
149 | # For 32-bit powermacs, build the COFF and miboot images | ||
150 | # as well as the ELF images. | ||
151 | coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff | ||
152 | coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff | ||
153 | mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image | ||
154 | mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image | ||
137 | 155 | ||
138 | $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote | 156 | $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \ |
157 | $(mibootimg-y-y) | ||
139 | @cp -f $< $@ | 158 | @cp -f $< $@ |
140 | $(call if_changed,addnote) | 159 | $(call if_changed,addnote) |
141 | 160 | ||
142 | $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote | 161 | $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \ |
162 | $(coffrdimg-y-y) $(mibrdimg-y-y) | ||
143 | @cp -f $< $@ | 163 | @cp -f $< $@ |
144 | $(call if_changed,addnote) | 164 | $(call if_changed,addnote) |
145 | 165 | ||
166 | $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \ | ||
167 | $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff | ||
168 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) | ||
169 | $(call cmd,gencoff) | ||
170 | |||
171 | $(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \ | ||
172 | $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff | ||
173 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) | ||
174 | $(call cmd,gencoff) | ||
175 | |||
176 | $(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz | ||
177 | $(call cmd,gen-miboot,image) | ||
178 | |||
179 | $(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz | ||
180 | $(call cmd,gen-miboot,initrd) | ||
181 | |||
146 | #----------------------------------------------------------- | 182 | #----------------------------------------------------------- |
147 | # build u-boot images | 183 | # build u-boot images |
148 | #----------------------------------------------------------- | 184 | #----------------------------------------------------------- |