xref: /OK3568_Linux_fs/kernel/arch/x86/realmode/rm/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# arch/x86/realmode/Makefile
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun# This file is subject to the terms and conditions of the GNU General Public
5*4882a593Smuzhiyun# License.  See the file "COPYING" in the main directory of this archive
6*4882a593Smuzhiyun# for more details.
7*4882a593Smuzhiyun#
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun# Sanitizer runtimes are unavailable and cannot be linked here.
11*4882a593SmuzhiyunKASAN_SANITIZE			:= n
12*4882a593SmuzhiyunKCSAN_SANITIZE			:= n
13*4882a593SmuzhiyunOBJECT_FILES_NON_STANDARD	:= y
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
16*4882a593SmuzhiyunKCOV_INSTRUMENT		:= n
17*4882a593Smuzhiyun
18*4882a593Smuzhiyunalways-y := realmode.bin realmode.relocs
19*4882a593Smuzhiyun
20*4882a593Smuzhiyunwakeup-objs	:= wakeup_asm.o wakemain.o video-mode.o
21*4882a593Smuzhiyunwakeup-objs	+= copy.o bioscall.o regs.o
22*4882a593Smuzhiyun# The link order of the video-*.o modules can matter.  In particular,
23*4882a593Smuzhiyun# video-vga.o *must* be listed first, followed by video-vesa.o.
24*4882a593Smuzhiyun# Hardware-specific drivers should follow in the order they should be
25*4882a593Smuzhiyun# probed, and video-bios.o should typically be last.
26*4882a593Smuzhiyunwakeup-objs	+= video-vga.o
27*4882a593Smuzhiyunwakeup-objs	+= video-vesa.o
28*4882a593Smuzhiyunwakeup-objs	+= video-bios.o
29*4882a593Smuzhiyun
30*4882a593Smuzhiyunrealmode-y			+= header.o
31*4882a593Smuzhiyunrealmode-y			+= trampoline_$(BITS).o
32*4882a593Smuzhiyunrealmode-y			+= stack.o
33*4882a593Smuzhiyunrealmode-y			+= reboot.o
34*4882a593Smuzhiyunrealmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
35*4882a593Smuzhiyun
36*4882a593Smuzhiyuntargets	+= $(realmode-y)
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunREALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
39*4882a593Smuzhiyun
40*4882a593Smuzhiyunsed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
41*4882a593Smuzhiyun
42*4882a593Smuzhiyunquiet_cmd_pasyms = PASYMS  $@
43*4882a593Smuzhiyun      cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
44*4882a593Smuzhiyun
45*4882a593Smuzhiyuntargets += pasyms.h
46*4882a593Smuzhiyun$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
47*4882a593Smuzhiyun	$(call if_changed,pasyms)
48*4882a593Smuzhiyun
49*4882a593Smuzhiyuntargets += realmode.lds
50*4882a593Smuzhiyun$(obj)/realmode.lds: $(obj)/pasyms.h
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunLDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
53*4882a593SmuzhiyunCPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj)
54*4882a593Smuzhiyun
55*4882a593Smuzhiyuntargets += realmode.elf
56*4882a593Smuzhiyun$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
57*4882a593Smuzhiyun	$(call if_changed,ld)
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunOBJCOPYFLAGS_realmode.bin := -O binary
60*4882a593Smuzhiyun
61*4882a593Smuzhiyuntargets += realmode.bin
62*4882a593Smuzhiyun$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
63*4882a593Smuzhiyun	$(call if_changed,objcopy)
64*4882a593Smuzhiyun
65*4882a593Smuzhiyunquiet_cmd_relocs = RELOCS  $@
66*4882a593Smuzhiyun      cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
67*4882a593Smuzhiyun
68*4882a593Smuzhiyuntargets += realmode.relocs
69*4882a593Smuzhiyun$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
70*4882a593Smuzhiyun	$(call if_changed,relocs)
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun# ---------------------------------------------------------------------------
73*4882a593Smuzhiyun
74*4882a593SmuzhiyunKBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
75*4882a593Smuzhiyun		   -I$(srctree)/arch/x86/boot
76*4882a593SmuzhiyunKBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
77*4882a593SmuzhiyunKBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
78*4882a593SmuzhiyunGCOV_PROFILE := n
79*4882a593SmuzhiyunUBSAN_SANITIZE := n
80