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:=5b103351ad752c9badd1d65b00eb6de4bce579f944f4df4e3ef3a755ba567010
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/
30 define Package/kexec-tools
31 $(call Package/kexec-tools/Default)
32 TITLE:=kexec-tools transition meta package
36 define Package/kexec-tools/description
37 kexec is a set of system calls that allows you to load
38 another kernel from the currently executing Linux kernel.
39 The kexec utility allows to load and boot another kernel.
43 $(call Package/kexec-tools/Default)
44 TITLE:=Kernel boots kernel
46 @(armeb||arm||i386||x86_64||powerpc64||mipsel||mips) \
47 +KEXEC_ZLIB:zlib +KEXEC_LZMA:liblzma @KERNEL_KEXEC
50 define Package/kexec/description
51 The kexec utility allows to load and boot another kernel.
55 $(call Package/kexec-tools/Default)
56 TITLE:=Kernel crash analysis
57 DEPENDS:=+kexec @(i386||x86_64||arm) @KERNEL_CRASH_DUMP
60 define Package/kdump/description
61 The kdump package allows to automatically boot into a
62 special kernel for analyzing kernel crashes using kdump.
65 define Package/kexec/config
66 source "$(SOURCE)/Config.in"
69 KEXEC_TARGET_NAME:=$(ARCH)-linux-$(TARGET_SUFFIX)
72 --target=$(KEXEC_TARGET_NAME) \
73 --host=$(REAL_GNU_TARGET_NAME) \
74 --build=$(GNU_HOST_NAME) \
81 --libexecdir=/usr/lib \
83 $(if $(CONFIG_KEXEC_ZLIB),--with,--without)-zlib \
84 $(if $(CONFIG_KEXEC_LZMA),--with,--without)-lzma \
85 TARGET_LD="$(TARGET_CROSS)ld"
87 TARGET_CFLAGS += -ffunction-sections -fdata-sections
88 TARGET_LDFLAGS += -Wl,--gc-sections
91 BUILD_CC="$(HOSTCC)" \
92 TARGET_CC="$(TARGET_CC)"
95 $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" all install
98 define Package/kexec-tools/install
102 define Package/kexec/install
103 $(INSTALL_DIR) $(1)/usr/sbin
104 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kexec $(1)/usr/sbin
106 # make a link for compatability with other distros
107 $(INSTALL_DIR) $(1)/sbin
108 $(LN) ../usr/sbin/kexec $(1)/sbin/kexec
111 define Package/kdump/install
112 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults
113 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kdump $(PKG_INSTALL_DIR)/usr/sbin/vmcore-dmesg $(1)/usr/sbin
114 $(INSTALL_BIN) ./files/kdump.init $(1)/etc/init.d/kdump
115 $(INSTALL_BIN) ./files/kdump.defaults $(1)/etc/uci-defaults/kdump
116 $(INSTALL_CONF) ./files/kdump.config $(1)/etc/config/kdump
119 define Package/kdump/prerm
124 if grep -q " crashkernel=" /boot/grub/grub.cfg; then
125 mount /boot -o remount,rw
126 sed -i 's/ crashkernel=[^ ]*//' /boot/grub/grub.cfg
127 mount /boot -o remount,ro
133 $(eval $(call BuildPackage,kexec-tools))
134 $(eval $(call BuildPackage,kexec))
135 $(eval $(call BuildPackage,kdump))