Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. 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. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  71. TARGET_LDFLAGS += -Wl,--gc-sections
  72. CONFIGURE_VARS += \
  73. BUILD_CC="$(HOSTCC)" \
  74. TARGET_CC="$(TARGET_CC)"
  75. define Build/Compile
  76. $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" all install
  77. endef
  78. define Package/kexec-tools/install
  79. :
  80. endef
  81. define Package/kexec/install
  82. $(INSTALL_DIR) $(1)/usr/sbin
  83. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kexec $(1)/usr/sbin
  84. # make a link for compatability with other distros
  85. $(INSTALL_DIR) $(1)/sbin
  86. $(LN) ../usr/sbin/kexec $(1)/sbin/kexec
  87. endef
  88. define Package/kdump/install
  89. $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults
  90. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/kdump $(PKG_INSTALL_DIR)/usr/sbin/vmcore-dmesg $(1)/usr/sbin
  91. $(INSTALL_BIN) ./files/kdump.init $(1)/etc/init.d/kdump
  92. $(INSTALL_BIN) ./files/kdump.defaults $(1)/etc/uci-defaults/kdump
  93. $(INSTALL_CONF) ./files/kdump.config $(1)/etc/config/kdump
  94. endef
  95. define Package/kdump/prerm
  96. #!/bin/sh
  97. case $$(uname -m) in
  98. i?86|x86_64)
  99. if grep -q " crashkernel=" /boot/grub/grub.cfg; then
  100. mount /boot -o remount,rw
  101. sed -i 's/ crashkernel=[^ ]*//' /boot/grub/grub.cfg
  102. mount /boot -o remount,ro
  103. fi
  104. ;;
  105. esac
  106. endef
  107. $(eval $(call BuildPackage,kexec-tools))
  108. $(eval $(call BuildPackage,kexec))
  109. $(eval $(call BuildPackage,kdump))