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