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