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-03-09
13 PKG_RELEASE=$(PKG_SOURCE_VERSION)
16 PKG_SOURCE_URL=$(OPENWRT_GIT)/project/procd.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=b12bb150ed38a4409bef5127c77b060ee616b860
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
25 PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
27 PKG_CONFIG_DEPENDS:= \
28 CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
29 CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
30 CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
32 include $(INCLUDE_DIR)/package.mk
33 include $(INCLUDE_DIR)/cmake.mk
36 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
39 CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
40 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
45 DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
46 TITLE:=OpenWrt system process manager
49 define Package/procd-ujail
52 DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libblobmsg-json
53 TITLE:=OpenWrt process jail helper
56 define Package/procd-seccomp
59 DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
60 TITLE:=OpenWrt process seccomp helper + utrace
63 define Package/procd-nand
66 DEPENDS:=@NAND_SUPPORT +ubi-utils
67 TITLE:=OpenWrt sysupgrade nand helper
70 define Package/procd-nand-firstboot
74 TITLE:=OpenWrt firstboot nand helper
77 define Package/procd/config
79 depends on PACKAGE_procd
81 config PROCD_SHOW_BOOT
84 prompt "Print the shutdown to the console as well as logging it to syslog"
86 config PROCD_ZRAM_TMPFS
89 prompt "Mount /tmp using zram."
94 ifeq ($(CONFIG_NAND_SUPPORT),y)
95 CMAKE_OPTIONS += -DBUILD_UPGRADED=1
98 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
99 CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
102 ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
103 CMAKE_OPTIONS += -DZRAM_TMPFS=1
106 ifdef CONFIG_PACKAGE_procd-ujail
107 CMAKE_OPTIONS += -DJAIL_SUPPORT=1
110 ifdef CONFIG_PACKAGE_procd-seccomp
111 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1 -DUTRACE_SUPPORT=1
114 define Package/procd/install
115 $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
117 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
118 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
119 $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
120 $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
121 $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
124 define Package/procd-ujail/install
125 $(INSTALL_DIR) $(1)/sbin
126 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
129 define Package/procd-seccomp/install
130 $(INSTALL_DIR) $(1)/sbin $(1)/lib
131 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
132 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
133 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
136 define Package/procd-nand/install
137 $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
139 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
140 $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
143 define Package/procd-nand-firstboot/install
144 $(INSTALL_DIR) $(1)/lib/preinit
146 $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
149 $(eval $(call BuildPackage,procd))
150 $(eval $(call BuildPackage,procd-ujail))
151 $(eval $(call BuildPackage,procd-seccomp))
152 $(eval $(call BuildPackage,procd-nand))
153 $(eval $(call BuildPackage,procd-nand-firstboot))