18c2ecf20Sopenharmony_ci#
28c2ecf20Sopenharmony_ci# arch/alpha/boot/Makefile
38c2ecf20Sopenharmony_ci#
48c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
58c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
68c2ecf20Sopenharmony_ci# for more details.
78c2ecf20Sopenharmony_ci#
88c2ecf20Sopenharmony_ci# Copyright (C) 1994 by Linus Torvalds
98c2ecf20Sopenharmony_ci#
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cihostprogs	:= tools/mkbb tools/objstrip
128c2ecf20Sopenharmony_citargets		:= vmlinux.gz vmlinux \
138c2ecf20Sopenharmony_ci		   vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
148c2ecf20Sopenharmony_ci		   tools/bootpzh bootloader bootpheader bootpzheader 
158c2ecf20Sopenharmony_ciOBJSTRIP	:= $(obj)/tools/objstrip
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciKBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include
188c2ecf20Sopenharmony_ciBOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci# SRM bootable image.  Copy to offset 512 of a partition.
218c2ecf20Sopenharmony_ci$(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh
228c2ecf20Sopenharmony_ci	( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@ 
238c2ecf20Sopenharmony_ci	$(obj)/tools/mkbb $@ $(obj)/tools/lxboot
248c2ecf20Sopenharmony_ci	@echo '  Bootimage $@ is ready'
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci# BOOTP bootable image.  Define INITRD during make to append initrd image.
278c2ecf20Sopenharmony_ci$(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh
288c2ecf20Sopenharmony_ci	cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@
298c2ecf20Sopenharmony_ciifdef INITRD
308c2ecf20Sopenharmony_ci	cat $(INITRD) >> $@
318c2ecf20Sopenharmony_ciendif
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci# Compressed kernel BOOTP bootable image.
348c2ecf20Sopenharmony_ci# Define INITRD during make to append initrd image.
358c2ecf20Sopenharmony_ci$(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz
368c2ecf20Sopenharmony_ci	cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@
378c2ecf20Sopenharmony_ciifdef INITRD
388c2ecf20Sopenharmony_ci	cat $(INITRD) >> $@
398c2ecf20Sopenharmony_ciendif
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci# Compressed kernel image
428c2ecf20Sopenharmony_ci$(obj)/vmlinux.gz: $(obj)/vmlinux FORCE
438c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
448c2ecf20Sopenharmony_ci	@echo '  Kernel $@ is ready'
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci$(obj)/main.o: $(obj)/ksize.h
478c2ecf20Sopenharmony_ci$(obj)/bootp.o: $(obj)/ksize.h
488c2ecf20Sopenharmony_ci$(obj)/bootpz.o: $(obj)/kzsize.h
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci$(obj)/ksize.h: $(obj)/vmlinux.nh FORCE
518c2ecf20Sopenharmony_ci	echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
528c2ecf20Sopenharmony_ciifdef INITRD
538c2ecf20Sopenharmony_ci	[ -f $(INITRD) ] || exit 1
548c2ecf20Sopenharmony_ci	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
558c2ecf20Sopenharmony_ciendif
568c2ecf20Sopenharmony_ci	cmp -s $@T $@ || mv -f $@T $@
578c2ecf20Sopenharmony_ci	rm -f $@T
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci$(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE
608c2ecf20Sopenharmony_ci	echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
618c2ecf20Sopenharmony_ci	echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T
628c2ecf20Sopenharmony_ciifdef INITRD
638c2ecf20Sopenharmony_ci	[ -f $(INITRD) ] || exit 1
648c2ecf20Sopenharmony_ci	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
658c2ecf20Sopenharmony_ciendif
668c2ecf20Sopenharmony_ci	cmp -s $@T $@ || mv -f $@T $@
678c2ecf20Sopenharmony_ci	rm -f $@T
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciquiet_cmd_strip = STRIP  $@
708c2ecf20Sopenharmony_ci      cmd_strip = $(STRIP) -o $@ $<
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci$(obj)/vmlinux: vmlinux FORCE
738c2ecf20Sopenharmony_ci	$(call if_changed,strip)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciquiet_cmd_objstrip = OBJSTRIP $@
768c2ecf20Sopenharmony_ci      cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciOSFLAGS_vmlinux.nh	:= -v
798c2ecf20Sopenharmony_ciOSFLAGS_lxboot		:= -p
808c2ecf20Sopenharmony_ciOSFLAGS_bootlx		:= -vb
818c2ecf20Sopenharmony_ciOSFLAGS_bootph		:= -vb
828c2ecf20Sopenharmony_ciOSFLAGS_bootpzh		:= -vb
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci$(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE
858c2ecf20Sopenharmony_ci	$(call if_changed,objstrip)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci$(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE
888c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci$(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE
918c2ecf20Sopenharmony_ci	$(call if_changed,objstrip)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci$(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE
948c2ecf20Sopenharmony_ci	$(call if_changed,objstrip)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci$(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE
978c2ecf20Sopenharmony_ci	$(call if_changed,objstrip)
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci$(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE
1008c2ecf20Sopenharmony_ci	$(call if_changed,objstrip)
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciLDFLAGS_bootloader   := -static -T # -N -relax
1038c2ecf20Sopenharmony_ciLDFLAGS_bootloader   := -static -T # -N -relax
1048c2ecf20Sopenharmony_ciLDFLAGS_bootpheader  := -static -T # -N -relax
1058c2ecf20Sopenharmony_ciLDFLAGS_bootpzheader := -static -T # -N -relax
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciOBJ_bootlx   := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o
1088c2ecf20Sopenharmony_ciOBJ_bootph   := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o
1098c2ecf20Sopenharmony_ciOBJ_bootpzh  := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
1128c2ecf20Sopenharmony_ci	$(call if_changed,ld)
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci$(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
1158c2ecf20Sopenharmony_ci	$(call if_changed,ld)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci$(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE
1188c2ecf20Sopenharmony_ci	$(call if_changed,ld)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci$(obj)/misc.o: lib/inflate.c
121