2 # Copyright (C) 2006-2012 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/kexec
16 PKG_HASH:=ffb2e7e99d9d08754c6bc1922aed3c000094f318665d82a72ecc76c4ff1c0dc6
20 PKG_CONFIG_DEPENDS := CONFIG_KEXEC_ZLIB CONFIG_KEXEC_LZMA
22 include $(INCLUDE_DIR)/package.mk
24 define Package/kexec-tools/Default
27 URL:=http://kernel.org/pub/linux/kernel/people/horms/kexec-tools/
28 MAINTAINER:=Florian Fainelli <florian@openwrt.org>
31 define Package/kexec-tools
32 $(call Package/kexec-tools/Default)
33 TITLE:=kexec-tools transition meta package
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.
44 $(call Package/kexec-tools/Default)
45 TITLE:=Kernel boots kernel
47 @armeb||@arm||@i386||@x86_64||@powerpc64||@mipsel||@mips \
48 +KEXEC_ZLIB:zlib +KEXEC_LZMA:liblzma @KERNEL_KEXEC
51 define Package/kexec/description
52 The kexec utility allows to load and boot another kernel.
56 $(call Package/kexec-tools/Default)
57 TITLE:=Kernel crash analysis
58 DEPENDS:=+kexec @i386||@x86_64||@arm @KERNEL_CRASH_DUMP
61 define Package/kdump/description
62 The kdump package allows to automatically boot into a
63 special kernel for analyzing kernel crashes using kdump.
66 define Package/kexec/config
67 source "$(SOURCE)/Config.in"
70 KEXEC_TARGET_NAME:=$(ARCH)-linux-$(TARGET_SUFFIX)
73 --target=$(KEXEC_TARGET_NAME) \
74 --host=$(REAL_GNU_TARGET_NAME) \
75 --build=$(GNU_HOST_NAME) \
82 --libexecdir=/usr/lib \
84 $(if $(CONFIG_KEXEC_ZLIB),--with,--without)-zlib \
85 $(if $(CONFIG_KEXEC_LZMA),--with,--without)-lzma \
86 TARGET_LD="$(TARGET_CROSS)ld"
88 TARGET_CFLAGS += -ffunction-sections -fdata-sections
89 TARGET_LDFLAGS += -Wl,--gc-sections
92 BUILD_CC="$(HOSTCC)" \
93 TARGET_CC="$(TARGET_CC)"
96 $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" all install
99 define Package/kexec-tools/install
103 define Package/kexec/install
104 $(INSTALL_DIR) $(1)/usr/sbin
105 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kexec $(1)/usr/sbin
107 # make a link for compatability with other distros
108 $(INSTALL_DIR) $(1)/sbin
109 $(LN) ../usr/sbin/kexec $(1)/sbin/kexec
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
120 define Package/kdump/prerm
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
134 $(eval $(call BuildPackage,kexec-tools))
135 $(eval $(call BuildPackage,kexec))
136 $(eval $(call BuildPackage,kdump))