xref: /openbmc/linux/drivers/firmware/efi/libstub/Makefile (revision f4f75ad5741fe0331bbe1f5c42b906cda299f26b)
1*f4f75ad5SArd Biesheuvel#
2*f4f75ad5SArd Biesheuvel# The stub may be linked into the kernel proper or into a separate boot binary,
3*f4f75ad5SArd Biesheuvel# but in either case, it executes before the kernel does (with MMU disabled) so
4*f4f75ad5SArd Biesheuvel# things like ftrace and stack-protector are likely to cause trouble if left
5*f4f75ad5SArd Biesheuvel# enabled, even if doing so doesn't break the build.
6*f4f75ad5SArd Biesheuvel#
7*f4f75ad5SArd Biesheuvelcflags-$(CONFIG_X86_32)		:= -march=i386
8*f4f75ad5SArd Biesheuvelcflags-$(CONFIG_X86_64)		:= -mcmodel=small
9*f4f75ad5SArd Biesheuvelcflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
10*f4f75ad5SArd Biesheuvel				   -fPIC -fno-strict-aliasing -mno-red-zone \
11*f4f75ad5SArd Biesheuvel				   -mno-mmx -mno-sse -DDISABLE_BRANCH_PROFILING
12*f4f75ad5SArd Biesheuvel
13*f4f75ad5SArd Biesheuvelcflags-$(CONFIG_ARM64)		:= $(subst -pg,,$(KBUILD_CFLAGS))
14*f4f75ad5SArd Biesheuvelcflags-$(CONFIG_ARM)		:= $(subst -pg,,$(KBUILD_CFLAGS)) \
15*f4f75ad5SArd Biesheuvel				   -fno-builtin -fpic -mno-single-pic-base
16*f4f75ad5SArd Biesheuvel
17*f4f75ad5SArd BiesheuvelKBUILD_CFLAGS			:= $(cflags-y) \
18*f4f75ad5SArd Biesheuvel				   $(call cc-option,-ffreestanding) \
19*f4f75ad5SArd Biesheuvel				   $(call cc-option,-fno-stack-protector)
20*f4f75ad5SArd Biesheuvel
21*f4f75ad5SArd BiesheuvelGCOV_PROFILE			:= n
22*f4f75ad5SArd Biesheuvel
23*f4f75ad5SArd Biesheuvellib-y				:= efi-stub-helper.o
24*f4f75ad5SArd Biesheuvellib-$(CONFIG_EFI_ARMSTUB)	+= arm-stub.o fdt.o
25*f4f75ad5SArd Biesheuvel
26*f4f75ad5SArd BiesheuvelCFLAGS_fdt.o			+= -I$(srctree)/scripts/dtc/libfdt/
27