Makefile 3.4 KB

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