Makefile 3.4 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.28
  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:=d2f0ef872f39e2fe4b1b01feb62b0001383207239b9f8041f98a95564161d053
  14. PKG_LICENSE:=GPL-2.0-only
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_CPE_ID:=cpe:/a:kernel:kexec-tools
  17. PKG_CONFIG_DEPENDS := CONFIG_KEXEC_ZLIB CONFIG_KEXEC_LZMA
  18. PKG_BUILD_FLAGS:=gc-sections
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/kexec-tools/Default
  21. SECTION:=utils
  22. CATEGORY:=Utilities
  23. URL:=https://github.com/horms/kexec-tools
  24. endef
  25. define Package/kexec-tools
  26. $(call Package/kexec-tools/Default)
  27. TITLE:=kexec-tools transition meta package
  28. DEPENDS:=+kexec
  29. endef
  30. define Package/kexec-tools/description
  31. kexec is a set of system calls that allows you to load
  32. another kernel from the currently executing Linux kernel.
  33. The kexec utility allows to load and boot another kernel.
  34. endef
  35. define Package/kexec
  36. $(call Package/kexec-tools/Default)
  37. TITLE:=Kernel boots kernel
  38. DEPENDS:=\
  39. @(armeb||arm||i386||x86_64||powerpc64||mipsel||mips) \
  40. +KEXEC_ZLIB:zlib +KEXEC_LZMA:liblzma @KERNEL_KEXEC
  41. endef
  42. define Package/kexec/description
  43. The kexec utility allows to load and boot another kernel.
  44. endef
  45. define Package/kdump
  46. $(call Package/kexec-tools/Default)
  47. TITLE:=Kernel crash analysis
  48. DEPENDS:=+kexec @(i386||x86_64||arm) @KERNEL_CRASH_DUMP
  49. endef
  50. define Package/kdump/description
  51. The kdump package allows to automatically boot into a
  52. special kernel for analyzing kernel crashes using kdump.
  53. endef
  54. define Package/kexec/config
  55. source "$(SOURCE)/Config.in"
  56. endef
  57. KEXEC_TARGET_NAME:=$(ARCH)-linux-$(TARGET_SUFFIX)
  58. CONFIGURE_ARGS = \
  59. --target=$(KEXEC_TARGET_NAME) \
  60. --host=$(REAL_GNU_TARGET_NAME) \
  61. --build=$(GNU_HOST_NAME) \
  62. --program-prefix="" \
  63. --program-suffix="" \
  64. --prefix=/usr \
  65. --exec-prefix=/usr \
  66. --bindir=/usr/bin \
  67. --sbindir=/usr/sbin \
  68. --libexecdir=/usr/lib \
  69. --sysconfdir=/etc \
  70. $(if $(CONFIG_KEXEC_ZLIB),--with,--without)-zlib \
  71. $(if $(CONFIG_KEXEC_LZMA),--with,--without)-lzma \
  72. TARGET_LD="$(TARGET_CROSS)ld"
  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/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))