162306a36Sopenharmony_ci#
262306a36Sopenharmony_ci# arch/x86/realmode/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#
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci# Sanitizer runtimes are unavailable and cannot be linked here.
1162306a36Sopenharmony_ciKASAN_SANITIZE			:= n
1262306a36Sopenharmony_ciKCSAN_SANITIZE			:= n
1362306a36Sopenharmony_ciKMSAN_SANITIZE			:= n
1462306a36Sopenharmony_ciOBJECT_FILES_NON_STANDARD	:= y
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
1762306a36Sopenharmony_ciKCOV_INSTRUMENT		:= n
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cialways-y := realmode.bin realmode.relocs
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciwakeup-objs	:= wakeup_asm.o wakemain.o video-mode.o
2262306a36Sopenharmony_ciwakeup-objs	+= copy.o bioscall.o regs.o
2362306a36Sopenharmony_ci# The link order of the video-*.o modules can matter.  In particular,
2462306a36Sopenharmony_ci# video-vga.o *must* be listed first, followed by video-vesa.o.
2562306a36Sopenharmony_ci# Hardware-specific drivers should follow in the order they should be
2662306a36Sopenharmony_ci# probed, and video-bios.o should typically be last.
2762306a36Sopenharmony_ciwakeup-objs	+= video-vga.o
2862306a36Sopenharmony_ciwakeup-objs	+= video-vesa.o
2962306a36Sopenharmony_ciwakeup-objs	+= video-bios.o
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cirealmode-y			+= header.o
3262306a36Sopenharmony_cirealmode-y			+= trampoline_$(BITS).o
3362306a36Sopenharmony_cirealmode-y			+= stack.o
3462306a36Sopenharmony_cirealmode-y			+= reboot.o
3562306a36Sopenharmony_cirealmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_citargets	+= $(realmode-y)
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciREALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_cised-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciquiet_cmd_pasyms = PASYMS  $@
4462306a36Sopenharmony_ci      cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_citargets += pasyms.h
4762306a36Sopenharmony_ci$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
4862306a36Sopenharmony_ci	$(call if_changed,pasyms)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_citargets += realmode.lds
5162306a36Sopenharmony_ci$(obj)/realmode.lds: $(obj)/pasyms.h
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciLDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
5462306a36Sopenharmony_ciCPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj)
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_citargets += realmode.elf
5762306a36Sopenharmony_ci$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
5862306a36Sopenharmony_ci	$(call if_changed,ld)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciOBJCOPYFLAGS_realmode.bin := -O binary
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_citargets += realmode.bin
6362306a36Sopenharmony_ci$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
6462306a36Sopenharmony_ci	$(call if_changed,objcopy)
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciquiet_cmd_relocs = RELOCS  $@
6762306a36Sopenharmony_ci      cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_citargets += realmode.relocs
7062306a36Sopenharmony_ci$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
7162306a36Sopenharmony_ci	$(call if_changed,relocs)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci# ---------------------------------------------------------------------------
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciKBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
7662306a36Sopenharmony_ci		   -I$(srctree)/arch/x86/boot
7762306a36Sopenharmony_ciKBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
7862306a36Sopenharmony_ciKBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
7962306a36Sopenharmony_ciGCOV_PROFILE := n
8062306a36Sopenharmony_ciUBSAN_SANITIZE := n
81