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