1 # Makefile for making XCOFF bootable images for booting on PowerMacs
4 # Paul Mackerras January 1997
6 HOSTCFLAGS
= -O
-I
$(TOPDIR
)/include
8 CFLAGS
= $(CPPFLAGS
) -O
-fno-builtin
9 OBJCOPY_ARGS
= -O aixcoff-rs6000
-R .stab
-R .stabstr
-R .comment
10 COFF_LD_ARGS
= -e _start
-T
ld.script
-Ttext
500000 -Tdata
510000 -Bstatic
11 CHRP_LD_ARGS
= -Ttext
0x01000000
13 COFFOBJS
= coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o
14 CHRPOBJS
= crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o
15 LIBS
= $(TOPDIR
)/lib
/lib.a
17 ifeq ($(CONFIG_PPC64BRIDGE
),y
)
23 ifeq ($(CONFIG_ALL_PPC
),y
)
24 # yes, we want to build pmac stuff
28 ifeq ($(CONFIG_SMP
),y
)
29 TFTPIMAGE
=/tftpboot
/zImage.pmac.smp
$(MSIZE
)
31 TFTPIMAGE
=/tftpboot
/zImage.pmac
$(MSIZE
)
34 ifeq ($(CONFIG_PMAC
),y
)
35 chrpmain.o
: chrpmain.c
36 $(CC
) $(CFLAGS
) -DSYSMAP_OFFSET
=0 -DSYSMAP_SIZE
=0 -c chrpmain.c
38 hack-coff
: hack-coff.c
39 $(HOSTCC
) $(HOSTCFLAGS
) -o hack-coff hack-coff.c
41 znetboot
: vmlinux.coff vmlinux.elf zImage
42 cp vmlinux.coff
$(TFTPIMAGE
)
43 cp vmlinux.elf
$(TFTPIMAGE
).elf
45 znetboot.initrd
: vmlinux.coff.initrd vmlinux.elf.initrd
46 cp vmlinux.coff.initrd
$(TFTPIMAGE
)
47 cp vmlinux.elf.initrd
$(TFTPIMAGE
).elf
50 # mount -t hfs /dev/fd0 /mnt
51 # cp vmlinux.coff /mnt
54 miboot.image
: dummy.o vmlinux.gz
55 $(OBJCOPY
) $(OBJCOPY_ARGS
) --add-section
=image
=vmlinux.gz dummy.o
$@
57 miboot.image.initrd
: miboot.image ramdisk.image.gz
58 $(OBJCOPY
) $(OBJCOPY_ARGS
) --add-section
=initrd
=ramdisk.image.gz miboot.image
$@
60 coffboot
: $(COFFOBJS
) no_initrd.o
ld.script
61 $(LD
) -o
$@
$(COFF_LD_ARGS
) $(COFFOBJS
) no_initrd.o
$(LIBS
)
63 coffboot.initrd
: $(COFFOBJS
) initrd.o
ld.script
64 $(LD
) -o
$@
$(COFF_LD_ARGS
) $(COFFOBJS
) initrd.o
$(LIBS
)
66 piggyback
: piggyback.c
67 $(HOSTCC
) $(HOSTCFLAGS
) -DKERNELBASE
=$(KERNELBASE
) -o piggyback piggyback.c
70 $(HOSTCC
) $(HOSTCFLAGS
) -o mknote mknote.c
72 image.o
: piggyback vmlinux.gz
73 .
/piggyback image
< vmlinux.gz |
$(AS
) -o image.o
75 initrd.o
: ramdisk.image.gz piggyback
76 .
/piggyback initrd
< ramdisk.image.gz |
$(AS
) -o initrd.o
78 vmlinux.coff
: coffboot hack-coff
79 $(OBJCOPY
) $(OBJCOPY_ARGS
) coffboot
$@
81 ln
-sf vmlinux.coff zImage
83 vmlinux.coff.initrd
: coffboot.initrd hack-coff
84 $(OBJCOPY
) $(OBJCOPY_ARGS
) coffboot.initrd
$@
87 vmlinux.elf
: $(CHRPOBJS
) no_initrd.o mknote
88 $(LD
) $(CHRP_LD_ARGS
) -o
$@
$(CHRPOBJS
) no_initrd.o
$(LIBS
)
90 $(OBJCOPY
) $@
$@
--add-section
=.note
=note \
91 --add-section
=sysmap
=..
/..
/..
/System.map
-R .comment
92 $(CC
) $(CFLAGS
) chrpmain.c
-c
-o chrpmain.o \
93 -DSYSMAP_OFFSET
=`sh ../boot/offset $(OBJDUMP) $@ sysmap` \
94 -DSYSMAP_SIZE
=`sh ../boot/size $(OBJDUMP) $@ sysmap`
95 $(LD
) $(CHRP_LD_ARGS
) -o
$@
$(CHRPOBJS
) no_initrd.o
$(LIBS
)
96 $(OBJCOPY
) $@
$@
--add-section
=.note
=note \
97 --add-section
=sysmap
=..
/..
/..
/System.map
-R .comment
99 vmlinux.elf.initrd
: $(CHRPOBJS
) initrd.o mknote
100 $(LD
) $(CHRP_LD_ARGS
) -o
$@
$(CHRPOBJS
) initrd.o
$(LIBS
)
102 $(OBJCOPY
) $@
$@
--add-section
=.note
=note
-R .comment
104 zImage
: vmlinux.coff vmlinux.elf miboot.image
106 zImage.initrd
: vmlinux.coff.initrd vmlinux.elf.initrd miboot.image.initrd
111 znetboot.initrd
: vmlinux.gz
117 zImage.initrd
: vmlinux.gz
119 vmlinux.coff
: vmlinux.gz
121 vmlinux.coff.initrd
: vmlinux.gz
127 vmlinux.gz
: $(TOPDIR
)/vmlinux
128 $(OBJCOPY
) -S
-O binary
$(TOPDIR
)/vmlinux vmlinux
132 rm -f hack-coff coffboot zImage vmlinux.coff vmlinux.gz
133 rm -f mknote piggyback vmlinux.elf note
134 rm -f miboot.image miboot.image.initrd