1
0

Makefile 3.5 KB

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