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 10 11# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. 12KCOV_INSTRUMENT := n 13 14always := realmode.bin realmode.relocs 15 16wakeup-objs := wakeup_asm.o wakemain.o video-mode.o 17wakeup-objs += copy.o bioscall.o regs.o 18# The link order of the video-*.o modules can matter. In particular, 19# video-vga.o *must* be listed first, followed by video-vesa.o. 20# Hardware-specific drivers should follow in the order they should be 21# probed, and video-bios.o should typically be last. 22wakeup-objs += video-vga.o 23wakeup-objs += video-vesa.o 24wakeup-objs += video-bios.o 25 26realmode-y += header.o 27realmode-y += trampoline_$(BITS).o 28realmode-y += stack.o 29realmode-y += reboot.o 30realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs) 31 32targets += $(realmode-y) 33 34REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) 35 36sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p' 37 38quiet_cmd_pasyms = PASYMS $@ 39 cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \ 40 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$(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 @: 62 63quiet_cmd_relocs = RELOCS $@ 64 cmd_relocs = arch/x86/tools/relocs --realmode $< > $@ 65 66targets += realmode.relocs 67$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE 68 $(call if_changed,relocs) 69 70# --------------------------------------------------------------------------- 71 72KBUILD_CFLAGS := $(LINUXINCLUDE) $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \ 73 -I$(srctree)/arch/x86/boot 74KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 75GCOV_PROFILE := n 76