kexec-tools: bump version to 2.0.16
[openwrt/openwrt.git] / package / boot / kexec-tools / Makefile
1 #
2 # Copyright (C) 2006-2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=kexec-tools
11 PKG_VERSION:=2.0.16
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/kexec
16 PKG_HASH:=5b103351ad752c9badd1d65b00eb6de4bce579f944f4df4e3ef3a755ba567010
17
18 PKG_FIXUP:=autoreconf
19
20 PKG_CONFIG_DEPENDS := CONFIG_KEXEC_ZLIB CONFIG_KEXEC_LZMA
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/kexec-tools/Default
25 SECTION:=utils
26 CATEGORY:=Utilities
27 URL:=http://kernel.org/pub/linux/kernel/people/horms/kexec-tools/
28 MAINTAINER:=Florian Fainelli <florian@openwrt.org>
29 endef
30
31 define Package/kexec-tools
32 $(call Package/kexec-tools/Default)
33 TITLE:=kexec-tools transition meta package
34 DEPENDS:=+kexec
35 endef
36
37 define Package/kexec-tools/description
38 kexec is a set of system calls that allows you to load
39 another kernel from the currently executing Linux kernel.
40 The kexec utility allows to load and boot another kernel.
41 endef
42
43 define Package/kexec
44 $(call Package/kexec-tools/Default)
45 TITLE:=Kernel boots kernel
46 DEPENDS:=\
47 @armeb||@arm||@i386||@x86_64||@powerpc64||@mipsel||@mips \
48 +KEXEC_ZLIB:zlib +KEXEC_LZMA:liblzma @KERNEL_KEXEC
49 endef
50
51 define Package/kexec/description
52 The kexec utility allows to load and boot another kernel.
53 endef
54
55 define Package/kdump
56 $(call Package/kexec-tools/Default)
57 TITLE:=Kernel crash analysis
58 DEPENDS:=+kexec @i386||@x86_64||@arm @KERNEL_CRASH_DUMP
59 endef
60
61 define Package/kdump/description
62 The kdump package allows to automatically boot into a
63 special kernel for analyzing kernel crashes using kdump.
64 endef
65
66 define Package/kexec/config
67 source "$(SOURCE)/Config.in"
68 endef
69
70 KEXEC_TARGET_NAME:=$(ARCH)-linux-$(TARGET_SUFFIX)
71
72 CONFIGURE_ARGS = \
73 --target=$(KEXEC_TARGET_NAME) \
74 --host=$(REAL_GNU_TARGET_NAME) \
75 --build=$(GNU_HOST_NAME) \
76 --program-prefix="" \
77 --program-suffix="" \
78 --prefix=/usr \
79 --exec-prefix=/usr \
80 --bindir=/usr/bin \
81 --sbindir=/usr/sbin \
82 --libexecdir=/usr/lib \
83 --sysconfdir=/etc \
84 $(if $(CONFIG_KEXEC_ZLIB),--with,--without)-zlib \
85 $(if $(CONFIG_KEXEC_LZMA),--with,--without)-lzma \
86 TARGET_LD="$(TARGET_CROSS)ld"
87
88 TARGET_CFLAGS += -ffunction-sections -fdata-sections
89 TARGET_LDFLAGS += -Wl,--gc-sections
90
91 CONFIGURE_VARS += \
92 BUILD_CC="$(HOSTCC)" \
93 TARGET_CC="$(TARGET_CC)"
94
95 define Build/Compile
96 $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" all install
97 endef
98
99 define Package/kexec-tools/install
100 :
101 endef
102
103 define Package/kexec/install
104 $(INSTALL_DIR) $(1)/usr/sbin
105 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kexec $(1)/usr/sbin
106
107 # make a link for compatability with other distros
108 $(INSTALL_DIR) $(1)/sbin
109 $(LN) ../usr/sbin/kexec $(1)/sbin/kexec
110 endef
111
112 define Package/kdump/install
113 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults
114 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kdump $(PKG_INSTALL_DIR)/usr/sbin/vmcore-dmesg $(1)/usr/sbin
115 $(INSTALL_BIN) ./files/kdump.init $(1)/etc/init.d/kdump
116 $(INSTALL_BIN) ./files/kdump.defaults $(1)/etc/uci-defaults/kdump
117 $(INSTALL_CONF) ./files/kdump.config $(1)/etc/config/kdump
118 endef
119
120 define Package/kdump/prerm
121 #!/bin/sh
122
123 case $$(uname -m) in
124 i?86|x86_64)
125 if grep -q " crashkernel=" /boot/grub/grub.cfg; then
126 mount /boot -o remount,rw
127 sed -i 's/ crashkernel=[^ ]*//' /boot/grub/grub.cfg
128 mount /boot -o remount,ro
129 fi
130 ;;
131 esac
132 endef
133
134 $(eval $(call BuildPackage,kexec-tools))
135 $(eval $(call BuildPackage,kexec))
136 $(eval $(call BuildPackage,kdump))