summaryrefslogtreecommitdiff
path: root/kexec/Makefile
blob: 2a985cff353984e6f2dac5e03544f78d0e721f00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# kexec (linux booting linux)
#
PURGATORY_HEX_C = kexec/purgatory.c

$(PURGATORY_HEX_C): $(PURGATORY) $(BIN_TO_HEX)
	$(MKDIR) -p $(@D)
	$(BIN_TO_HEX) purgatory < $(PURGATORY) > $@

KEXEC_SRCS =
KEXEC_GENERATED_SRCS =

KEXEC_SRCS += kexec/kexec.c
KEXEC_SRCS += kexec/ifdown.c
KEXEC_SRCS += kexec/kexec-elf.c
KEXEC_SRCS += kexec/kexec-elf-exec.c
KEXEC_SRCS += kexec/kexec-elf-core.c
KEXEC_SRCS += kexec/kexec-elf-rel.c
KEXEC_SRCS += kexec/kexec-elf-boot.c
KEXEC_SRCS += kexec/kexec-iomem.c
KEXEC_SRCS += kexec/firmware_memmap.c
KEXEC_SRCS += kexec/crashdump.c
KEXEC_SRCS += kexec/crashdump-xen.c
KEXEC_SRCS += kexec/phys_arch.c
KEXEC_SRCS += kexec/lzma.c
KEXEC_SRCS += kexec/zlib.c

KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)

dist += kexec/Makefile $(KEXEC_SRCS) $(KEXEC_GENERATED_SRCS)	\
	kexec/crashdump-elf.c					\
	kexec/crashdump.h kexec/firmware_memmap.h		\
	kexec/kexec-elf-boot.h					\
	kexec/kexec-elf.h kexec/kexec-sha256.h			\
	kexec/kexec-syscall.h kexec/kexec.h kexec/kexec.8

$(ARCH)_PROC_IOMEM		= kexec/proc_iomem.c
KEXEC_SRCS += $($(ARCH)_PROC_IOMEM)
$(ARCH)_VIRT_TO_PHYS		= kexec/virt_to_phys.c
KEXEC_SRCS += $($(ARCH)_VIRT_TO_PHYS)
$(ARCH)_ADD_SEGMENT		= kexec/add_segment.c
KEXEC_SRCS += $($(ARCH)_ADD_SEGMENT)
$(ARCH)_ADD_BUFFER		= kexec/add_buffer.c
KEXEC_SRCS += $($(ARCH)_ADD_BUFFER)
$(ARCH)_ARCH_REUSE_INITRD	= kexec/arch_reuse_initrd.c
KEXEC_SRCS += $($(ARCH)_ARCH_REUSE_INITRD)

include $(srcdir)/kexec/arch/alpha/Makefile
include $(srcdir)/kexec/arch/arm/Makefile
include $(srcdir)/kexec/arch/i386/Makefile
include $(srcdir)/kexec/arch/ia64/Makefile
include $(srcdir)/kexec/arch/mips/Makefile
include $(srcdir)/kexec/arch/cris/Makefile
include $(srcdir)/kexec/arch/ppc/Makefile
include $(srcdir)/kexec/arch/ppc64/Makefile
include $(srcdir)/kexec/arch/s390/Makefile
include $(srcdir)/kexec/arch/sh/Makefile
include $(srcdir)/kexec/arch/x86_64/Makefile

KEXEC_SRCS += $($(ARCH)_KEXEC_SRCS)

KEXEC_OBJS = $(call objify, $(KEXEC_SRCS) $(KEXEC_GENERATED_SRCS))
KEXEC_DEPS = $(call depify, $(KEXEC_OBJS))

clean += $(KEXEC_OBJS) $(KEXEC_DEPS) $(KEXEC_GENERATED_SRCS) \
	 $(KEXEC) $(KEXEC_MANPAGE)

KEXEC = $(SBINDIR)/kexec
KEXEC_MANPAGE = $(MANDIR)/man8/kexec.8

-include $(KEXEC_DEPS)

$(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB)
	@$(MKDIR) -p $(@D)
	$(LINK.o) -o $@ $^ $(LIBS)

$(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include

$(KEXEC_MANPAGE): kexec/kexec.8
	@$(MKDIR) -p     $(MANDIR)/man8
	cp kexec/kexec.8 $(KEXEC_MANPAGE)
echo::
	@echo "KEXEC_SRCS $(KEXEC_SRCS)"
	@echo "KEXEC_DEPS $(KEXEC_DEPS)"
	@echo "KEXEC_OBJS $(KEXEC_OBJS)"