projects/linux·blob master · refs

126 lines · 3.9 KiB

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
11hostprogs := tools/mkbb tools/objstrip
12targets := vmlinuz vmlinux \
13 vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
14 tools/bootpzh bootloader bootpheader bootpzheader
15subdir- := compressed
16OBJSTRIP := $(obj)/tools/objstrip
17
18KBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include
19BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj)
20
21# SRM bootable image. Copy to offset 512 of a partition.
22$(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh
23 ( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@
24 $(obj)/tools/mkbb $@ $(obj)/tools/lxboot
25 @echo ' Bootimage $@ is ready'
26
27# BOOTP bootable image. Define INITRD during make to append initrd image.
28$(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh
29 cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@
30ifdef INITRD
31 cat $(INITRD) >> $@
32endif
33
34# Compressed kernel BOOTP bootable image.
35# Define INITRD during make to append initrd image.
36$(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz
37 cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@
38ifdef INITRD
39 cat $(INITRD) >> $@
40endif
41
42# Self-extracting compressed kernel image: a small ELF stub (see
43# compressed/) with the real vmlinux linked in compressed, which aboot
44# loads and enters like a plain vmlinux.
45$(obj)/compressed/vmlinux: vmlinux FORCE
46 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
47
48$(obj)/vmlinuz: $(obj)/compressed/vmlinux FORCE
49 $(call if_changed,copy)
50 @echo ' Kernel $@ is ready'
51
52$(obj)/main.o: $(obj)/ksize.h
53$(obj)/bootp.o: $(obj)/ksize.h
54$(obj)/bootpz.o: $(obj)/kzsize.h
55
56$(obj)/ksize.h: $(obj)/vmlinux.nh FORCE
57 echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
58ifdef INITRD
59 [ -f $(INITRD) ] || exit 1
60 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
61endif
62 cmp -s $@T $@ || mv -f $@T $@
63 rm -f $@T
64
65$(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE
66 echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
67 echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T
68ifdef INITRD
69 [ -f $(INITRD) ] || exit 1
70 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
71endif
72 cmp -s $@T $@ || mv -f $@T $@
73 rm -f $@T
74
75quiet_cmd_strip = STRIP $@
76 cmd_strip = $(STRIP) -o $@ $<
77
78$(obj)/vmlinux: vmlinux FORCE
79 $(call if_changed,strip)
80
81quiet_cmd_objstrip = OBJSTRIP $@
82 cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@
83
84OSFLAGS_vmlinux.nh := -v
85OSFLAGS_lxboot := -p
86OSFLAGS_bootlx := -vb
87OSFLAGS_bootph := -vb
88OSFLAGS_bootpzh := -vb
89
90$(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE
91 $(call if_changed,objstrip)
92
93$(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE
94 $(call if_changed,gzip)
95
96$(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE
97 $(call if_changed,objstrip)
98
99$(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE
100 $(call if_changed,objstrip)
101
102$(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE
103 $(call if_changed,objstrip)
104
105$(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE
106 $(call if_changed,objstrip)
107
108LDFLAGS_bootloader := -static -T # -N -relax
109LDFLAGS_bootloader := -static -T # -N -relax
110LDFLAGS_bootpheader := -static -T # -N -relax
111LDFLAGS_bootpzheader := -static -T # -N -relax
112
113OBJ_bootlx := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o
114OBJ_bootph := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o
115OBJ_bootpzh := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o
116
117$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
118 $(call if_changed,ld)
119
120$(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
121 $(call if_changed,ld)
122
123$(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE
124 $(call if_changed,ld)
125
126$(obj)/misc.o: lib/inflate.c