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