Makefile 3.4 KB

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