summaryrefslogtreecommitdiff
path: root/package/kexec/kexec.mk
blob: c1af4c2d55af742741ab24de1853ad6c3fe1a352 (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
#############################################################
#
# kexec
#
#############################################################
KEXEC_VERSION:=1.101
KEXEC_SOURCE:=kexec-tools_$(KEXEC_VERSION)-kdump10.orig.tar.gz
KEXEC_PATCH:=kexec-tools_$(KEXEC_VERSION)-kdump10-2.diff.gz
KEXEC_SITE:=ftp://ftp.debian.org/debian/pool/main/k/kexec-tools/
KEXEC_DIR:=$(BUILD_DIR)/kexec-tools-$(KEXEC_VERSION)
KEXEC_CAT:=$(ZCAT)
KEXEC_BINARY:=kexec
KEXEC_TARGET_BINARY:=sbin/kexec

KEXEC_CONFIG_OPTS:=
KEXEC_DEPS_y:=

KEXEC_DEPS_$(KEXEC_PACKAGE_KEXEC)	+= zlib

ifeq ($(strip $(BR2_PACKAGE_KEXEC_ZLIB)),y)
KEXEC_CONFIG_OPTS += --with-zlib
else
KEXEC_CONFIG_OPTS += --without-zlib
endif

$(DL_DIR)/$(KEXEC_SOURCE):
	$(WGET) -P $(DL_DIR) $(KEXEC_SITE)/$(KEXEC_SOURCE)

$(DL_DIR)/$(KEXEC_PATCH):
	$(WGET) -P $(DL_DIR) $(KEXEC_SITE)/$(KEXEC_PATCH)

kexec-source: $(DL_DIR)/$(KEXEC_SOURCE) $(DL_DIR)/$(KEXEC_PATCH)

$(KEXEC_DIR)/.unpacked: $(DL_DIR)/$(KEXEC_SOURCE) $(DL_DIR)/$(KEXEC_PATCH)
	$(KEXEC_CAT) $(DL_DIR)/$(KEXEC_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
ifneq ($(KEXEC_PATCH),)
	(cd $(KEXEC_DIR) && $(KEXEC_CAT) $(DL_DIR)/$(KEXEC_PATCH) | patch -p1;	\
	for f in `cat debian/patches/00list`; do	\
		cat debian/patches/$$f | patch -p2; 	\
	done)
endif
	toolchain/patch-kernel.sh $(KEXEC_DIR) package/kexec/ kexec\*.patch
	touch $@

$(KEXEC_DIR)/.configured: $(KEXEC_DIR)/.unpacked
	(cd $(KEXEC_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		./configure \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/ \
		$(KEXEC_CONFIG_OPTS) \
	)
	touch $@

$(KEXEC_DIR)/objdir-$(GNU_TARGET_NAME)/build/sbin/$(KEXEC_BINARY): $(KEXEC_DIR)/.configured
	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(KEXEC_DIR)
	touch -c $@

$(TARGET_DIR)/$(KEXEC_TARGET_BINARY): $(KEXEC_DIR)/objdir-$(GNU_TARGET_NAME)/build/sbin/$(KEXEC_BINARY)
	cp -dpf $(KEXEC_DIR)/objdir-$(GNU_TARGET_NAME)/build/sbin/$(KEXEC_BINARY) \
		$(KEXEC_DIR)/objdir-$(GNU_TARGET_NAME)/build/sbin/kdump \
		$(TARGET_DIR)/sbin/
	$(STRIP) $(STRIP_STRIP_ALL) $(TARGET_DIR)/sbin/k{exec,dump}

kexec: uclibc $(TARGET_DIR)/$(KEXEC_TARGET_BINARY)

kexec-clean:
	-$(MAKE) -C $(KEXEC_DIR) clean
	rm -f $(TARGET_DIR)/sbin/k{exec,dump}

kexec-dirclean:
	rm -rf $(KEXEC_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_KEXEC)),y)
TARGETS+=kexec
endif