18c2ecf20Sopenharmony_ci#
28c2ecf20Sopenharmony_ci# arch/x86/realmode/Makefile
38c2ecf20Sopenharmony_ci#
48c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
58c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
68c2ecf20Sopenharmony_ci# for more details.
78c2ecf20Sopenharmony_ci#
88c2ecf20Sopenharmony_ci#
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci# Sanitizer runtimes are unavailable and cannot be linked here.
118c2ecf20Sopenharmony_ciKASAN_SANITIZE			:= n
128c2ecf20Sopenharmony_ciKCSAN_SANITIZE			:= n
138c2ecf20Sopenharmony_ciOBJECT_FILES_NON_STANDARD	:= y
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
168c2ecf20Sopenharmony_ciKCOV_INSTRUMENT		:= n
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cialways-y := realmode.bin realmode.relocs
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciwakeup-objs	:= wakeup_asm.o wakemain.o video-mode.o
218c2ecf20Sopenharmony_ciwakeup-objs	+= copy.o bioscall.o regs.o
228c2ecf20Sopenharmony_ci# The link order of the video-*.o modules can matter.  In particular,
238c2ecf20Sopenharmony_ci# video-vga.o *must* be listed first, followed by video-vesa.o.
248c2ecf20Sopenharmony_ci# Hardware-specific drivers should follow in the order they should be
258c2ecf20Sopenharmony_ci# probed, and video-bios.o should typically be last.
268c2ecf20Sopenharmony_ciwakeup-objs	+= video-vga.o
278c2ecf20Sopenharmony_ciwakeup-objs	+= video-vesa.o
288c2ecf20Sopenharmony_ciwakeup-objs	+= video-bios.o
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cirealmode-y			+= header.o
318c2ecf20Sopenharmony_cirealmode-y			+= trampoline_$(BITS).o
328c2ecf20Sopenharmony_cirealmode-y			+= stack.o
338c2ecf20Sopenharmony_cirealmode-y			+= reboot.o
348c2ecf20Sopenharmony_cirealmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_citargets	+= $(realmode-y)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciREALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cised-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciquiet_cmd_pasyms = PASYMS  $@
438c2ecf20Sopenharmony_ci      cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_citargets += pasyms.h
468c2ecf20Sopenharmony_ci$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
478c2ecf20Sopenharmony_ci	$(call if_changed,pasyms)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_citargets += realmode.lds
508c2ecf20Sopenharmony_ci$(obj)/realmode.lds: $(obj)/pasyms.h
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciLDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
538c2ecf20Sopenharmony_ciCPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_citargets += realmode.elf
568c2ecf20Sopenharmony_ci$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
578c2ecf20Sopenharmony_ci	$(call if_changed,ld)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciOBJCOPYFLAGS_realmode.bin := -O binary
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_citargets += realmode.bin
628c2ecf20Sopenharmony_ci$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
638c2ecf20Sopenharmony_ci	$(call if_changed,objcopy)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ciquiet_cmd_relocs = RELOCS  $@
668c2ecf20Sopenharmony_ci      cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_citargets += realmode.relocs
698c2ecf20Sopenharmony_ci$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
708c2ecf20Sopenharmony_ci	$(call if_changed,relocs)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci# ---------------------------------------------------------------------------
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciKBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
758c2ecf20Sopenharmony_ci		   -I$(srctree)/arch/x86/boot
768c2ecf20Sopenharmony_ciKBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
778c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
788c2ecf20Sopenharmony_ciGCOV_PROFILE := n
798c2ecf20Sopenharmony_ciUBSAN_SANITIZE := n
80