MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / ppc / boot / openfirmware / Makefile
blob4eacbd8c772a7fb67833770ea4ab87884b952da5
1 # Makefile for making bootable images on various OpenFirmware machines.
3 # Paul Mackerras January 1997
4 # XCOFF bootable images for PowerMacs
5 # Geert Uytterhoeven September 1997
6 # ELF bootable iamges for CHRP machines.
7 # Tom Rini January 2001
8 # Cleaned up, moved into arch/ppc/boot/pmac
9 # Tom Rini July/August 2002
10 # Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
11 # rules.
13 zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
14 zImage.initrd znetboot.initrd: initrd := .initrd
17 boot := arch/ppc/boot
18 common := $(boot)/common
19 utils := $(boot)/utils
20 bootlib := $(boot)/lib
21 of1275 := $(boot)/of1275
22 images := $(boot)/images
24 OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
25 COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \
26 -Bstatic
27 CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
28 NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000
30 COMMONOBJS := start.o misc.o common.o
31 COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o
32 CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
33 NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o
35 targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o
36 COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS))
37 CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
38 NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS))
40 LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
42 HACKCOFF := $(utils)/hack-coff
44 ifdef CONFIG_SMP
45 END := .smp
46 endif
47 ifdef CONFIG_PPC64BRIDGE
48 END += .64
49 endif
52 $(images)/ramdisk.image.gz:
53 @echo ' MISSING $@'
54 @echo ' RAM disk image must be provided separately'
55 @/bin/false
57 objcpxmon-$(CONFIG_XMON) := --add-section=.sysmap=System.map \
58 --set-section-flags=.sysmap=contents,alloc,load,readonly,data
59 quiet_cmd_genimage = GEN $@
60 cmd_genimage = $(OBJCOPY) -R .comment \
61 --add-section=.image=$(images)/vmlinux.gz \
62 --set-section-flags=.image=contents,alloc,load,readonly,data \
63 $(objcpxmon-y) $< $@
65 targets += image.o
66 $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
67 $(call if_changed,genimage)
69 # Place the ramdisk in the initrd image.
70 quiet_cmd_genimage-initrd = GEN $@
71 cmd_genimage-initrd = $(OBJCOPY) $< $@ \
72 --add-section=.ramdisk=$(images)/ramdisk.image.gz \
73 --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
74 targets += image.initrd.o
75 $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
76 $(call if_changed,genimage-initrd)
78 # Create the note section for New-World PowerMacs.
79 quiet_cmd_mknote = MKNOTE $@
80 cmd_mknote = $(utils)/mknote > $@
81 targets += note
82 $(obj)/note: $(utils)/mknote FORCE
83 $(call if_changed,mknote)
86 $(obj)/coffcrt0.o: EXTRA_AFLAGS := -traditional -DXCOFF
87 $(obj)/crt0.o: EXTRA_AFLAGS := -traditional
88 targets += coffcrt0.o crt0.o
89 $(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE
90 $(call if_changed_dep,as_o_S)
92 quiet_cmd_gencoffb = COFF $@
93 cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \
94 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
95 targets += coffboot
96 $(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE
97 $(call if_changed,gencoffb)
98 targets += coffboot.initrd
99 $(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \
100 $(srctree)/$(boot)/ld.script FORCE
101 $(call if_changed,gencoffb)
104 quiet_cmd_gen-coff = COFF $@
105 cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \
106 $(HACKCOFF) $@ && \
107 ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac
109 $(images)/vmlinux.coff: $(obj)/coffboot
110 $(call cmd,gen-coff)
112 $(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
113 $(call cmd,gen-coff)
115 quiet_cmd_gen-elf-pmac = ELF $@
116 cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \
117 $(NEWWORLDOBJS) $(LIBS) $< && \
118 $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \
119 -R .comment $(del-ramdisk-sec)
121 $(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \
122 $(obj)/note $(srctree)/$(boot)/ld.script
123 $(call cmd,gen-elf-pmac)
124 $(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
125 $(LIBS) $(obj)/note \
126 $(srctree)/$(boot)/ld.script
127 $(call cmd,gen-elf-pmac)
129 quiet_cmd_gen-chrp = CHRP $@
130 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
131 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
133 $(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
134 $(srctree)/$(boot)/ld.script
135 $(call cmd,gen-chrp)
136 $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
137 $(srctree)/$(boot)/ld.script
138 $(call cmd,gen-chrp)
140 quiet_cmd_addnote = ADDNOTE $@
141 cmd_addnote = cat $< > $@ && $(utils)/addnote $@
142 $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
143 %-rs6k: %
144 $(call cmd,addnote)
146 quiet_cmd_gen-miboot = GEN $@
147 cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \
148 --add-section=$1=$(word 2, $^) $< $@
149 $(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
150 $(call cmd,gen-miboot,image)
152 $(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
153 $(call cmd,gen-miboot,initrd)
155 # The targets used on the make command-line
157 .PHONY: zImage zImage.initrd
158 zImage: $(images)/vmlinux.coff \
159 $(images)/vmlinux.elf-pmac \
160 $(images)/zImage.chrp \
161 $(images)/zImage.chrp-rs6k \
162 $(images)/miboot.image
163 @echo ' kernel: $@ is ready ($<)'
164 zImage.initrd: $(images)/vmlinux.initrd.coff \
165 $(images)/vmlinux.initrd.elf-pmac \
166 $(images)/zImage.initrd.chrp \
167 $(images)/zImage.initrd.chrp-rs6k \
168 $(images)/miboot.initrd.image
169 @echo ' kernel: $@ is ready ($<)'
171 TFTPIMAGE := /tftpboot/zImage
173 .PHONY: znetboot znetboot.initrd
174 znetboot: $(images)/vmlinux.coff \
175 $(images)/vmlinux.elf-pmac \
176 $(images)/zImage.chrp
177 cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
178 cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf
179 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
180 @echo ' kernel: $@ is ready ($<)'
181 znetboot.initrd:$(images)/vmlinux.initrd.coff \
182 $(images)/vmlinux.initrd.elf-pmac \
183 $(images)/zImage.initrd.chrp
184 cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
185 cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
186 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
187 @echo ' kernel: $@ is ready ($<)'