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 | |
| 10 | subdir- := wakeup |
| 11 | |
| 12 | always := realmode.bin |
| 13 | |
| 14 | realmode-y += header.o |
| 15 | |
| 16 | targets += $(realmode-y) |
| 17 | |
| 18 | REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y)) |
| 19 | |
| 20 | sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p' |
| 21 | |
| 22 | quiet_cmd_pasyms = PASYMS $@ |
| 23 | cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \ |
| 24 | sed $(sed-pasyms) | sort | uniq > $@ |
| 25 | |
| 26 | $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE |
| 27 | $(call if_changed,pasyms) |
| 28 | |
| 29 | $(obj)/realmode.lds: $(obj)/pasyms.h |
| 30 | |
| 31 | LDFLAGS_realmode.elf := --emit-relocs -T |
| 32 | CPPFLAGS_realmode.lds += -P -C -I$(obj) |
| 33 | |
| 34 | $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE |
| 35 | $(call if_changed,ld) |
| 36 | |
| 37 | OBJCOPYFLAGS_realmode.bin := -O binary |
| 38 | |
| 39 | $(obj)/realmode.bin: $(obj)/realmode.elf |
| 40 | $(call if_changed,objcopy) |
| 41 | |
| 42 | quiet_cmd_relocs = RELOCS $@ |
| 43 | cmd_relocs = scripts/x86-relocs --realmode $< > $@ |
| 44 | $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE |
| 45 | $(call if_changed,relocs) |
| 46 | |
| 47 | # --------------------------------------------------------------------------- |
| 48 | |
| 49 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
| 50 | # that way we can complain to the user if the CPU is insufficient. |
| 51 | KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \ |
| 52 | -DDISABLE_BRANCH_PROFILING \ |
| 53 | -Wall -Wstrict-prototypes \ |
| 54 | -march=i386 -mregparm=3 \ |
| 55 | -include $(srctree)/$(src)/../../boot/code16gcc.h \ |
| 56 | -fno-strict-aliasing -fomit-frame-pointer \ |
| 57 | $(call cc-option, -ffreestanding) \ |
| 58 | $(call cc-option, -fno-toplevel-reorder,\ |
| 59 | $(call cc-option, -fno-unit-at-a-time)) \ |
| 60 | $(call cc-option, -fno-stack-protector) \ |
| 61 | $(call cc-option, -mpreferred-stack-boundary=2) |
| 62 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
| 63 | GCOV_PROFILE := n |