162306a36Sopenharmony_ci#
262306a36Sopenharmony_ci# arch/riscv/boot/Makefile
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# This file is included by the global makefile so that you can add your own
562306a36Sopenharmony_ci# architecture-specific flags and dependencies.
662306a36Sopenharmony_ci#
762306a36Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
862306a36Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
962306a36Sopenharmony_ci# for more details.
1062306a36Sopenharmony_ci#
1162306a36Sopenharmony_ci# Copyright (C) 2018, Anup Patel.
1262306a36Sopenharmony_ci# Author: Anup Patel <anup@brainfault.org>
1362306a36Sopenharmony_ci#
1462306a36Sopenharmony_ci# Based on the ia64 and arm64 boot/Makefile.
1562306a36Sopenharmony_ci#
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciKCOV_INSTRUMENT := n
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciOBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
2062306a36Sopenharmony_ciOBJCOPYFLAGS_loader.bin :=-O binary
2162306a36Sopenharmony_ciOBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_citargets := Image Image.* loader loader.o loader.lds loader.bin
2462306a36Sopenharmony_citargets := Image Image.* loader loader.o loader.lds loader.bin xipImage
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciifeq ($(CONFIG_XIP_KERNEL),y)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciquiet_cmd_mkxip = $(quiet_cmd_objcopy)
2962306a36Sopenharmony_cicmd_mkxip = $(cmd_objcopy)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci$(obj)/xipImage: vmlinux FORCE
3262306a36Sopenharmony_ci	$(call if_changed,mkxip)
3362306a36Sopenharmony_ci	@$(kecho) '  Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)'
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciendif
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciifdef CONFIG_RELOCATABLE
3862306a36Sopenharmony_civmlinux.relocs: vmlinux
3962306a36Sopenharmony_ci	@ (! [ -f vmlinux.relocs ] && echo "vmlinux.relocs can't be found, please remove vmlinux and try again") || true
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci$(obj)/Image: vmlinux.relocs FORCE
4262306a36Sopenharmony_cielse
4362306a36Sopenharmony_ci$(obj)/Image: vmlinux FORCE
4462306a36Sopenharmony_ciendif
4562306a36Sopenharmony_ci	$(call if_changed,objcopy)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci$(obj)/Image.gz: $(obj)/Image FORCE
4862306a36Sopenharmony_ci	$(call if_changed,gzip)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci$(obj)/loader.o: $(src)/loader.S $(obj)/Image
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci$(obj)/loader: $(obj)/loader.o $(obj)/Image $(obj)/loader.lds FORCE
5362306a36Sopenharmony_ci	$(Q)$(LD) -T $(obj)/loader.lds -o $@ $(obj)/loader.o
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci$(obj)/Image.bz2: $(obj)/Image FORCE
5662306a36Sopenharmony_ci	$(call if_changed,bzip2)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci$(obj)/Image.lz4: $(obj)/Image FORCE
5962306a36Sopenharmony_ci	$(call if_changed,lz4)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci$(obj)/Image.lzma: $(obj)/Image FORCE
6262306a36Sopenharmony_ci	$(call if_changed,lzma)
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci$(obj)/Image.lzo: $(obj)/Image FORCE
6562306a36Sopenharmony_ci	$(call if_changed,lzo)
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci$(obj)/Image.zst: $(obj)/Image FORCE
6862306a36Sopenharmony_ci	$(call if_changed,zstd)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci$(obj)/loader.bin: $(obj)/loader FORCE
7162306a36Sopenharmony_ci	$(call if_changed,objcopy)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciEFI_ZBOOT_PAYLOAD	:= Image
7462306a36Sopenharmony_ciEFI_ZBOOT_BFD_TARGET	:= elf$(BITS)-littleriscv
7562306a36Sopenharmony_ciEFI_ZBOOT_MACH_TYPE	:= RISCV$(BITS)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciinclude $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot
78