xref: /kernel/linux/linux-6.6/arch/alpha/boot/Makefile (revision 62306a36)
162306a36Sopenharmony_ci#
262306a36Sopenharmony_ci# arch/alpha/boot/Makefile
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
562306a36Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
662306a36Sopenharmony_ci# for more details.
762306a36Sopenharmony_ci#
862306a36Sopenharmony_ci# Copyright (C) 1994 by Linus Torvalds
962306a36Sopenharmony_ci#
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cihostprogs	:= tools/mkbb tools/objstrip
1262306a36Sopenharmony_citargets		:= vmlinux.gz vmlinux \
1362306a36Sopenharmony_ci		   vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
1462306a36Sopenharmony_ci		   tools/bootpzh bootloader bootpheader bootpzheader 
1562306a36Sopenharmony_ciOBJSTRIP	:= $(obj)/tools/objstrip
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciKBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include
1862306a36Sopenharmony_ciBOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci# SRM bootable image.  Copy to offset 512 of a partition.
2162306a36Sopenharmony_ci$(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh
2262306a36Sopenharmony_ci	( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@ 
2362306a36Sopenharmony_ci	$(obj)/tools/mkbb $@ $(obj)/tools/lxboot
2462306a36Sopenharmony_ci	@echo '  Bootimage $@ is ready'
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci# BOOTP bootable image.  Define INITRD during make to append initrd image.
2762306a36Sopenharmony_ci$(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh
2862306a36Sopenharmony_ci	cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@
2962306a36Sopenharmony_ciifdef INITRD
3062306a36Sopenharmony_ci	cat $(INITRD) >> $@
3162306a36Sopenharmony_ciendif
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci# Compressed kernel BOOTP bootable image.
3462306a36Sopenharmony_ci# Define INITRD during make to append initrd image.
3562306a36Sopenharmony_ci$(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz
3662306a36Sopenharmony_ci	cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@
3762306a36Sopenharmony_ciifdef INITRD
3862306a36Sopenharmony_ci	cat $(INITRD) >> $@
3962306a36Sopenharmony_ciendif
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci# Compressed kernel image
4262306a36Sopenharmony_ci$(obj)/vmlinux.gz: $(obj)/vmlinux FORCE
4362306a36Sopenharmony_ci	$(call if_changed,gzip)
4462306a36Sopenharmony_ci	@echo '  Kernel $@ is ready'
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci$(obj)/main.o: $(obj)/ksize.h
4762306a36Sopenharmony_ci$(obj)/bootp.o: $(obj)/ksize.h
4862306a36Sopenharmony_ci$(obj)/bootpz.o: $(obj)/kzsize.h
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci$(obj)/ksize.h: $(obj)/vmlinux.nh FORCE
5162306a36Sopenharmony_ci	echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
5262306a36Sopenharmony_ciifdef INITRD
5362306a36Sopenharmony_ci	[ -f $(INITRD) ] || exit 1
5462306a36Sopenharmony_ci	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
5562306a36Sopenharmony_ciendif
5662306a36Sopenharmony_ci	cmp -s $@T $@ || mv -f $@T $@
5762306a36Sopenharmony_ci	rm -f $@T
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci$(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE
6062306a36Sopenharmony_ci	echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
6162306a36Sopenharmony_ci	echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T
6262306a36Sopenharmony_ciifdef INITRD
6362306a36Sopenharmony_ci	[ -f $(INITRD) ] || exit 1
6462306a36Sopenharmony_ci	echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
6562306a36Sopenharmony_ciendif
6662306a36Sopenharmony_ci	cmp -s $@T $@ || mv -f $@T $@
6762306a36Sopenharmony_ci	rm -f $@T
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciquiet_cmd_strip = STRIP  $@
7062306a36Sopenharmony_ci      cmd_strip = $(STRIP) -o $@ $<
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci$(obj)/vmlinux: vmlinux FORCE
7362306a36Sopenharmony_ci	$(call if_changed,strip)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciquiet_cmd_objstrip = OBJSTRIP $@
7662306a36Sopenharmony_ci      cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciOSFLAGS_vmlinux.nh	:= -v
7962306a36Sopenharmony_ciOSFLAGS_lxboot		:= -p
8062306a36Sopenharmony_ciOSFLAGS_bootlx		:= -vb
8162306a36Sopenharmony_ciOSFLAGS_bootph		:= -vb
8262306a36Sopenharmony_ciOSFLAGS_bootpzh		:= -vb
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci$(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE
8562306a36Sopenharmony_ci	$(call if_changed,objstrip)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci$(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE
8862306a36Sopenharmony_ci	$(call if_changed,gzip)
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci$(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE
9162306a36Sopenharmony_ci	$(call if_changed,objstrip)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci$(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE
9462306a36Sopenharmony_ci	$(call if_changed,objstrip)
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci$(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE
9762306a36Sopenharmony_ci	$(call if_changed,objstrip)
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci$(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE
10062306a36Sopenharmony_ci	$(call if_changed,objstrip)
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ciLDFLAGS_bootloader   := -static -T # -N -relax
10362306a36Sopenharmony_ciLDFLAGS_bootloader   := -static -T # -N -relax
10462306a36Sopenharmony_ciLDFLAGS_bootpheader  := -static -T # -N -relax
10562306a36Sopenharmony_ciLDFLAGS_bootpzheader := -static -T # -N -relax
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ciOBJ_bootlx   := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o
10862306a36Sopenharmony_ciOBJ_bootph   := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o
10962306a36Sopenharmony_ciOBJ_bootpzh  := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
11262306a36Sopenharmony_ci	$(call if_changed,ld)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci$(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
11562306a36Sopenharmony_ci	$(call if_changed,ld)
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci$(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE
11862306a36Sopenharmony_ci	$(call if_changed,ld)
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci$(obj)/misc.o: lib/inflate.c
121