blob: 5b84a2d308885d9ce8c7e3f861fe269b721f1982 [file] [log] [blame]
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +03001#
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
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070010always := realmode.bin realmode.relocs
Jarkko Sakkinenc4845472012-05-08 21:22:42 +030011
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
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030021
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070022realmode-y += header.o
23realmode-y += trampoline_$(BITS).o
24realmode-y += stack.o
25realmode-$(CONFIG_X86_32) += reboot_32.o
26realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs)
27
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030028targets += $(realmode-y)
29
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030030REALMODE_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) $(filter-out FORCE,$^) | \
36 sed $(sed-pasyms) | sort | uniq > $@
37
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070038targets += pasyms.h
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030039$(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
40 $(call if_changed,pasyms)
41
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070042targets += realmode.lds
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030043$(obj)/realmode.lds: $(obj)/pasyms.h
44
45LDFLAGS_realmode.elf := --emit-relocs -T
46CPPFLAGS_realmode.lds += -P -C -I$(obj)
47
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070048targets += realmode.elf
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030049$(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
50 $(call if_changed,ld)
51
52OBJCOPYFLAGS_realmode.bin := -O binary
53
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070054targets += realmode.bin
Jarkko Sakkinenc5403ae2012-05-09 23:25:06 +030055$(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030056 $(call if_changed,objcopy)
57
58quiet_cmd_relocs = RELOCS $@
Jarkko Sakkinenf2604c12012-05-08 21:22:44 +030059 cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
H. Peter Anvin0f6f11eb2012-05-09 14:53:01 -070060
61targets += realmode.relocs
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030062$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
63 $(call if_changed,relocs)
64
65# ---------------------------------------------------------------------------
66
67# How to compile the 16-bit code. Note we always compile for -march=i386,
68# that way we can complain to the user if the CPU is insufficient.
Jarkko Sakkinenc4845472012-05-08 21:22:42 +030069KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ -D_WAKEUP \
70 -I$(srctree)/arch/x86/boot \
Jarkko Sakkinenb3266bd2012-05-08 21:22:25 +030071 -DDISABLE_BRANCH_PROFILING \
72 -Wall -Wstrict-prototypes \
73 -march=i386 -mregparm=3 \
74 -include $(srctree)/$(src)/../../boot/code16gcc.h \
75 -fno-strict-aliasing -fomit-frame-pointer \
76 $(call cc-option, -ffreestanding) \
77 $(call cc-option, -fno-toplevel-reorder,\
78 $(call cc-option, -fno-unit-at-a-time)) \
79 $(call cc-option, -fno-stack-protector) \
80 $(call cc-option, -mpreferred-stack-boundary=2)
81KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
82GCOV_PROFILE := n