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 | # |
| 9 | |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 10 | always := realmode.bin |
| 11 | |
| 12 | realmode-y += header.o |
Jarkko Sakkinen | 48927bb | 2012-05-08 21:22:28 +0300 | [diff] [blame] | 13 | realmode-y += trampoline_$(BITS).o |
Jarkko Sakkinen | 8e029fc | 2012-05-08 21:22:40 +0300 | [diff] [blame] | 14 | realmode-y += stack.o |
H. Peter Anvin | be60828 | 2012-05-08 21:22:38 +0300 | [diff] [blame] | 15 | realmode-$(CONFIG_X86_32) += reboot_32.o |
Jarkko Sakkinen | c484547 | 2012-05-08 21:22:42 +0300 | [diff] [blame] | 16 | realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs) |
| 17 | |
| 18 | wakeup-objs := wakeup_asm.o wakemain.o video-mode.o |
| 19 | wakeup-objs += copy.o bioscall.o regs.o |
| 20 | # The link order of the video-*.o modules can matter. In particular, |
| 21 | # video-vga.o *must* be listed first, followed by video-vesa.o. |
| 22 | # Hardware-specific drivers should follow in the order they should be |
| 23 | # probed, and video-bios.o should typically be last. |
| 24 | wakeup-objs += video-vga.o |
| 25 | wakeup-objs += video-vesa.o |
| 26 | wakeup-objs += video-bios.o |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 27 | |
| 28 | targets += $(realmode-y) |
| 29 | |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 30 | REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) |
| 31 | |
| 32 | sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p' |
| 33 | |
| 34 | quiet_cmd_pasyms = PASYMS $@ |
| 35 | cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \ |
| 36 | sed $(sed-pasyms) | sort | uniq > $@ |
| 37 | |
| 38 | $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE |
| 39 | $(call if_changed,pasyms) |
| 40 | |
| 41 | $(obj)/realmode.lds: $(obj)/pasyms.h |
| 42 | |
| 43 | LDFLAGS_realmode.elf := --emit-relocs -T |
| 44 | CPPFLAGS_realmode.lds += -P -C -I$(obj) |
| 45 | |
| 46 | $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE |
| 47 | $(call if_changed,ld) |
| 48 | |
| 49 | OBJCOPYFLAGS_realmode.bin := -O binary |
| 50 | |
| 51 | $(obj)/realmode.bin: $(obj)/realmode.elf |
| 52 | $(call if_changed,objcopy) |
| 53 | |
| 54 | quiet_cmd_relocs = RELOCS $@ |
Jarkko Sakkinen | f2604c1 | 2012-05-08 21:22:44 +0300 | [diff] [blame^] | 55 | cmd_relocs = arch/x86/tools/relocs --realmode $< > $@ |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 56 | $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE |
| 57 | $(call if_changed,relocs) |
| 58 | |
| 59 | # --------------------------------------------------------------------------- |
| 60 | |
| 61 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
| 62 | # that way we can complain to the user if the CPU is insufficient. |
Jarkko Sakkinen | c484547 | 2012-05-08 21:22:42 +0300 | [diff] [blame] | 63 | KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ -D_WAKEUP \ |
| 64 | -I$(srctree)/arch/x86/boot \ |
Jarkko Sakkinen | b3266bd | 2012-05-08 21:22:25 +0300 | [diff] [blame] | 65 | -DDISABLE_BRANCH_PROFILING \ |
| 66 | -Wall -Wstrict-prototypes \ |
| 67 | -march=i386 -mregparm=3 \ |
| 68 | -include $(srctree)/$(src)/../../boot/code16gcc.h \ |
| 69 | -fno-strict-aliasing -fomit-frame-pointer \ |
| 70 | $(call cc-option, -ffreestanding) \ |
| 71 | $(call cc-option, -fno-toplevel-reorder,\ |
| 72 | $(call cc-option, -fno-unit-at-a-time)) \ |
| 73 | $(call cc-option, -fno-stack-protector) \ |
| 74 | $(call cc-option, -mpreferred-stack-boundary=2) |
| 75 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
| 76 | GCOV_PROFILE := n |