Makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #
  2. # Copyright (C) 2014-2016 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:=procd
  9. PKG_VERSION:=2016-07-29
  10. PKG_RELEASE=$(PKG_SOURCE_VERSION)
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL=$(OPENWRT_GIT)/project/procd.git
  13. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  14. PKG_SOURCE_VERSION:=2c9f5d4af1559b840c42f1443ede9f9fe809c58b
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  16. CMAKE_INSTALL:=1
  17. PKG_LICENSE:=GPL-2.0
  18. PKG_LICENSE_FILES:=
  19. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  20. PKG_CONFIG_DEPENDS:= \
  21. CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
  22. CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
  23. CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/cmake.mk
  26. ifeq ($(DUMP),)
  27. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
  28. endif
  29. CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
  30. TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
  31. define Package/procd
  32. SECTION:=base
  33. CATEGORY:=Base system
  34. DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
  35. TITLE:=OpenWrt system process manager
  36. endef
  37. define Package/procd-ujail
  38. SECTION:=base
  39. CATEGORY:=Base system
  40. DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libblobmsg-json
  41. TITLE:=OpenWrt process jail helper
  42. endef
  43. define Package/procd-seccomp
  44. SECTION:=base
  45. CATEGORY:=Base system
  46. DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
  47. TITLE:=OpenWrt process seccomp helper + utrace
  48. endef
  49. define Package/procd-nand
  50. SECTION:=utils
  51. CATEGORY:=Utilities
  52. DEPENDS:=@NAND_SUPPORT +ubi-utils
  53. TITLE:=OpenWrt sysupgrade nand helper
  54. endef
  55. define Package/procd-nand-firstboot
  56. SECTION:=utils
  57. CATEGORY:=Utilities
  58. DEPENDS:=procd-nand
  59. TITLE:=OpenWrt firstboot nand helper
  60. endef
  61. define Package/procd/config
  62. menu "Configuration"
  63. depends on PACKAGE_procd
  64. config PROCD_SHOW_BOOT
  65. bool
  66. default n
  67. prompt "Print the shutdown to the console as well as logging it to syslog"
  68. config PROCD_ZRAM_TMPFS
  69. bool
  70. default n
  71. prompt "Mount /tmp using zram."
  72. endmenu
  73. endef
  74. ifeq ($(CONFIG_NAND_SUPPORT),y)
  75. CMAKE_OPTIONS += -DBUILD_UPGRADED=1
  76. endif
  77. ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
  78. CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
  79. endif
  80. ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
  81. CMAKE_OPTIONS += -DZRAM_TMPFS=1
  82. endif
  83. ifdef CONFIG_PACKAGE_procd-ujail
  84. CMAKE_OPTIONS += -DJAIL_SUPPORT=1
  85. endif
  86. ifdef CONFIG_PACKAGE_procd-seccomp
  87. CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1 -DUTRACE_SUPPORT=1
  88. endif
  89. define Package/procd/install
  90. $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
  91. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
  92. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
  93. $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
  94. $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
  95. $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
  96. endef
  97. define Package/procd-ujail/install
  98. $(INSTALL_DIR) $(1)/sbin
  99. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
  100. endef
  101. define Package/procd-seccomp/install
  102. $(INSTALL_DIR) $(1)/sbin $(1)/lib
  103. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
  104. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
  105. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
  106. endef
  107. define Package/procd-nand/install
  108. $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
  109. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
  110. $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
  111. endef
  112. define Package/procd-nand-firstboot/install
  113. $(INSTALL_DIR) $(1)/lib/preinit
  114. $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
  115. endef
  116. $(eval $(call BuildPackage,procd))
  117. $(eval $(call BuildPackage,procd-ujail))
  118. $(eval $(call BuildPackage,procd-seccomp))
  119. $(eval $(call BuildPackage,procd-nand))
  120. $(eval $(call BuildPackage,procd-nand-firstboot))