blob: f60501a384f947b32941ad6a146491685161956b [file] [log] [blame]
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +03001#
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#
Josh Poimboeufc0dd6716862016-02-28 22:22:34 -06009KASAN_SANITIZE := n
10OBJECT_FILES_NON_STANDARD := y
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030011
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070012# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
13KCOV_INSTRUMENT := n
14
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070015always := realmode.bin realmode.relocs
Jarkko Sakkinenc4845472012-05-08 21:22:42 +030016
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
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030026
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070027realmode-y += header.o
28realmode-y += trampoline_$(BITS).o
29realmode-y += stack.o
H. Peter Anvin65051392012-06-16 21:47:37 -070030realmode-y += reboot.o
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070031realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs)
32
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030033targets += $(realmode-y)
34
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030035REALMODE_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 $@
Masahiro Yamadaafa974b2019-01-17 19:02:43 +090040 cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030041
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070042targets += pasyms.h
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030043$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
44 $(call if_changed,pasyms)
45
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070046targets += realmode.lds
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030047$(obj)/realmode.lds: $(obj)/pasyms.h
48
George Rimar927185c2019-01-11 12:10:12 -080049LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
Arnd Bergmann58ab5e02016-06-15 17:45:46 +020050CPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj)
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030051
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070052targets += realmode.elf
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030053$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
54 $(call if_changed,ld)
55
56OBJCOPYFLAGS_realmode.bin := -O binary
57
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070058targets += realmode.bin
Peter Foleya9358bc2014-04-15 13:58:13 -040059$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030060 $(call if_changed,objcopy)
61
62quiet_cmd_relocs = RELOCS $@
Jarkko Sakkinenf2604c12012-05-08 21:22:44 +030063 cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070064
65targets += realmode.relocs
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030066$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
67 $(call if_changed,relocs)
68
69# ---------------------------------------------------------------------------
70
Paul Bolle06cbbac2016-11-25 13:38:34 +010071KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
David Woodhouse1c678da2014-01-08 11:21:20 +000072 -I$(srctree)/arch/x86/boot
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030073KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
74GCOV_PROFILE := n
Andrey Ryabininc6d30852016-01-20 15:00:55 -080075UBSAN_SANITIZE := n