blob: 81a8e33115ad5b72d53fc0829930d60238dbb0c2 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Josh Poimboeufc0dd6716862016-02-28 22:22:34 -06002OBJECT_FILES_NON_STANDARD := y
3
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -07004purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o
5
6targets += $(purgatory-y)
7PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
8
Philipp Rudofa8cbda2018-07-13 16:59:09 -07009$(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE
Philipp Rudodf6f2802018-04-13 15:36:46 -070010 $(call if_changed_rule,cc_o_c)
11
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -070012LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
13targets += purgatory.ro
14
Mike Galbraith13a6798e2017-03-31 15:12:12 -070015KASAN_SANITIZE := n
Emese Revfy543c37c2016-05-24 00:11:37 +020016KCOV_INSTRUMENT := n
17
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -070018# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
19# in turn leaves some undefined symbols like __fentry__ in purgatory and not
20# sure how to relocate those. Like kexec-tools, use custom flags.
21
Sven Wegenere847f6a2018-03-24 22:21:13 +010022KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large
Vivek Goyal4df41852014-08-29 15:18:55 -070023KBUILD_CFLAGS += -m$(BITS)
Sebastian Andrzej Siewior90944e42016-11-04 19:39:40 +010024KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -070025
26$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
27 $(call if_changed,ld)
28
29targets += kexec-purgatory.c
30
Baoquan He887f4f82014-10-13 15:53:37 -070031CMD_BIN2C = $(objtree)/scripts/basic/bin2c
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -070032quiet_cmd_bin2c = BIN2C $@
Baoquan He887f4f82014-10-13 15:53:37 -070033 cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -070034
35$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
36 $(call if_changed,bin2c)
Vivek Goyal8fc5b4d2014-08-08 14:26:02 -070037
Vivek Goyal74ca3172014-08-29 15:18:46 -070038obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o