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 $@ |
Masahiro Yamada | afa974b | 2019-01-17 19:02:43 +0900 | [diff] [blame] | 40 | cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@ |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 41 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 42 | targets += pasyms.h |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 43 | $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE |
| 44 | $(call if_changed,pasyms) |
| 45 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 46 | targets += realmode.lds |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 47 | $(obj)/realmode.lds: $(obj)/pasyms.h |
| 48 | |
George Rimar | 927185c | 2019-01-11 12:10:12 -0800 | [diff] [blame] | 49 | LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T |
Arnd Bergmann | 58ab5e0 | 2016-06-15 17:45:46 +0200 | [diff] [blame] | 50 | CPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj) |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 51 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 52 | targets += realmode.elf |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 53 | $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE |
| 54 | $(call if_changed,ld) |
| 55 | |
| 56 | OBJCOPYFLAGS_realmode.bin := -O binary |
| 57 | |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 58 | targets += realmode.bin |
Peter Foley | a9358bc | 2014-04-15 13:58:13 -0400 | [diff] [blame] | 59 | $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 60 | $(call if_changed,objcopy) |
| 61 | |
| 62 | quiet_cmd_relocs = RELOCS $@ |
Jarkko Sakkinen | f2604c1 | 2012-05-08 21:22:44 +0300 | [diff] [blame] | 63 | cmd_relocs = arch/x86/tools/relocs --realmode $< > $@ |
H. Peter Anvin | 0f6f11eb | 2012-05-09 14:53:01 -0700 | [diff] [blame] | 64 | |
| 65 | targets += realmode.relocs |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 66 | $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE |
| 67 | $(call if_changed,relocs) |
| 68 | |
| 69 | # --------------------------------------------------------------------------- |
| 70 | |
Paul Bolle | 06cbbac | 2016-11-25 13:38:34 +0100 | [diff] [blame] | 71 | KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \ |
David Woodhouse | 1c678da | 2014-01-08 11:21:20 +0000 | [diff] [blame] | 72 | -I$(srctree)/arch/x86/boot |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 73 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
| 74 | GCOV_PROFILE := n |
Andrey Ryabinin | c6d3085 | 2016-01-20 15:00:55 -0800 | [diff] [blame] | 75 | UBSAN_SANITIZE := n |