systemd.mk 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. ################################################################################
  2. #
  3. # systemd
  4. #
  5. ################################################################################
  6. SYSTEMD_VERSION = 239
  7. SYSTEMD_SITE = $(call github,systemd,systemd,v$(SYSTEMD_VERSION))
  8. SYSTEMD_LICENSE = LGPL-2.1+, GPL-2.0+ (udev), Public Domain (few source files, see README)
  9. SYSTEMD_LICENSE_FILES = LICENSE.GPL2 LICENSE.LGPL2.1 README
  10. SYSTEMD_INSTALL_STAGING = YES
  11. SYSTEMD_DEPENDENCIES = \
  12. host-gperf \
  13. host-intltool \
  14. kmod \
  15. libcap \
  16. util-linux
  17. SYSTEMD_PROVIDES = udev
  18. SYSTEMD_CONF_OPTS += \
  19. -Drootlibdir='/usr/lib' \
  20. -Dblkid=true \
  21. -Dman=false \
  22. -Dima=false \
  23. -Dlibcryptsetup=false \
  24. -Defi=false \
  25. -Dgnu-efi=false \
  26. -Dldconfig=false \
  27. -Ddefault-dnssec=no \
  28. -Dtests=false \
  29. -Dsplit-bin=true \
  30. -Dsplit-usr=false \
  31. -Dsystem-uid-max=999 \
  32. -Dsystem-gid-max=999 \
  33. -Dtelinit-path=$(TARGET_DIR)/sbin/telinit \
  34. -Dkill-path=/usr/bin/kill \
  35. -Dkmod-path=/usr/bin/kmod \
  36. -Dkexec-path=/usr/sbin/kexec \
  37. -Dsulogin-path=/usr/sbin/sulogin \
  38. -Dmount-path=/usr/bin/mount \
  39. -Dumount-path=/usr/bin/umount \
  40. -Dnobody-group=nogroup \
  41. -Didn=true \
  42. -Dnss-systemd=true
  43. ifeq ($(BR2_PACKAGE_ACL),y)
  44. SYSTEMD_DEPENDENCIES += acl
  45. SYSTEMD_CONF_OPTS += -Dacl=true
  46. else
  47. SYSTEMD_CONF_OPTS += -Dacl=false
  48. endif
  49. ifeq ($(BR2_PACKAGE_AUDIT),y)
  50. SYSTEMD_DEPENDENCIES += audit
  51. SYSTEMD_CONF_OPTS += -Daudit=true
  52. else
  53. SYSTEMD_CONF_OPTS += -Daudit=false
  54. endif
  55. ifeq ($(BR2_PACKAGE_ELFUTILS),y)
  56. SYSTEMD_DEPENDENCIES += elfutils
  57. SYSTEMD_CONF_OPTS += -Delfutils=true
  58. else
  59. SYSTEMD_CONF_OPTS += -Delfutils=false
  60. endif
  61. # Both options can't be selected at the same time so prefer libidn2
  62. ifeq ($(BR2_PACKAGE_LIBIDN2),y)
  63. SYSTEMD_DEPENDENCIES += libidn2
  64. SYSTEMD_CONF_OPTS += -Dlibidn2=true -Dlibidn=false
  65. else ifeq ($(BR2_PACKAGE_LIBIDN),y)
  66. SYSTEMD_DEPENDENCIES += libidn
  67. SYSTEMD_CONF_OPTS += -Dlibidn=true -Dlibidn2=false
  68. else
  69. SYSTEMD_CONF_OPTS += -Dlibidn=false -Dlibidn2=false
  70. endif
  71. ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
  72. SYSTEMD_DEPENDENCIES += libseccomp
  73. SYSTEMD_CONF_OPTS += -Dseccomp=true
  74. else
  75. SYSTEMD_CONF_OPTS += -Dseccomp=false
  76. endif
  77. ifeq ($(BR2_PACKAGE_LIBXKBCOMMON),y)
  78. SYSTEMD_DEPENDENCIES += libxkbcommon
  79. SYSTEMD_CONF_OPTS += -Dxkbcommon=true
  80. else
  81. SYSTEMD_CONF_OPTS += -Dxkbcommon=false
  82. endif
  83. ifeq ($(BR2_PACKAGE_BZIP2),y)
  84. SYSTEMD_DEPENDENCIES += bzip2
  85. SYSTEMD_CONF_OPTS += -Dbzip2=true
  86. else
  87. SYSTEMD_CONF_OPTS += -Dbzip2=false
  88. endif
  89. ifeq ($(BR2_PACKAGE_LZ4),y)
  90. SYSTEMD_DEPENDENCIES += lz4
  91. SYSTEMD_CONF_OPTS += -Dlz4=true
  92. else
  93. SYSTEMD_CONF_OPTS += -Dlz4=false
  94. endif
  95. ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
  96. SYSTEMD_DEPENDENCIES += linux-pam
  97. SYSTEMD_CONF_OPTS += -Dpam=true
  98. else
  99. SYSTEMD_CONF_OPTS += -Dpam=false
  100. endif
  101. ifeq ($(BR2_PACKAGE_XZ),y)
  102. SYSTEMD_DEPENDENCIES += xz
  103. SYSTEMD_CONF_OPTS += -Dxz=true
  104. else
  105. SYSTEMD_CONF_OPTS += -Dxz=false
  106. endif
  107. ifeq ($(BR2_PACKAGE_ZLIB),y)
  108. SYSTEMD_DEPENDENCIES += zlib
  109. SYSTEMD_CONF_OPTS += -Dzlib=true
  110. else
  111. SYSTEMD_CONF_OPTS += -Dzlib=false
  112. endif
  113. ifeq ($(BR2_PACKAGE_LIBCURL),y)
  114. SYSTEMD_DEPENDENCIES += libcurl
  115. SYSTEMD_CONF_OPTS += -Dlibcurl=true
  116. else
  117. SYSTEMD_CONF_OPTS += -Dlibcurl=false
  118. endif
  119. ifeq ($(BR2_PACKAGE_LIBGCRYPT),y)
  120. SYSTEMD_DEPENDENCIES += libgcrypt
  121. SYSTEMD_CONF_OPTS += -Dgcrypt=true
  122. else
  123. SYSTEMD_CONF_OPTS += -Dgcrypt=false
  124. endif
  125. ifeq ($(BR2_PACKAGE_PCRE2),y)
  126. SYSTEMD_DEPENDENCIES += pcre2
  127. SYSTEMD_CONF_OPTS += -Dpcre2=true
  128. else
  129. SYSTEMD_CONF_OPTS += -Dpcre2=false
  130. endif
  131. ifeq ($(BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY),y)
  132. SYSTEMD_DEPENDENCIES += libmicrohttpd
  133. SYSTEMD_CONF_OPTS += -Dmicrohttpd=true
  134. ifeq ($(BR2_PACKAGE_LIBQRENCODE),y)
  135. SYSTEMD_CONF_OPTS += -Dqrencode=true
  136. SYSTEMD_DEPENDENCIES += libqrencode
  137. else
  138. SYSTEMD_CONF_OPTS += -Dqrencode=false
  139. endif
  140. else
  141. SYSTEMD_CONF_OPTS += -Dmicrohttpd=false -Dqrencode=false
  142. endif
  143. ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
  144. SYSTEMD_DEPENDENCIES += libselinux
  145. SYSTEMD_CONF_OPTS += -Dselinux=true
  146. else
  147. SYSTEMD_CONF_OPTS += -Dselinux=false
  148. endif
  149. ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
  150. SYSTEMD_CONF_OPTS += -Dhwdb=true
  151. else
  152. SYSTEMD_CONF_OPTS += -Dhwdb=false
  153. endif
  154. ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
  155. SYSTEMD_CONF_OPTS += -Dbinfmt=true
  156. else
  157. SYSTEMD_CONF_OPTS += -Dbinfmt=false
  158. endif
  159. ifeq ($(BR2_PACKAGE_SYSTEMD_VCONSOLE),y)
  160. SYSTEMD_CONF_OPTS += -Dvconsole=true
  161. else
  162. SYSTEMD_CONF_OPTS += -Dvconsole=false
  163. endif
  164. ifeq ($(BR2_PACKAGE_SYSTEMD_QUOTACHECK),y)
  165. SYSTEMD_CONF_OPTS += -Dquotacheck=true
  166. else
  167. SYSTEMD_CONF_OPTS += -Dquotacheck=false
  168. endif
  169. ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
  170. SYSTEMD_CONF_OPTS += -Dtmpfiles=true
  171. else
  172. SYSTEMD_CONF_OPTS += -Dtmpfiles=false
  173. endif
  174. ifeq ($(BR2_PACKAGE_SYSTEMD_SYSUSERS),y)
  175. SYSTEMD_CONF_OPTS += -Dsysusers=true
  176. else
  177. SYSTEMD_CONF_OPTS += -Dsysusers=false
  178. endif
  179. ifeq ($(BR2_PACKAGE_SYSTEMD_FIRSTBOOT),y)
  180. SYSTEMD_CONF_OPTS += -Dfirstboot=true
  181. else
  182. SYSTEMD_CONF_OPTS += -Dfirstboot=false
  183. endif
  184. ifeq ($(BR2_PACKAGE_SYSTEMD_RANDOMSEED),y)
  185. SYSTEMD_CONF_OPTS += -Drandomseed=true
  186. else
  187. SYSTEMD_CONF_OPTS += -Drandomseed=false
  188. endif
  189. ifeq ($(BR2_PACKAGE_SYSTEMD_BACKLIGHT),y)
  190. SYSTEMD_CONF_OPTS += -Dbacklight=true
  191. else
  192. SYSTEMD_CONF_OPTS += -Dbacklight=false
  193. endif
  194. ifeq ($(BR2_PACKAGE_SYSTEMD_RFKILL),y)
  195. SYSTEMD_CONF_OPTS += -Drfkill=true
  196. else
  197. SYSTEMD_CONF_OPTS += -Drfkill=false
  198. endif
  199. ifeq ($(BR2_PACKAGE_SYSTEMD_LOGIND),y)
  200. SYSTEMD_CONF_OPTS += -Dlogind=true
  201. else
  202. SYSTEMD_CONF_OPTS += -Dlogind=false
  203. endif
  204. ifeq ($(BR2_PACKAGE_SYSTEMD_MACHINED),y)
  205. SYSTEMD_CONF_OPTS += -Dmachined=true
  206. else
  207. SYSTEMD_CONF_OPTS += -Dmachined=false
  208. endif
  209. ifeq ($(BR2_PACKAGE_SYSTEMD_IMPORTD),y)
  210. SYSTEMD_CONF_OPTS += -Dimportd=true
  211. else
  212. SYSTEMD_CONF_OPTS += -Dimportd=false
  213. endif
  214. ifeq ($(BR2_PACKAGE_SYSTEMD_HOSTNAMED),y)
  215. SYSTEMD_CONF_OPTS += -Dhostnamed=true
  216. else
  217. SYSTEMD_CONF_OPTS += -Dhostnamed=false
  218. endif
  219. ifeq ($(BR2_PACKAGE_SYSTEMD_MYHOSTNAME),y)
  220. SYSTEMD_CONF_OPTS += -Dmyhostname=true
  221. else
  222. SYSTEMD_CONF_OPTS += -Dmyhostname=false
  223. endif
  224. ifeq ($(BR2_PACKAGE_SYSTEMD_TIMEDATED),y)
  225. SYSTEMD_CONF_OPTS += -Dtimedated=true
  226. else
  227. SYSTEMD_CONF_OPTS += -Dtimedated=false
  228. endif
  229. ifeq ($(BR2_PACKAGE_SYSTEMD_LOCALED),y)
  230. SYSTEMD_CONF_OPTS += -Dlocaled=true
  231. else
  232. SYSTEMD_CONF_OPTS += -Dlocaled=false
  233. endif
  234. ifeq ($(BR2_PACKAGE_SYSTEMD_COREDUMP),y)
  235. SYSTEMD_CONF_OPTS += -Dcoredump=true
  236. SYSTEMD_COREDUMP_USER = systemd-coredump -1 systemd-coredump -1 * /var/lib/systemd/coredump - - Core Dumper
  237. else
  238. SYSTEMD_CONF_OPTS += -Dcoredump=false
  239. endif
  240. ifeq ($(BR2_PACKAGE_SYSTEMD_POLKIT),y)
  241. SYSTEMD_CONF_OPTS += -Dpolkit=true
  242. SYSTEMD_DEPENDENCIES += polkit
  243. else
  244. SYSTEMD_CONF_OPTS += -Dpolkit=false
  245. endif
  246. ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),y)
  247. SYSTEMD_CONF_OPTS += -Dnetworkd=true
  248. SYSTEMD_NETWORKD_USER = systemd-network -1 systemd-network -1 * - - - Network Manager
  249. define SYSTEMD_INSTALL_RESOLVCONF_HOOK
  250. ln -sf ../run/systemd/resolve/resolv.conf \
  251. $(TARGET_DIR)/etc/resolv.conf
  252. endef
  253. SYSTEMD_NETWORKD_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
  254. ifneq ($(SYSTEMD_NETWORKD_DHCP_IFACE),)
  255. define SYSTEMD_INSTALL_NETWORK_CONFS
  256. sed s/SYSTEMD_NETWORKD_DHCP_IFACE/$(SYSTEMD_NETWORKD_DHCP_IFACE)/ \
  257. package/systemd/dhcp.network > \
  258. $(TARGET_DIR)/etc/systemd/network/dhcp.network
  259. endef
  260. endif
  261. else
  262. SYSTEMD_CONF_OPTS += -Dnetworkd=false
  263. endif
  264. ifeq ($(BR2_PACKAGE_SYSTEMD_RESOLVED),y)
  265. SYSTEMD_CONF_OPTS += -Dresolve=true
  266. SYSTEMD_RESOLVED_USER = systemd-resolve -1 systemd-resolve -1 * - - - Network Name Resolution Manager
  267. else
  268. SYSTEMD_CONF_OPTS += -Dresolve=false
  269. endif
  270. ifeq ($(BR2_PACKAGE_SYSTEMD_TIMESYNCD),y)
  271. SYSTEMD_CONF_OPTS += -Dtimesyncd=true
  272. SYSTEMD_TIMESYNCD_USER = systemd-timesync -1 systemd-timesync -1 * - - - Network Time Synchronization
  273. define SYSTEMD_INSTALL_SERVICE_TIMESYNC
  274. mkdir -p $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants
  275. ln -sf ../../../../lib/systemd/system/systemd-timesyncd.service \
  276. $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service
  277. endef
  278. else
  279. SYSTEMD_CONF_OPTS += -Dtimesyncd=false
  280. endif
  281. ifeq ($(BR2_PACKAGE_SYSTEMD_SMACK_SUPPORT),y)
  282. SYSTEMD_CONF_OPTS += -Dsmack=true
  283. else
  284. SYSTEMD_CONF_OPTS += -Dsmack=false
  285. endif
  286. ifeq ($(BR2_PACKAGE_SYSTEMD_HIBERNATE),y)
  287. SYSTEMD_CONF_OPTS += -Dhibernate=true
  288. else
  289. SYSTEMD_CONF_OPTS += -Dhibernate=false
  290. endif
  291. SYSTEMD_FALLBACK_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
  292. ifneq ($(SYSTEMD_FALLBACK_HOSTNAME),)
  293. SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
  294. endif
  295. define SYSTEMD_INSTALL_INIT_HOOK
  296. ln -fs ../lib/systemd/systemd $(TARGET_DIR)/sbin/init
  297. ln -fs ../bin/systemctl $(TARGET_DIR)/sbin/halt
  298. ln -fs ../bin/systemctl $(TARGET_DIR)/sbin/poweroff
  299. ln -fs ../bin/systemctl $(TARGET_DIR)/sbin/reboot
  300. ln -fs ../bin/systemctl $(TARGET_DIR)/sbin/shutdown
  301. ln -fs ../../../lib/systemd/system/multi-user.target \
  302. $(TARGET_DIR)/etc/systemd/system/default.target
  303. endef
  304. define SYSTEMD_INSTALL_MACHINEID_HOOK
  305. touch $(TARGET_DIR)/etc/machine-id
  306. endef
  307. SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
  308. SYSTEMD_INSTALL_INIT_HOOK \
  309. SYSTEMD_INSTALL_MACHINEID_HOOK \
  310. SYSTEMD_INSTALL_RESOLVCONF_HOOK
  311. define SYSTEMD_USERS
  312. - - input -1 * - - - Input device group
  313. - - systemd-journal -1 * - - - Journal
  314. - - render -1 * - - - DRI rendering nodes
  315. - - kvm -1 * - - - kvm nodes
  316. systemd-bus-proxy -1 systemd-bus-proxy -1 * - - - Proxy D-Bus messages to/from a bus
  317. systemd-journal-gateway -1 systemd-journal-gateway -1 * /var/log/journal - - Journal Gateway
  318. systemd-journal-remote -1 systemd-journal-remote -1 * /var/log/journal/remote - - Journal Remote
  319. systemd-journal-upload -1 systemd-journal-upload -1 * - - - Journal Upload
  320. $(SYSTEMD_COREDUMP_USER)
  321. $(SYSTEMD_NETWORKD_USER)
  322. $(SYSTEMD_RESOLVED_USER)
  323. $(SYSTEMD_TIMESYNCD_USER)
  324. endef
  325. define SYSTEMD_DISABLE_SERVICE_TTY1
  326. rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty@tty1.service
  327. endef
  328. ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
  329. # systemd needs getty.service for VTs and serial-getty.service for serial ttys
  330. # also patch the file to use the correct baud-rate, the default baudrate is 115200 so look for that
  331. define SYSTEMD_INSTALL_SERVICE_TTY
  332. if echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
  333. then \
  334. SERVICE="getty"; \
  335. else \
  336. SERVICE="serial-getty"; \
  337. fi; \
  338. ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
  339. $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
  340. if [ $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -gt 0 ] ; \
  341. then \
  342. $(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${SERVICE}@.service; \
  343. fi
  344. endef
  345. endif
  346. define SYSTEMD_INSTALL_INIT_SYSTEMD
  347. $(SYSTEMD_DISABLE_SERVICE_TTY1)
  348. $(SYSTEMD_INSTALL_SERVICE_TTY)
  349. $(SYSTEMD_INSTALL_SERVICE_TIMESYNC)
  350. $(SYSTEMD_INSTALL_NETWORK_CONFS)
  351. endef
  352. SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
  353. SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
  354. $(eval $(meson-package))