xref: /OK3568_Linux_fs/kernel/arch/alpha/boot/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# arch/alpha/boot/Makefile
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun# This file is subject to the terms and conditions of the GNU General Public
5*4882a593Smuzhiyun# License.  See the file "COPYING" in the main directory of this archive
6*4882a593Smuzhiyun# for more details.
7*4882a593Smuzhiyun#
8*4882a593Smuzhiyun# Copyright (C) 1994 by Linus Torvalds
9*4882a593Smuzhiyun#
10*4882a593Smuzhiyun
11*4882a593Smuzhiyunhostprogs	:= tools/mkbb tools/objstrip
12*4882a593Smuzhiyuntargets		:= vmlinux.gz vmlinux \
13*4882a593Smuzhiyun		   vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
14*4882a593Smuzhiyun		   tools/bootpzh bootloader bootpheader bootpzheader
15*4882a593SmuzhiyunOBJSTRIP	:= $(obj)/tools/objstrip
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunKBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include
18*4882a593SmuzhiyunBOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun# SRM bootable image.  Copy to offset 512 of a partition.
21*4882a593Smuzhiyun$(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh
22*4882a593Smuzhiyun	( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@
23*4882a593Smuzhiyun	$(obj)/tools/mkbb $@ $(obj)/tools/lxboot
24*4882a593Smuzhiyun	@echo '  Bootimage $@ is ready'
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun# BOOTP bootable image.  Define INITRD during make to append initrd image.
27*4882a593Smuzhiyun$(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh
28*4882a593Smuzhiyun	cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@
29*4882a593Smuzhiyunifdef INITRD
30*4882a593Smuzhiyun	cat $(INITRD) >> $@
31*4882a593Smuzhiyunendif
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun# Compressed kernel BOOTP bootable image.
34*4882a593Smuzhiyun# Define INITRD during make to append initrd image.
35*4882a593Smuzhiyun$(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz
36*4882a593Smuzhiyun	cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@
37*4882a593Smuzhiyunifdef INITRD
38*4882a593Smuzhiyun	cat $(INITRD) >> $@
39*4882a593Smuzhiyunendif
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun# Compressed kernel image
42*4882a593Smuzhiyun$(obj)/vmlinux.gz: $(obj)/vmlinux FORCE
43*4882a593Smuzhiyun	$(call if_changed,gzip)
44*4882a593Smuzhiyun	@echo '  Kernel $@ is ready'
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun$(obj)/main.o: $(obj)/ksize.h
47*4882a593Smuzhiyun$(obj)/bootp.o: $(obj)/ksize.h
48*4882a593Smuzhiyun$(obj)/bootpz.o: $(obj)/kzsize.h
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun$(obj)/ksize.h: $(obj)/vmlinux.nh FORCE
51*4882a593Smuzhiyun	echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
52*4882a593Smuzhiyunifdef INITRD
53*4882a593Smuzhiyun	[ -f $(INITRD) ] || exit 1
54*4882a593Smuzhiyun	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
55*4882a593Smuzhiyunendif
56*4882a593Smuzhiyun	cmp -s $@T $@ || mv -f $@T $@
57*4882a593Smuzhiyun	rm -f $@T
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun$(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE
60*4882a593Smuzhiyun	echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
61*4882a593Smuzhiyun	echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T
62*4882a593Smuzhiyunifdef INITRD
63*4882a593Smuzhiyun	[ -f $(INITRD) ] || exit 1
64*4882a593Smuzhiyun	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
65*4882a593Smuzhiyunendif
66*4882a593Smuzhiyun	cmp -s $@T $@ || mv -f $@T $@
67*4882a593Smuzhiyun	rm -f $@T
68*4882a593Smuzhiyun
69*4882a593Smuzhiyunquiet_cmd_strip = STRIP  $@
70*4882a593Smuzhiyun      cmd_strip = $(STRIP) -o $@ $<
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun$(obj)/vmlinux: vmlinux FORCE
73*4882a593Smuzhiyun	$(call if_changed,strip)
74*4882a593Smuzhiyun
75*4882a593Smuzhiyunquiet_cmd_objstrip = OBJSTRIP $@
76*4882a593Smuzhiyun      cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunOSFLAGS_vmlinux.nh	:= -v
79*4882a593SmuzhiyunOSFLAGS_lxboot		:= -p
80*4882a593SmuzhiyunOSFLAGS_bootlx		:= -vb
81*4882a593SmuzhiyunOSFLAGS_bootph		:= -vb
82*4882a593SmuzhiyunOSFLAGS_bootpzh		:= -vb
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun$(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE
85*4882a593Smuzhiyun	$(call if_changed,objstrip)
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun$(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE
88*4882a593Smuzhiyun	$(call if_changed,gzip)
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun$(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE
91*4882a593Smuzhiyun	$(call if_changed,objstrip)
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun$(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE
94*4882a593Smuzhiyun	$(call if_changed,objstrip)
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun$(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE
97*4882a593Smuzhiyun	$(call if_changed,objstrip)
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun$(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE
100*4882a593Smuzhiyun	$(call if_changed,objstrip)
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunLDFLAGS_bootloader   := -static -T # -N -relax
103*4882a593SmuzhiyunLDFLAGS_bootloader   := -static -T # -N -relax
104*4882a593SmuzhiyunLDFLAGS_bootpheader  := -static -T # -N -relax
105*4882a593SmuzhiyunLDFLAGS_bootpzheader := -static -T # -N -relax
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunOBJ_bootlx   := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o
108*4882a593SmuzhiyunOBJ_bootph   := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o
109*4882a593SmuzhiyunOBJ_bootpzh  := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
112*4882a593Smuzhiyun	$(call if_changed,ld)
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun$(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
115*4882a593Smuzhiyun	$(call if_changed,ld)
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun$(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE
118*4882a593Smuzhiyun	$(call if_changed,ld)
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun$(obj)/misc.o: lib/inflate.c
121