^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # arch/x86/realmode/Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) # License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # Sanitizer runtimes are unavailable and cannot be linked here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) KASAN_SANITIZE := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) KCSAN_SANITIZE := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) OBJECT_FILES_NON_STANDARD := y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) KCOV_INSTRUMENT := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) always-y := realmode.bin realmode.relocs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) wakeup-objs := wakeup_asm.o wakemain.o video-mode.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) wakeup-objs += copy.o bioscall.o regs.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) # The link order of the video-*.o modules can matter. In particular,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # video-vga.o *must* be listed first, followed by video-vesa.o.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) # Hardware-specific drivers should follow in the order they should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) # probed, and video-bios.o should typically be last.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) wakeup-objs += video-vga.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) wakeup-objs += video-vesa.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) wakeup-objs += video-bios.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) realmode-y += header.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) realmode-y += trampoline_$(BITS).o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) realmode-y += stack.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) realmode-y += reboot.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) targets += $(realmode-y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) quiet_cmd_pasyms = PASYMS $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) targets += pasyms.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) $(call if_changed,pasyms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) targets += realmode.lds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) $(obj)/realmode.lds: $(obj)/pasyms.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) CPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) targets += realmode.elf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) $(call if_changed,ld)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) OBJCOPYFLAGS_realmode.bin := -O binary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) targets += realmode.bin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) $(call if_changed,objcopy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) quiet_cmd_relocs = RELOCS $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) targets += realmode.relocs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) $(call if_changed,relocs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) # ---------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) -I$(srctree)/arch/x86/boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) GCOV_PROFILE := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) UBSAN_SANITIZE := n