Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 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 | # |
Josh Poimboeuf | c0dd671686 | 2016-02-28 22:22:34 -0600 | [diff] [blame] | 9 | KASAN_SANITIZE := n |
| 10 | OBJECT_FILES_NON_STANDARD := y |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 11 | |
Dmitry Vyukov | 5c9a875 | 2016-03-22 14:27:30 -0700 | [diff] [blame] | 12 | # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. |
| 13 | KCOV_INSTRUMENT := n |
| 14 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 15 | always := realmode.bin realmode.relocs |
Jarkko Sakkinen | c484547 | 2012-05-08 21:22:42 +0300 | [diff] [blame] | 16 | |
| 17 | wakeup-objs := wakeup_asm.o wakemain.o video-mode.o |
| 18 | wakeup-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. |
| 23 | wakeup-objs += video-vga.o |
| 24 | wakeup-objs += video-vesa.o |
| 25 | wakeup-objs += video-bios.o |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 26 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 27 | realmode-y += header.o |
| 28 | realmode-y += trampoline_$(BITS).o |
| 29 | realmode-y += stack.o |
H. Peter Anvin | 6505139 | 2012-06-16 21:47:37 -0700 | [diff] [blame] | 30 | realmode-y += reboot.o |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 31 | realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs) |
| 32 | |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 33 | targets += $(realmode-y) |
| 34 | |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 35 | REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) |
| 36 | |
| 37 | sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p' |
| 38 | |
| 39 | quiet_cmd_pasyms = PASYMS $@ |
| 40 | cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \ |
| 41 | sed $(sed-pasyms) | sort | uniq > $@ |
| 42 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 43 | targets += pasyms.h |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 44 | $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE |
| 45 | $(call if_changed,pasyms) |
| 46 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 47 | targets += realmode.lds |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 48 | $(obj)/realmode.lds: $(obj)/pasyms.h |
| 49 | |
| 50 | LDFLAGS_realmode.elf := --emit-relocs -T |
| 51 | CPPFLAGS_realmode.lds += -P -C -I$(obj) |
| 52 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 53 | targets += realmode.elf |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 54 | $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE |
| 55 | $(call if_changed,ld) |
| 56 | |
| 57 | OBJCOPYFLAGS_realmode.bin := -O binary |
| 58 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 59 | targets += realmode.bin |
Peter Foley | a9358bc | 2014-04-15 13:58:13 -0400 | [diff] [blame] | 60 | $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 61 | $(call if_changed,objcopy) |
| 62 | |
| 63 | quiet_cmd_relocs = RELOCS $@ |
Jarkko Sakkinen | f2604c1 | 2012-05-08 21:22:44 +0300 | [diff] [blame] | 64 | cmd_relocs = arch/x86/tools/relocs --realmode $< > $@ |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 65 | |
| 66 | targets += realmode.relocs |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 67 | $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE |
| 68 | $(call if_changed,relocs) |
| 69 | |
| 70 | # --------------------------------------------------------------------------- |
| 71 | |
David Woodhouse | 1c678da | 2014-01-08 11:21:20 +0000 | [diff] [blame] | 72 | KBUILD_CFLAGS := $(LINUXINCLUDE) $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \ |
| 73 | -I$(srctree)/arch/x86/boot |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 74 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
| 75 | GCOV_PROFILE := n |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 76 | UBSAN_SANITIZE := n |