fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / ppc / boot / openfirmware / Makefile
1 # Makefile for making bootable images on various OpenFirmware machines.
2 #
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.
12
13 zImage.initrd znetboot.initrd: del-ramdisk-sec  := -R .ramdisk
14 zImage.initrd znetboot.initrd: initrd           := .initrd
15
16
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
23
24 CHRP_LD_ARGS    := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
25
26 COMMONOBJS      := start.o misc.o common.o
27 CHRPOBJS        := crt0.o     $(COMMONOBJS) chrpmain.o
28
29 targets         := $(CHRPOBJS) dummy.o
30 CHRPOBJS        := $(addprefix $(obj)/, $(CHRPOBJS))
31
32 LIBS            := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
33
34 ifdef CONFIG_SMP
35 END := .smp
36 endif
37 ifdef CONFIG_PPC64BRIDGE
38 END += .64
39 endif
40
41
42 $(images)/ramdisk.image.gz:
43         @echo '  MISSING $@'
44         @echo '          RAM disk image must be provided separately'
45         @/bin/false
46
47 quiet_cmd_genimage = GEN     $@
48       cmd_genimage = $(OBJCOPY) -R .comment       \
49         --add-section=.image=$(images)/vmlinux.gz \
50         --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
51
52 targets += image.o
53 $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
54         $(call if_changed,genimage)
55
56 # Place the ramdisk in the initrd image.
57 quiet_cmd_genimage-initrd = GEN     $@
58       cmd_genimage-initrd = $(OBJCOPY) $< $@ \
59         --add-section=.ramdisk=$(images)/ramdisk.image.gz \
60         --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
61 targets += image.initrd.o
62 $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
63         $(call if_changed,genimage-initrd)
64
65
66 targets += crt0.o
67 $(obj)/crt0.o: $(common)/crt0.S FORCE
68         $(call if_changed_dep,as_o_S)
69
70 quiet_cmd_gen-chrp = CHRP    $@
71       cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
72                         $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
73
74 $(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
75                                    $(srctree)/$(boot)/ld.script
76         $(call cmd,gen-chrp)
77 $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
78                                    $(srctree)/$(boot)/ld.script
79         $(call cmd,gen-chrp)
80
81 quiet_cmd_addnote = ADDNOTE $@
82       cmd_addnote = cat $< > $@ && $(utils)/addnote $@
83 $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
84         %-rs6k: %
85         $(call cmd,addnote)
86
87 # The targets used on the make command-line
88
89 .PHONY: zImage zImage.initrd
90 zImage:          $(images)/zImage.chrp          \
91                  $(images)/zImage.chrp-rs6k
92         @echo '  kernel: $@ is ready ($<)'
93 zImage.initrd:   $(images)/zImage.initrd.chrp           \
94                  $(images)/zImage.initrd.chrp-rs6k
95         @echo '  kernel: $@ is ready ($<)'
96
97 TFTPIMAGE       := /tftpboot/zImage
98
99 .PHONY: znetboot znetboot.initrd
100 znetboot:       $(images)/zImage.chrp
101         cp $(images)/zImage.chrp      $(TFTPIMAGE).chrp$(END)
102         @echo '  kernel: $@ is ready ($<)'
103 znetboot.initrd:$(images)/zImage.initrd.chrp
104         cp $(images)/zImage.initrd.chrp      $(TFTPIMAGE).chrp$(END)
105         @echo '  kernel: $@ is ready ($<)'
106