summaryrefslogtreecommitdiffstats
path: root/kexec/Makefile
blob: 11682bfa78986152f14332c1d780a7466642c4b3 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
# 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_SRCS_base)
KEXEC_GENERATED_SRCS =

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

KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)

dist += kexec/Makefile						\
	$(KEXEC_SRCS_base) 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-zlib.h kexec/kexec-lzma.h			\
	kexec/kexec-xen.h 					\
	kexec/kexec-syscall.h kexec/kexec.h kexec/kexec.8

dist				+= kexec/proc_iomem.c
$(ARCH)_PROC_IOMEM		=  kexec/proc_iomem.c
KEXEC_SRCS			+= $($(ARCH)_PROC_IOMEM)

dist				+= kexec/virt_to_phys.c
$(ARCH)_VIRT_TO_PHYS		=  kexec/virt_to_phys.c
KEXEC_SRCS			+= $($(ARCH)_VIRT_TO_PHYS)

dist				+= kexec/phys_to_virt.c
$(ARCH)_PHYS_TO_VIRT		=  kexec/phys_to_virt.c
KEXEC_SRCS			+= $($(ARCH)_PHYS_TO_VIRT)

dist				+= kexec/add_segment.c
$(ARCH)_ADD_SEGMENT		=  kexec/add_segment.c
KEXEC_SRCS			+= $($(ARCH)_ADD_SEGMENT)

dist				+= kexec/add_buffer.c
$(ARCH)_ADD_BUFFER		=  kexec/add_buffer.c
KEXEC_SRCS			+= $($(ARCH)_ADD_BUFFER)

dist				+=  kexec/arch_reuse_initrd.c
$(ARCH)_ARCH_REUSE_INITRD	=  kexec/arch_reuse_initrd.c
KEXEC_SRCS			+= $($(ARCH)_ARCH_REUSE_INITRD)

dist				+= kexec/kexec-uImage.c
$(ARCH)_UIMAGE			=
KEXEC_SRCS			+= $($(ARCH)_UIMAGE)

dist				+= kexec/fs2dt.c kexec/fs2dt.h
$(ARCH)_FS2DT			=
KEXEC_SRCS			+= $($(ARCH)_FS2DT)

dist				+= kexec/mem_regions.c kexec/mem_regions.h
$(ARCH)_MEM_REGIONS		=
KEXEC_SRCS			+= $($(ARCH)_MEM_REGIONS)

dist				+= kexec/dt-ops.c kexec/dt-ops.h
$(ARCH)_DT_OPS		=
KEXEC_SRCS			+= $($(ARCH)_DT_OPS)

include $(srcdir)/kexec/arch/alpha/Makefile
include $(srcdir)/kexec/arch/arm/Makefile
include $(srcdir)/kexec/arch/arm64/Makefile
include $(srcdir)/kexec/arch/i386/Makefile
include $(srcdir)/kexec/arch/ia64/Makefile
include $(srcdir)/kexec/arch/m68k/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
include $(srcdir)/kexec/arch/hppa/Makefile
include $(srcdir)/kexec/arch/loongarch/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 $@ $^ $(CFLAGS) $(LIBS)

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

kexec/fs2dt.o: CPPFLAGS+=$($(ARCH)_FS2DT_INCLUDE)

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