kbuild: change kbuild to not rely on incorrect GNU make behavior
[deliverable/linux.git] / arch / ppc / boot / openfirmware / Makefile
1 # Makefile for making bootable images on various OpenFirmware machines.
2 #
3 # This file is included by the global makefile so that you can add your own
4 # architecture-specific flags and dependencies.
5 #
6 # Paul Mackerras January 1997
7 # XCOFF bootable images for PowerMacs
8 # Geert Uytterhoeven September 1997
9 # ELF bootable iamges for CHRP machines.
10 # Tom Rini January 2001
11 # Cleaned up, moved into arch/ppc/boot/pmac
12 # Tom Rini July/August 2002
13 # Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
14 # rules.
15
16 zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
17 zImage.initrd znetboot.initrd: initrd := .initrd
18
19
20 boot := arch/ppc/boot
21 common := $(boot)/common
22 utils := $(boot)/utils
23 bootlib := $(boot)/lib
24 of1275 := $(boot)/of1275
25 images := $(boot)/images
26
27 CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
28
29 COMMONOBJS := start.o misc.o common.o
30 CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
31
32 targets := $(CHRPOBJS) dummy.o
33 CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
34
35 LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
36
37 ifdef CONFIG_SMP
38 END := .smp
39 endif
40 ifdef CONFIG_PPC64BRIDGE
41 END += .64
42 endif
43
44
45 $(images)/ramdisk.image.gz:
46 @echo ' MISSING $@'
47 @echo ' RAM disk image must be provided separately'
48 @/bin/false
49
50 quiet_cmd_genimage = GEN $@
51 cmd_genimage = $(OBJCOPY) -R .comment \
52 --add-section=.image=$(images)/vmlinux.gz \
53 --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
54
55 targets += image.o
56 $(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
57 $(call if_changed,genimage)
58
59 # Place the ramdisk in the initrd image.
60 quiet_cmd_genimage-initrd = GEN $@
61 cmd_genimage-initrd = $(OBJCOPY) $< $@ \
62 --add-section=.ramdisk=$(images)/ramdisk.image.gz \
63 --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
64 targets += image.initrd.o
65 $(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
66 $(call if_changed,genimage-initrd)
67
68
69 targets += crt0.o
70 $(obj)/crt0.o: $(common)/crt0.S FORCE
71 $(call if_changed_dep,as_o_S)
72
73 quiet_cmd_gen-chrp = CHRP $@
74 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
75 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
76
77 $(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
78 $(srctree)/$(boot)/ld.script
79 $(call cmd,gen-chrp)
80 $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
81 $(srctree)/$(boot)/ld.script
82 $(call cmd,gen-chrp)
83
84 quiet_cmd_addnote = ADDNOTE $@
85 cmd_addnote = cat $< > $@ && $(utils)/addnote $@
86 $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
87 %-rs6k: %
88 $(call cmd,addnote)
89
90 # The targets used on the make command-line
91
92 PHONY += zImage zImage.initrd
93 zImage: $(images)/zImage.chrp \
94 $(images)/zImage.chrp-rs6k
95 @echo ' kernel: $@ is ready ($<)'
96 zImage.initrd: $(images)/zImage.initrd.chrp \
97 $(images)/zImage.initrd.chrp-rs6k
98 @echo ' kernel: $@ is ready ($<)'
99
100 TFTPIMAGE := /tftpboot/zImage
101
102 PHONY += znetboot znetboot.initrd
103 znetboot: $(images)/zImage.chrp
104 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
105 @echo ' kernel: $@ is ready ($<)'
106 znetboot.initrd:$(images)/zImage.initrd.chrp
107 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
108 @echo ' kernel: $@ is ready ($<)'
109
This page took 0.031325 seconds and 5 git commands to generate.