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# 9 10always-y := realmode.bin realmode.relocs 11 12wakeup-objs := wakeup_asm.o wakemain.o video-mode.o 13wakeup-objs += copy.o bioscall.o regs.o 14# The link order of the video-*.o modules can matter. In particular, 15# video-vga.o *must* be listed first, followed by video-vesa.o. 16# Hardware-specific drivers should follow in the order they should be 17# probed, and video-bios.o should typically be last. 18wakeup-objs += video-vga.o 19wakeup-objs += video-vesa.o 20wakeup-objs += video-bios.o 21 22realmode-y += header.o 23realmode-y += trampoline_$(BITS).o 24realmode-y += stack.o 25realmode-y += reboot.o 26realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs) 27 28targets += $(realmode-y) 29 30REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) 31 32sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p' 33 34quiet_cmd_pasyms = PASYMS $@ 35 cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@ 36 37targets += pasyms.h 38$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE 39 $(call if_changed,pasyms) 40 41targets += realmode.lds 42$(obj)/realmode.lds: $(obj)/pasyms.h 43 44LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T 45CPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj) 46 47targets += realmode.elf 48$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE 49 $(call if_changed,ld) 50 51OBJCOPYFLAGS_realmode.bin := -O binary 52 53targets += realmode.bin 54$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE 55 $(call if_changed,objcopy) 56 57quiet_cmd_relocs = RELOCS $@ 58 cmd_relocs = arch/x86/tools/relocs --realmode $< > $@ 59 60targets += realmode.relocs 61$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE 62 $(call if_changed,relocs) 63 64# --------------------------------------------------------------------------- 65 66KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \ 67 -I$(srctree)/arch/x86/boot 68KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 69KBUILD_CFLAGS += -fno-asynchronous-unwind-tables 70