2 # Copyright (C) 2014-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
11 PKG_VERSION:=2016-07-29
13 PKG_RELEASE=$(PKG_SOURCE_VERSION)
16 PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=2c9f5d4af1559b840c42f1443ede9f9fe809c58b
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
25 PKG_MAINTAINER:=John Crispin <john@phrozen.org>
29 PKG_CONFIG_DEPENDS:= \
30 CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
31 CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
32 CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
34 include $(INCLUDE_DIR)/package.mk
35 include $(INCLUDE_DIR)/cmake.mk
38 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
41 CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
42 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
47 DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
48 TITLE:=OpenWrt system process manager
51 define Package/procd-ujail
54 DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libblobmsg-json
55 TITLE:=OpenWrt process jail helper
58 define Package/procd-seccomp
61 DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
62 TITLE:=OpenWrt process seccomp helper + utrace
65 define Package/procd-nand
68 DEPENDS:=@NAND_SUPPORT +ubi-utils
69 TITLE:=OpenWrt sysupgrade nand helper
72 define Package/procd-nand-firstboot
76 TITLE:=OpenWrt firstboot nand helper
79 define Package/procd/config
81 depends on PACKAGE_procd
83 config PROCD_SHOW_BOOT
86 prompt "Print the shutdown to the console as well as logging it to syslog"
88 config PROCD_ZRAM_TMPFS
91 prompt "Mount /tmp using zram."
96 ifeq ($(CONFIG_NAND_SUPPORT),y)
97 CMAKE_OPTIONS += -DBUILD_UPGRADED=1
100 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
101 CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
104 ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
105 CMAKE_OPTIONS += -DZRAM_TMPFS=1
108 ifdef CONFIG_PACKAGE_procd-ujail
109 CMAKE_OPTIONS += -DJAIL_SUPPORT=1
112 ifdef CONFIG_PACKAGE_procd-seccomp
113 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1 -DUTRACE_SUPPORT=1
116 define Package/procd/install
117 $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
119 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
120 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
121 $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
122 $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
123 $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
126 define Package/procd-ujail/install
127 $(INSTALL_DIR) $(1)/sbin
128 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
131 define Package/procd-seccomp/install
132 $(INSTALL_DIR) $(1)/sbin $(1)/lib
133 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
134 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
135 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
138 define Package/procd-nand/install
139 $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
141 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
142 $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
145 define Package/procd-nand-firstboot/install
146 $(INSTALL_DIR) $(1)/lib/preinit
148 $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
151 $(eval $(call BuildPackage,procd))
152 $(eval $(call BuildPackage,procd-ujail))
153 $(eval $(call BuildPackage,procd-seccomp))
154 $(eval $(call BuildPackage,procd-nand))
155 $(eval $(call BuildPackage,procd-nand-firstboot))