1#
2# arch/alpha/boot/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License.  See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1994 by Linus Torvalds
9#
10# Creating a compressed kernel image (arch/alpha/boot/vmlinux.gz)
11# is done via:
12#
13#	make boot
14#
15# Creating a BOOTP image (arch/alpha/boot/bootpfile or bootpzfile)
16# is done via:
17#
18#	make bootpfile		# using an uncompressed kernel
19#	make bootpzfile		# using a compressed kernel
20#
21# Adding an INITRD image to a BOOTP file (arch/alpha/boot/bootpzfile)
22# can be done, e.g, via:
23#
24# INITRD=`pwd`/initrd.img make bootpzfile
25
26LINKFLAGS = -static -T bootloader.lds #-N -relax
27
28.S.s:
29	$(CPP) $(AFLAGS) -traditional -o $*.o $<
30.S.o:
31	$(CC) $(AFLAGS) -traditional -c -o $*.o $<
32
33OBJECTS = head.o main.o
34BPOBJECTS = head.o bootp.o
35BPZOBJECTS = head.o bootpz.o misc.o
36TARGETS = vmlinux.gz tools/objstrip # also needed by aboot & milo
37VMLINUX = $(TOPDIR)/vmlinux
38OBJSTRIP = tools/objstrip
39
40all:	$(TARGETS)
41	@echo Ready to install kernel in $(shell pwd)/vmlinux.gz
42
43# normally no need to build these:
44rawboot: vmlinux.nh tools/lxboot tools/bootlx
45
46msb:	tools/lxboot tools/bootlx vmlinux.nh
47	( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a
48	disklabel -rw rz0 'linux' tools/lxboot tools/bootlx
49
50bootimage:	tools/mkbb tools/lxboot tools/bootlx vmlinux.nh
51	( cat tools/lxboot tools/bootlx vmlinux.nh ) > bootimage
52	tools/mkbb bootimage tools/lxboot
53
54bootpfile:	tools/bootph vmlinux.nh
55	cat tools/bootph vmlinux.nh > bootpfile
56ifdef INITRD
57	cat $(INITRD) >> bootpfile
58endif
59
60bootpzfile:	tools/bootpzh vmlinux.nh.gz
61	cat tools/bootpzh vmlinux.nh.gz > bootpzfile
62ifdef INITRD
63	cat $(INITRD) >> bootpzfile
64endif
65
66srmboot:	bootdevice bootimage
67	dd if=bootimage of=$(BOOTDEV) bs=512 seek=1 skip=1
68	tools/mkbb $(BOOTDEV) tools/lxboot
69
70bootdevice:
71	@test "$(BOOTDEV)" != ""  || (echo You must specify BOOTDEV ; exit -1)
72
73vmlinux.gz: $(TOPDIR)/vmlinux
74	gzip -fv9c $(TOPDIR)/vmlinux > vmlinux.gz
75
76vmlinux.nh.gz: vmlinux.nh
77	gzip -fv9c vmlinux.nh > vmlinux.nh.gz
78
79main.o: ksize.h
80
81bootp.o: ksize.h
82
83bootpz.o: kzsize.h
84
85ksize.h: vmlinux.nh dummy
86	echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T
87ifdef INITRD
88	[ ! \( -f $(INITRD) \) ] || exit 1
89	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
90endif
91	cmp -s $@T $@ || mv -f $@T $@
92	rm -f $@T
93
94kzsize.h: vmlinux.nh.gz dummy
95	echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T
96	echo "#define KERNEL_Z_SIZE `ls -l vmlinux.nh.gz | awk '{print $$5}'`" >> $@T
97ifdef INITRD
98	[ -f $(INITRD) ] || exit 1
99	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
100endif
101	cmp -s $@T $@ || mv -f $@T $@
102	rm -f $@T
103
104vmlinux.nh: $(VMLINUX) $(OBJSTRIP)
105	$(OBJSTRIP) -v $(VMLINUX) vmlinux.nh
106
107vmlinux: $(VMLINUX)
108	$(STRIP) -o vmlinux $(VMLINUX)
109
110tools/lxboot: $(OBJSTRIP) bootloader
111	$(OBJSTRIP) -p bootloader tools/lxboot
112
113tools/bootlx: bootloader $(OBJSTRIP)
114	$(OBJSTRIP) -vb bootloader tools/bootlx
115
116tools/bootph: bootpheader $(OBJSTRIP)
117	$(OBJSTRIP) -vb bootpheader tools/bootph
118
119tools/bootpzh: bootpzheader $(OBJSTRIP)
120	$(OBJSTRIP) -vb bootpzheader tools/bootpzh
121
122$(OBJSTRIP): $(OBJSTRIP).c
123	$(HOSTCC) $(HOSTCFLAGS) -I$(HPATH) $(OBJSTRIP).c -o $(OBJSTRIP)
124
125tools/mkbb: tools/mkbb.c
126	$(HOSTCC) tools/mkbb.c -o tools/mkbb
127
128bootloader: $(OBJECTS)
129	$(LD) $(LINKFLAGS) $(OBJECTS) $(LIBS) -o bootloader
130
131bootpheader: $(BPOBJECTS)
132	$(LD) $(LINKFLAGS) $(BPOBJECTS) $(LIBS) -o bootpheader
133
134bootpzheader: $(BPZOBJECTS)
135	$(LD) $(LINKFLAGS) $(BPZOBJECTS) $(LIBS) -o bootpzheader
136
137misc.o: misc.c $(TOPDIR)/lib/inflate.c
138
139clean:
140	rm -f $(TARGETS) bootloader bootimage bootpfile bootpheader
141	rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph
142	rm -f vmlinux.nh ksize.h
143
144dep:
145
146dummy:
147