Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Josh Poimboeuf | c0dd671686 | 2016-02-28 22:22:34 -0600 | [diff] [blame] | 2 | OBJECT_FILES_NON_STANDARD := y |
| 3 | |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 4 | purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o |
| 5 | |
| 6 | targets += $(purgatory-y) |
| 7 | PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) |
| 8 | |
Philipp Rudo | fa8cbda | 2018-07-13 16:59:09 -0700 | [diff] [blame] | 9 | $(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE |
Philipp Rudo | df6f280 | 2018-04-13 15:36:46 -0700 | [diff] [blame] | 10 | $(call if_changed_rule,cc_o_c) |
| 11 | |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 12 | LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib |
| 13 | targets += purgatory.ro |
| 14 | |
Mike Galbraith | 13a6798e | 2017-03-31 15:12:12 -0700 | [diff] [blame] | 15 | KASAN_SANITIZE := n |
Emese Revfy | 543c37c | 2016-05-24 00:11:37 +0200 | [diff] [blame] | 16 | KCOV_INSTRUMENT := n |
| 17 | |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 18 | # 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 Wegener | e847f6a | 2018-03-24 22:21:13 +0100 | [diff] [blame] | 22 | KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large |
Vivek Goyal | 4df4185 | 2014-08-29 15:18:55 -0700 | [diff] [blame] | 23 | KBUILD_CFLAGS += -m$(BITS) |
Sebastian Andrzej Siewior | 90944e4 | 2016-11-04 19:39:40 +0100 | [diff] [blame] | 24 | KBUILD_CFLAGS += $(call cc-option,-fno-PIE) |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 25 | |
| 26 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
| 27 | $(call if_changed,ld) |
| 28 | |
| 29 | targets += kexec-purgatory.c |
| 30 | |
Baoquan He | 887f4f8 | 2014-10-13 15:53:37 -0700 | [diff] [blame] | 31 | CMD_BIN2C = $(objtree)/scripts/basic/bin2c |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 32 | quiet_cmd_bin2c = BIN2C $@ |
Baoquan He | 887f4f8 | 2014-10-13 15:53:37 -0700 | [diff] [blame] | 33 | cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 34 | |
| 35 | $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE |
| 36 | $(call if_changed,bin2c) |
Vivek Goyal | 8fc5b4d | 2014-08-08 14:26:02 -0700 | [diff] [blame] | 37 | |
Vivek Goyal | 74ca317 | 2014-08-29 15:18:46 -0700 | [diff] [blame] | 38 | obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o |