1#
2# Makefile for making ELF bootable images for booting on CHRP
3# using Open Firmware.
4#
5# Geert Uytterhoeven	September 1997
6#
7# Based on coffboot by Paul Mackerras
8
9USE_STANDARD_AS_RULE := true
10
11LD_ARGS = -T ../ld.script -Ttext 0x00400000
12
13OBJS = ../common/crt0.o start.o main.o misc.o ../common/string.o image.o \
14	../common/ofcommon.o
15LIBS = $(TOPDIR)/lib/lib.a ../lib/zlib.a ../of1275/of1275.a
16ADDNOTE = ../utils/addnote
17PIGGYBACK = ../utils/piggyback
18
19ifeq ($(CONFIG_PPC64BRIDGE),y)
20END += .64
21AFLAGS += -Wa,-mppc64bridge
22endif
23ifeq ($(CONFIG_SMP),y)
24END += .smp
25endif
26
27TFTPIMAGE=/tftpboot/zImage.chrp$(END)
28
29AFLAGS_../common/crt0.o		+= -I$(TOPDIR)/arch/$(ARCH)/kernel
30
31all: zImage
32
33znetboot: zImage
34	cp -f $(TOPDIR)/vmlinux /tftpboot/vmlinux$(END)
35	cp ../images/zImage.chrp $(TFTPIMAGE)
36
37znetboot.initrd: zImage.initrd
38	cp ../images/zImage.initrd.chrp $(TFTPIMAGE)
39
40floppy: zImage
41	mcopy zImage a:zImage
42
43image.o: ../images/vmlinux.gz ../common/dummy.o
44	$(OBJCOPY) ../common/dummy.o $@ \
45		--add-section=.image=../images/vmlinux.gz \
46		--set-section-flags=.image=contents,alloc,load,readonly,data
47ifdef CONFIG_XMON
48	$(OBJCOPY) $@ $@ \
49		--add-section=.sysmap=$(TOPDIR)/System.map \
50		--set-section-flags=.sysmap=contents,alloc,load,readonly,data
51endif
52
53zImage: $(OBJS) $(LIBS) $(ADDNOTE) ../ld.script
54	$(LD) $(LD_ARGS) -o ../images/$@.chrp $(OBJS) $(LIBS)
55	$(OBJCOPY) ../images/$@.chrp ../images/$@.chrp -R .comment -R .ramdisk
56	cp ../images/$@.chrp ../images/$@.chrp-rs6k
57	$(ADDNOTE) ../images/$@.chrp-rs6k
58
59zImage.initrd: $(OBJS) $(LIBS) $(ADDNOTE) ../images/ramdisk.image.gz ../ld.script
60	$(OBJCOPY) image.o image.o \
61		--add-section=.ramdisk=../images/ramdisk.image.gz \
62		--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
63	$(LD) $(LD_ARGS) -o ../images/$@.chrp $(OBJS) $(LIBS)
64	$(OBJCOPY) ../images/$@.chrp ../images/$@.chrp -R .comment
65	cp ../images/$@.chrp ../images/$@.chrp-rs6k
66	$(ADDNOTE) ../images/$@.chrp-rs6k
67
68include $(TOPDIR)/Rules.make
69