2 # arch/x86/realmode/Makefile
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
10 OBJECT_FILES_NON_STANDARD
:= y
12 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
15 always
:= realmode.bin realmode.relocs
17 wakeup-objs
:= wakeup_asm.o wakemain.o video-mode.o
18 wakeup-objs
+= copy.o bioscall.o regs.o
19 # The link order of the video-*.o modules can matter. In particular,
20 # video-vga.o *must* be listed first, followed by video-vesa.o.
21 # Hardware-specific drivers should follow in the order they should be
22 # probed, and video-bios.o should typically be last.
23 wakeup-objs
+= video-vga.o
24 wakeup-objs
+= video-vesa.o
25 wakeup-objs
+= video-bios.o
27 realmode-y
+= header.o
28 realmode-y
+= trampoline_
$(BITS
).o
30 realmode-y
+= reboot.o
31 realmode-
$(CONFIG_ACPI_SLEEP
) += $(wakeup-objs
)
33 targets
+= $(realmode-y
)
35 REALMODE_OBJS
= $(addprefix $(obj
)/,$(realmode-y
))
37 sed-pasyms
:= -n
-r
-e
's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
39 quiet_cmd_pasyms
= PASYMS
$@
40 cmd_pasyms
= $(NM
) $(filter-out FORCE
,$^
) | \
41 sed
$(sed-pasyms
) |
sort | uniq
> $@
44 $(obj
)/pasyms.h
: $(REALMODE_OBJS
) FORCE
45 $(call if_changed
,pasyms
)
47 targets
+= realmode.lds
48 $(obj
)/realmode.lds
: $(obj
)/pasyms.h
50 LDFLAGS_realmode.elf
:= -m elf_i386
--emit-relocs
-T
51 CPPFLAGS_realmode.lds
+= -P
-C
-I
$(objtree
)/$(obj
)
53 targets
+= realmode.elf
54 $(obj
)/realmode.elf
: $(obj
)/realmode.lds
$(REALMODE_OBJS
) FORCE
57 OBJCOPYFLAGS_realmode.bin
:= -O binary
59 targets
+= realmode.bin
60 $(obj
)/realmode.bin
: $(obj
)/realmode.elf
$(obj
)/realmode.relocs FORCE
61 $(call if_changed
,objcopy
)
63 quiet_cmd_relocs
= RELOCS
$@
64 cmd_relocs
= arch
/x86
/tools
/relocs
--realmode
$< > $@
66 targets
+= realmode.relocs
67 $(obj
)/realmode.relocs
: $(obj
)/realmode.elf FORCE
68 $(call if_changed
,relocs
)
70 # ---------------------------------------------------------------------------
72 KBUILD_CFLAGS
:= $(REALMODE_CFLAGS
) -D_SETUP
-D_WAKEUP \
73 -I
$(srctree
)/arch
/x86
/boot
74 KBUILD_AFLAGS
:= $(KBUILD_CFLAGS
) -D__ASSEMBLY__