blob: c556c5ae8de5973852dd7da7517c65fe04fb00e1 [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 $@
40 cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \
41 sed $(sed-pasyms) | sort | uniq > $@
42
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070043targets += pasyms.h
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030044$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
45 $(call if_changed,pasyms)
46
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070047targets += realmode.lds
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030048$(obj)/realmode.lds: $(obj)/pasyms.h
49
50LDFLAGS_realmode.elf := --emit-relocs -T
51CPPFLAGS_realmode.lds += -P -C -I$(obj)
52
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070053targets += realmode.elf
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030054$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
55 $(call if_changed,ld)
56
57OBJCOPYFLAGS_realmode.bin := -O binary
58
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070059targets += realmode.bin
Peter Foleya9358bc2014-04-15 13:58:13 -040060$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030061 $(call if_changed,objcopy)
62
63quiet_cmd_relocs = RELOCS $@
Jarkko Sakkinenf2604c12012-05-08 21:22:44 +030064 cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070065
66targets += realmode.relocs
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030067$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
68 $(call if_changed,relocs)
69
70# ---------------------------------------------------------------------------
71
David Woodhouse1c678da2014-01-08 11:21:20 +000072KBUILD_CFLAGS := $(LINUXINCLUDE) $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
73 -I$(srctree)/arch/x86/boot
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030074KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
75GCOV_PROFILE := n
Andrey Ryabininc6d30852016-01-20 15:00:55 -080076UBSAN_SANITIZE := n