xref: /openbmc/linux/arch/x86/realmode/rm/Makefile (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1b3266bd6SJarkko Sakkinen#
2b3266bd6SJarkko Sakkinen# arch/x86/realmode/Makefile
3b3266bd6SJarkko Sakkinen#
4b3266bd6SJarkko Sakkinen# This file is subject to the terms and conditions of the GNU General Public
5b3266bd6SJarkko Sakkinen# License.  See the file "COPYING" in the main directory of this archive
6b3266bd6SJarkko Sakkinen# for more details.
7b3266bd6SJarkko Sakkinen#
8b3266bd6SJarkko Sakkinen#
940d04110SMarco Elver
1040d04110SMarco Elver# Sanitizer runtimes are unavailable and cannot be linked here.
11ef7f0d6aSAndrey RyabininKASAN_SANITIZE			:= n
1240d04110SMarco ElverKCSAN_SANITIZE			:= n
13*93324e68SAlexander PotapenkoKMSAN_SANITIZE			:= n
14c0dd6716SJosh PoimboeufOBJECT_FILES_NON_STANDARD	:= y
15b3266bd6SJarkko Sakkinen
165c9a8750SDmitry Vyukov# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
175c9a8750SDmitry VyukovKCOV_INSTRUMENT		:= n
185c9a8750SDmitry Vyukov
195f2fb52fSMasahiro Yamadaalways-y := realmode.bin realmode.relocs
20c4845474SJarkko Sakkinen
21c4845474SJarkko Sakkinenwakeup-objs	:= wakeup_asm.o wakemain.o video-mode.o
22c4845474SJarkko Sakkinenwakeup-objs	+= copy.o bioscall.o regs.o
23c4845474SJarkko Sakkinen# The link order of the video-*.o modules can matter.  In particular,
24c4845474SJarkko Sakkinen# video-vga.o *must* be listed first, followed by video-vesa.o.
25c4845474SJarkko Sakkinen# Hardware-specific drivers should follow in the order they should be
26c4845474SJarkko Sakkinen# probed, and video-bios.o should typically be last.
27c4845474SJarkko Sakkinenwakeup-objs	+= video-vga.o
28c4845474SJarkko Sakkinenwakeup-objs	+= video-vesa.o
29c4845474SJarkko Sakkinenwakeup-objs	+= video-bios.o
30b3266bd6SJarkko Sakkinen
310f6f11ebSH. Peter Anvinrealmode-y			+= header.o
320f6f11ebSH. Peter Anvinrealmode-y			+= trampoline_$(BITS).o
330f6f11ebSH. Peter Anvinrealmode-y			+= stack.o
3465051397SH. Peter Anvinrealmode-y			+= reboot.o
350f6f11ebSH. Peter Anvinrealmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
360f6f11ebSH. Peter Anvin
37b3266bd6SJarkko Sakkinentargets	+= $(realmode-y)
38b3266bd6SJarkko Sakkinen
39b3266bd6SJarkko SakkinenREALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
40b3266bd6SJarkko Sakkinen
41b3266bd6SJarkko Sakkinensed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
42b3266bd6SJarkko Sakkinen
43b3266bd6SJarkko Sakkinenquiet_cmd_pasyms = PASYMS  $@
44afa974b7SMasahiro Yamada      cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
45b3266bd6SJarkko Sakkinen
460f6f11ebSH. Peter Anvintargets += pasyms.h
47b3266bd6SJarkko Sakkinen$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
48b3266bd6SJarkko Sakkinen	$(call if_changed,pasyms)
49b3266bd6SJarkko Sakkinen
500f6f11ebSH. Peter Anvintargets += realmode.lds
51b3266bd6SJarkko Sakkinen$(obj)/realmode.lds: $(obj)/pasyms.h
52b3266bd6SJarkko Sakkinen
53927185c1SGeorge RimarLDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
5458ab5e0cSArnd BergmannCPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj)
55b3266bd6SJarkko Sakkinen
560f6f11ebSH. Peter Anvintargets += realmode.elf
57b3266bd6SJarkko Sakkinen$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
58b3266bd6SJarkko Sakkinen	$(call if_changed,ld)
59b3266bd6SJarkko Sakkinen
60b3266bd6SJarkko SakkinenOBJCOPYFLAGS_realmode.bin := -O binary
61b3266bd6SJarkko Sakkinen
620f6f11ebSH. Peter Anvintargets += realmode.bin
63a9358bc3SPeter Foley$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
64b3266bd6SJarkko Sakkinen	$(call if_changed,objcopy)
65b3266bd6SJarkko Sakkinen
66b3266bd6SJarkko Sakkinenquiet_cmd_relocs = RELOCS  $@
67f2604c14SJarkko Sakkinen      cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
680f6f11ebSH. Peter Anvin
690f6f11ebSH. Peter Anvintargets += realmode.relocs
70b3266bd6SJarkko Sakkinen$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
71b3266bd6SJarkko Sakkinen	$(call if_changed,relocs)
72b3266bd6SJarkko Sakkinen
73b3266bd6SJarkko Sakkinen# ---------------------------------------------------------------------------
74b3266bd6SJarkko Sakkinen
7506cbbac0SPaul BolleKBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
761c678da3SDavid Woodhouse		   -I$(srctree)/arch/x86/boot
77b3266bd6SJarkko SakkinenKBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
78003602adSArvind SankarKBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
79b3266bd6SJarkko SakkinenGCOV_PROFILE := n
80c6d30853SAndrey RyabininUBSAN_SANITIZE := n
81