xref: /openbmc/linux/arch/riscv/boot/Makefile (revision 597ac160)
1c0fbcd99SAnup Patel#
2c0fbcd99SAnup Patel# arch/riscv/boot/Makefile
3c0fbcd99SAnup Patel#
4c0fbcd99SAnup Patel# This file is included by the global makefile so that you can add your own
5c0fbcd99SAnup Patel# architecture-specific flags and dependencies.
6c0fbcd99SAnup Patel#
7c0fbcd99SAnup Patel# This file is subject to the terms and conditions of the GNU General Public
8c0fbcd99SAnup Patel# License.  See the file "COPYING" in the main directory of this archive
9c0fbcd99SAnup Patel# for more details.
10c0fbcd99SAnup Patel#
11c0fbcd99SAnup Patel# Copyright (C) 2018, Anup Patel.
12c0fbcd99SAnup Patel# Author: Anup Patel <anup@brainfault.org>
13c0fbcd99SAnup Patel#
14c0fbcd99SAnup Patel# Based on the ia64 and arm64 boot/Makefile.
15c0fbcd99SAnup Patel#
16c0fbcd99SAnup Patel
1720d38f7cSTobias KlauserKCOV_INSTRUMENT := n
1820d38f7cSTobias Klauser
19c0fbcd99SAnup PatelOBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
20*597ac160SGeert UytterhoevenOBJCOPYFLAGS_loader.bin :=-O binary
2144c92257SVitaly WoolOBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
22c0fbcd99SAnup Patel
232c42bcbbSKefeng Wangtargets := Image Image.* loader loader.o loader.lds loader.bin
2444c92257SVitaly Wooltargets := Image Image.* loader loader.o loader.lds loader.bin xipImage
2544c92257SVitaly Wool
2644c92257SVitaly Woolifeq ($(CONFIG_XIP_KERNEL),y)
2744c92257SVitaly Wool
2844c92257SVitaly Woolquiet_cmd_mkxip = $(quiet_cmd_objcopy)
2944c92257SVitaly Woolcmd_mkxip = $(cmd_objcopy)
3044c92257SVitaly Wool
3144c92257SVitaly Wool$(obj)/xipImage: vmlinux FORCE
3244c92257SVitaly Wool	$(call if_changed,mkxip)
3344c92257SVitaly Wool	@$(kecho) '  Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)'
3444c92257SVitaly Wool
3544c92257SVitaly Woolendif
36c0fbcd99SAnup Patel
37559d1e45SAlexandre Ghitiifdef CONFIG_RELOCATABLE
38559d1e45SAlexandre Ghitivmlinux.relocs: vmlinux
39559d1e45SAlexandre Ghiti	@ (! [ -f vmlinux.relocs ] && echo "vmlinux.relocs can't be found, please remove vmlinux and try again") || true
40559d1e45SAlexandre Ghiti
41559d1e45SAlexandre Ghiti$(obj)/Image: vmlinux.relocs FORCE
42559d1e45SAlexandre Ghitielse
43c0fbcd99SAnup Patel$(obj)/Image: vmlinux FORCE
44559d1e45SAlexandre Ghitiendif
45c0fbcd99SAnup Patel	$(call if_changed,objcopy)
46c0fbcd99SAnup Patel
47c0fbcd99SAnup Patel$(obj)/Image.gz: $(obj)/Image FORCE
48c0fbcd99SAnup Patel	$(call if_changed,gzip)
49c0fbcd99SAnup Patel
500e72a2f9SOlof Johansson$(obj)/loader.o: $(src)/loader.S $(obj)/Image
51405fe7aaSChristoph Hellwig
52405fe7aaSChristoph Hellwig$(obj)/loader: $(obj)/loader.o $(obj)/Image $(obj)/loader.lds FORCE
53405fe7aaSChristoph Hellwig	$(Q)$(LD) -T $(obj)/loader.lds -o $@ $(obj)/loader.o
54405fe7aaSChristoph Hellwig
558083c629SAtish Patra$(obj)/Image.bz2: $(obj)/Image FORCE
568083c629SAtish Patra	$(call if_changed,bzip2)
578083c629SAtish Patra
588083c629SAtish Patra$(obj)/Image.lz4: $(obj)/Image FORCE
598083c629SAtish Patra	$(call if_changed,lz4)
608083c629SAtish Patra
618083c629SAtish Patra$(obj)/Image.lzma: $(obj)/Image FORCE
628083c629SAtish Patra	$(call if_changed,lzma)
638083c629SAtish Patra
648083c629SAtish Patra$(obj)/Image.lzo: $(obj)/Image FORCE
658083c629SAtish Patra	$(call if_changed,lzo)
668083c629SAtish Patra
67de59b6edSJisheng Zhang$(obj)/Image.zst: $(obj)/Image FORCE
68de59b6edSJisheng Zhang	$(call if_changed,zstd)
69de59b6edSJisheng Zhang
7037809df4SChristoph Hellwig$(obj)/loader.bin: $(obj)/loader FORCE
7137809df4SChristoph Hellwig	$(call if_changed,objcopy)
72f5579340SArd Biesheuvel
73f5579340SArd BiesheuvelEFI_ZBOOT_PAYLOAD	:= Image
74f5579340SArd BiesheuvelEFI_ZBOOT_BFD_TARGET	:= elf$(BITS)-littleriscv
75f5579340SArd BiesheuvelEFI_ZBOOT_MACH_TYPE	:= RISCV$(BITS)
76f5579340SArd Biesheuvel
77f5579340SArd Biesheuvelinclude $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot
78