Makefile 4.1 KB

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