summaryrefslogtreecommitdiffstats
path: root/arch/alpha/boot/Makefile
blob: ee2ecd37952bde414dada29124cecb1e8ad2968e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#
# arch/alpha/boot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
#

ifdef CONFIG_CROSSCOMPILE
# enable this for linking under OSF/1:
LINKFLAGS = -non_shared -T 0x20000000 -N
else
 elf=$(shell if $(LD) --help | grep elf64alpha >/dev/null; then echo yes; fi)
 ifeq ($(elf),yes)
  LINKFLAGS = -static -Ttext 0x20000000 -N
 else
  LINKFLAGS = -static -T bootloader.lds -N
 endif
endif

.S.s:
	$(CC) -D__ASSEMBLY__ -traditional -E -o $*.o $<
.S.o:
	$(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<

OBJECTS = head.o main.o
BPOBJECTS = head.o bootp.o
TARGETS = vmlinux.gz tools/objstrip # also needed by aboot & milo
VMLINUX = $(TOPDIR)/vmlinux
OBJSTRIP = tools/objstrip

all:	$(TARGETS)
	@echo Ready to install kernel in $(shell pwd)/vmlinux.gz

# normally no need to build these:
rawboot: vmlinux.nh tools/lxboot tools/bootlx

msb:	tools/lxboot tools/bootlx vmlinux.nh
	( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a
	disklabel -rw rz0 'linux' tools/lxboot tools/bootlx

bootimage:	tools/mkbb tools/lxboot tools/bootlx vmlinux.nh
	( cat tools/lxboot tools/bootlx vmlinux.nh ) > bootimage
	tools/mkbb bootimage tools/lxboot

bootpfile:	tools/bootph vmlinux.nh
	( cat tools/bootph vmlinux.nh ) > bootpfile

srmboot:	bootdevice bootimage
	dd if=bootimage of=$(BOOTDEV) bs=512 seek=1 skip=1
	tools/mkbb $(BOOTDEV) tools/lxboot

bootdevice:
	@test "$(BOOTDEV)" != ""  || (echo You must specify BOOTDEV ; exit -1)

vmlinux.gz: vmlinux
	gzip -fv vmlinux

#
# A raw binary without header.  Used by raw boot.
#
main.o: ksize.h

bootp.o: ksize.h

ksize.h: $(OBJSTRIP) vmlinux.nh
	echo "#define KERNEL_SIZE `$(OBJSTRIP) -p vmlinux.nh /dev/null`" > $@

vmlinux.nh: $(VMLINUX) $(OBJSTRIP)
ifeq ($(elf),yes)
	cp $(VMLINUX) vmlinux.stripped
	strip vmlinux.stripped		# work around ELF binutils bug...
	$(OBJSTRIP) -v vmlinux.stripped vmlinux.nh
	rm -f vmlinux.stripped
else
	$(OBJSTRIP) -v $(VMLINUX) vmlinux.nh
endif

vmlinux: $(TOPDIR)/vmlinux
	cp $(TOPDIR)/vmlinux vmlinux
	strip vmlinux

tools/lxboot: $(OBJSTRIP) bootloader
	$(OBJSTRIP) -p bootloader tools/lxboot

tools/bootlx: bootloader $(OBJSTRIP)
	$(OBJSTRIP) -vb bootloader tools/bootlx

tools/bootph: bootpheader $(OBJSTRIP)
	$(OBJSTRIP) -vb bootpheader tools/bootph

$(OBJSTRIP): $(OBJSTRIP).c
	$(HOSTCC) $(OBJSTRIP).c -o $(OBJSTRIP)

tools/mkbb: tools/mkbb.c
	$(HOSTCC) tools/mkbb.c -o tools/mkbb

bootloader: $(OBJECTS)
	$(LD) $(LINKFLAGS) \
		$(OBJECTS) \
		$(LIBS) \
		-o bootloader && strip bootloader || \
		(rm -f bootloader && exit 1)

bootpheader: $(BPOBJECTS)
	$(LD) $(LINKFLAGS) \
		$(BPOBJECTS) \
		$(LIBS) \
		-o bootpheader && strip bootpheader || \
		(rm -f bootpheader && exit 1)

clean:
	rm -f $(TARGETS) bootloader bootimage vmlinux.nh \
		tools/mkbb tools/bootlx tools/lxboot ksize.h

dep: