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-12-13
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:=f800ecf860addd4fc7f1acde76a9adbd4b1f50e7
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
20 PKG_MIRROR_MD5SUM:=0e47fd3bf141e8f12866d9ec79cb42c971b3f6691eb87ce1ef71dc7473ab5ee4
26 PKG_MAINTAINER:=John Crispin <john@phrozen.org>
30 PKG_CONFIG_DEPENDS:= \
31 CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
32 CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
33 CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
35 include $(INCLUDE_DIR)/package.mk
36 include $(INCLUDE_DIR)/cmake.mk
39 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
42 CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
43 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
48 DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
49 TITLE:=OpenWrt system process manager
52 define Package/procd-ujail
55 DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS +libubox +libblobmsg-json
56 TITLE:=OpenWrt process jail helper
59 define Package/procd-seccomp
62 DEPENDS:=@arm||@armeb||@mips||@mipsel||@i386||@x86_64 @!TARGET_uml @KERNEL_SECCOMP +libubox +libblobmsg-json
63 TITLE:=OpenWrt process seccomp helper + utrace
66 define Package/procd-nand
69 DEPENDS:=@NAND_SUPPORT +ubi-utils
70 TITLE:=OpenWrt sysupgrade nand helper
73 define Package/procd-nand-firstboot
77 TITLE:=OpenWrt firstboot nand helper
80 define Package/procd/config
82 depends on PACKAGE_procd
84 config PROCD_SHOW_BOOT
87 prompt "Print the shutdown to the console as well as logging it to syslog"
89 config PROCD_ZRAM_TMPFS
92 prompt "Mount /tmp using zram."
97 ifeq ($(CONFIG_NAND_SUPPORT),y)
98 CMAKE_OPTIONS += -DBUILD_UPGRADED=1
101 ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
102 CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
105 ifeq ($(CONFIG_PROCD_ZRAM_TMPFS),y)
106 CMAKE_OPTIONS += -DZRAM_TMPFS=1
109 ifdef CONFIG_PACKAGE_procd-ujail
110 CMAKE_OPTIONS += -DJAIL_SUPPORT=1
113 ifdef CONFIG_PACKAGE_procd-seccomp
114 CMAKE_OPTIONS += -DSECCOMP_SUPPORT=1 -DUTRACE_SUPPORT=1
117 define Package/procd/install
118 $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
120 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
121 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
122 $(INSTALL_BIN) ./files/reload_config $(1)/sbin/
123 $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
124 $(INSTALL_DATA) ./files/procd.sh $(1)/lib/functions/
127 define Package/procd-ujail/install
128 $(INSTALL_DIR) $(1)/sbin
129 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ujail $(1)/sbin/
132 define Package/procd-seccomp/install
133 $(INSTALL_DIR) $(1)/sbin $(1)/lib
134 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
135 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
136 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
139 define Package/procd-nand/install
140 $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
142 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
143 $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
146 define Package/procd-nand-firstboot/install
147 $(INSTALL_DIR) $(1)/lib/preinit
149 $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
152 $(eval $(call BuildPackage,procd))
153 $(eval $(call BuildPackage,procd-ujail))
154 $(eval $(call BuildPackage,procd-seccomp))
155 $(eval $(call BuildPackage,procd-nand))
156 $(eval $(call BuildPackage,procd-nand-firstboot))