kbuild: change kbuild to not rely on incorrect GNU make behavior
[deliverable/linux.git] / arch / ppc / boot / openfirmware / Makefile
CommitLineData
1da177e4
LT
1# Makefile for making bootable images on various OpenFirmware machines.
2#
4f193362
PS
3# This file is included by the global makefile so that you can add your own
4# architecture-specific flags and dependencies.
5#
1da177e4
LT
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
16zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
17zImage.initrd znetboot.initrd: initrd := .initrd
18
19
20boot := arch/ppc/boot
21common := $(boot)/common
22utils := $(boot)/utils
23bootlib := $(boot)/lib
24of1275 := $(boot)/of1275
25images := $(boot)/images
26
1da177e4 27CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
1da177e4
LT
28
29COMMONOBJS := start.o misc.o common.o
1da177e4 30CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
1da177e4 31
a7fdd90b 32targets := $(CHRPOBJS) dummy.o
1da177e4 33CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
1da177e4
LT
34
35LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
36
1da177e4
LT
37ifdef CONFIG_SMP
38END := .smp
39endif
40ifdef CONFIG_PPC64BRIDGE
41END += .64
42endif
43
44
45$(images)/ramdisk.image.gz:
46 @echo ' MISSING $@'
47 @echo ' RAM disk image must be provided separately'
48 @/bin/false
49
1da177e4
LT
50quiet_cmd_genimage = GEN $@
51 cmd_genimage = $(OBJCOPY) -R .comment \
52 --add-section=.image=$(images)/vmlinux.gz \
6879dc13 53 --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
1da177e4
LT
54
55targets += 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.
60quiet_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
64targets += image.initrd.o
65$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
66 $(call if_changed,genimage-initrd)
67
1da177e4 68
a7fdd90b
PM
69targets += crt0.o
70$(obj)/crt0.o: $(common)/crt0.S FORCE
1da177e4
LT
71 $(call if_changed_dep,as_o_S)
72
1da177e4
LT
73quiet_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
84quiet_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
1da177e4
LT
90# The targets used on the make command-line
91
4f193362 92PHONY += zImage zImage.initrd
a7fdd90b
PM
93zImage: $(images)/zImage.chrp \
94 $(images)/zImage.chrp-rs6k
1da177e4 95 @echo ' kernel: $@ is ready ($<)'
a7fdd90b
PM
96zImage.initrd: $(images)/zImage.initrd.chrp \
97 $(images)/zImage.initrd.chrp-rs6k
1da177e4
LT
98 @echo ' kernel: $@ is ready ($<)'
99
100TFTPIMAGE := /tftpboot/zImage
101
4f193362 102PHONY += znetboot znetboot.initrd
a7fdd90b 103znetboot: $(images)/zImage.chrp
1da177e4
LT
104 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
105 @echo ' kernel: $@ is ready ($<)'
a7fdd90b 106znetboot.initrd:$(images)/zImage.initrd.chrp
1da177e4
LT
107 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
108 @echo ' kernel: $@ is ready ($<)'
109
This page took 0.120664 seconds and 5 git commands to generate.