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