systemd.mk 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. ################################################################################
  2. #
  3. # systemd
  4. #
  5. ################################################################################
  6. SYSTEMD_VERSION = 246.5
  7. SYSTEMD_SITE = $(call github,systemd,systemd-stable,v$(SYSTEMD_VERSION))
  8. SYSTEMD_LICENSE = LGPL-2.1+, GPL-2.0+ (udev), Public Domain (few source files, see README), BSD-3-Clause (tools/chromiumos)
  9. SYSTEMD_LICENSE_FILES = LICENSE.GPL2 LICENSE.LGPL2.1 README tools/chromiumos/LICENSE
  10. SYSTEMD_INSTALL_STAGING = YES
  11. SYSTEMD_DEPENDENCIES = \
  12. $(BR2_COREUTILS_HOST_DEPENDENCY) \
  13. $(if $(BR2_PACKAGE_BASH_COMPLETION),bash-completion) \
  14. host-gperf \
  15. kmod \
  16. libcap \
  17. util-linux-libs \
  18. $(TARGET_NLS_DEPENDENCIES)
  19. SYSTEMD_SELINUX_MODULES = systemd udev
  20. SYSTEMD_PROVIDES = udev
  21. SYSTEMD_CONF_OPTS += \
  22. -Ddefault-hierarchy=hybrid \
  23. -Didn=true \
  24. -Dima=false \
  25. -Dkexec-path=/usr/sbin/kexec \
  26. -Dkmod-path=/usr/bin/kmod \
  27. -Dldconfig=false \
  28. -Dloadkeys-path=/usr/bin/loadkeys \
  29. -Dman=false \
  30. -Dmount-path=/usr/bin/mount \
  31. -Dnss-systemd=true \
  32. -Dquotacheck-path=/usr/sbin/quotacheck \
  33. -Dquotaon-path=/usr/sbin/quotaon \
  34. -Drootlibdir='/usr/lib' \
  35. -Dsetfont-path=/usr/bin/setfont \
  36. -Dsplit-bin=true \
  37. -Dsplit-usr=false \
  38. -Dsulogin-path=/usr/sbin/sulogin \
  39. -Dsystem-gid-max=999 \
  40. -Dsystem-uid-max=999 \
  41. -Dsysvinit-path= \
  42. -Dsysvrcnd-path= \
  43. -Dtelinit-path= \
  44. -Dtests=false \
  45. -Dumount-path=/usr/bin/umount \
  46. -Dutmp=false
  47. ifeq ($(BR2_PACKAGE_ACL),y)
  48. SYSTEMD_DEPENDENCIES += acl
  49. SYSTEMD_CONF_OPTS += -Dacl=true
  50. else
  51. SYSTEMD_CONF_OPTS += -Dacl=false
  52. endif
  53. ifeq ($(BR2_PACKAGE_LIBAPPARMOR),y)
  54. SYSTEMD_DEPENDENCIES += libapparmor
  55. SYSTEMD_CONF_OPTS += -Dapparmor=true
  56. else
  57. SYSTEMD_CONF_OPTS += -Dapparmor=false
  58. endif
  59. ifeq ($(BR2_PACKAGE_AUDIT),y)
  60. SYSTEMD_DEPENDENCIES += audit
  61. SYSTEMD_CONF_OPTS += -Daudit=true
  62. else
  63. SYSTEMD_CONF_OPTS += -Daudit=false
  64. endif
  65. ifeq ($(BR2_PACKAGE_CRYPTSETUP),y)
  66. SYSTEMD_DEPENDENCIES += cryptsetup
  67. SYSTEMD_CONF_OPTS += -Dlibcryptsetup=true
  68. else
  69. SYSTEMD_CONF_OPTS += -Dlibcryptsetup=false
  70. endif
  71. ifeq ($(BR2_PACKAGE_ELFUTILS),y)
  72. SYSTEMD_DEPENDENCIES += elfutils
  73. SYSTEMD_CONF_OPTS += -Delfutils=true
  74. else
  75. SYSTEMD_CONF_OPTS += -Delfutils=false
  76. endif
  77. ifeq ($(BR2_PACKAGE_GNUTLS),y)
  78. SYSTEMD_DEPENDENCIES += gnutls
  79. SYSTEMD_CONF_OPTS += -Dgnutls=true
  80. else
  81. SYSTEMD_CONF_OPTS += -Dgnutls=false
  82. endif
  83. ifeq ($(BR2_PACKAGE_IPTABLES),y)
  84. SYSTEMD_DEPENDENCIES += iptables
  85. SYSTEMD_CONF_OPTS += -Dlibiptc=true
  86. else
  87. SYSTEMD_CONF_OPTS += -Dlibiptc=false
  88. endif
  89. # Both options can't be selected at the same time so prefer libidn2
  90. ifeq ($(BR2_PACKAGE_LIBIDN2),y)
  91. SYSTEMD_DEPENDENCIES += libidn2
  92. SYSTEMD_CONF_OPTS += -Dlibidn2=true -Dlibidn=false
  93. else ifeq ($(BR2_PACKAGE_LIBIDN),y)
  94. SYSTEMD_DEPENDENCIES += libidn
  95. SYSTEMD_CONF_OPTS += -Dlibidn=true -Dlibidn2=false
  96. else
  97. SYSTEMD_CONF_OPTS += -Dlibidn=false -Dlibidn2=false
  98. endif
  99. ifeq ($(BR2_PACKAGE_LIBSECCOMP),y)
  100. SYSTEMD_DEPENDENCIES += libseccomp
  101. SYSTEMD_CONF_OPTS += -Dseccomp=true
  102. else
  103. SYSTEMD_CONF_OPTS += -Dseccomp=false
  104. endif
  105. ifeq ($(BR2_PACKAGE_LIBXKBCOMMON),y)
  106. SYSTEMD_DEPENDENCIES += libxkbcommon
  107. SYSTEMD_CONF_OPTS += -Dxkbcommon=true
  108. else
  109. SYSTEMD_CONF_OPTS += -Dxkbcommon=false
  110. endif
  111. ifeq ($(BR2_PACKAGE_BZIP2),y)
  112. SYSTEMD_DEPENDENCIES += bzip2
  113. SYSTEMD_CONF_OPTS += -Dbzip2=true
  114. else
  115. SYSTEMD_CONF_OPTS += -Dbzip2=false
  116. endif
  117. ifeq ($(BR2_PACKAGE_ZSTD),y)
  118. SYSTEMD_DEPENDENCIES += zstd
  119. SYSTEMD_CONF_OPTS += -Dzstd=true
  120. else
  121. SYSTEMD_CONF_OPTS += -Dzstd=false
  122. endif
  123. ifeq ($(BR2_PACKAGE_LZ4),y)
  124. SYSTEMD_DEPENDENCIES += lz4
  125. SYSTEMD_CONF_OPTS += -Dlz4=true
  126. else
  127. SYSTEMD_CONF_OPTS += -Dlz4=false
  128. endif
  129. ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
  130. SYSTEMD_DEPENDENCIES += linux-pam
  131. SYSTEMD_CONF_OPTS += -Dpam=true
  132. else
  133. SYSTEMD_CONF_OPTS += -Dpam=false
  134. endif
  135. ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBFDISK),y)
  136. SYSTEMD_CONF_OPTS += -Dfdisk=true
  137. else
  138. SYSTEMD_CONF_OPTS += -Dfdisk=false
  139. endif
  140. ifeq ($(BR2_PACKAGE_VALGRIND),y)
  141. SYSTEMD_DEPENDENCIES += valgrind
  142. SYSTEMD_CONF_OPTS += -Dvalgrind=true
  143. else
  144. SYSTEMD_CONF_OPTS += -Dvalgrind=false
  145. endif
  146. ifeq ($(BR2_PACKAGE_XZ),y)
  147. SYSTEMD_DEPENDENCIES += xz
  148. SYSTEMD_CONF_OPTS += -Dxz=true
  149. else
  150. SYSTEMD_CONF_OPTS += -Dxz=false
  151. endif
  152. ifeq ($(BR2_PACKAGE_ZLIB),y)
  153. SYSTEMD_DEPENDENCIES += zlib
  154. SYSTEMD_CONF_OPTS += -Dzlib=true
  155. else
  156. SYSTEMD_CONF_OPTS += -Dzlib=false
  157. endif
  158. ifeq ($(BR2_PACKAGE_LIBCURL),y)
  159. SYSTEMD_DEPENDENCIES += libcurl
  160. SYSTEMD_CONF_OPTS += -Dlibcurl=true
  161. else
  162. SYSTEMD_CONF_OPTS += -Dlibcurl=false
  163. endif
  164. ifeq ($(BR2_PACKAGE_LIBGCRYPT),y)
  165. SYSTEMD_DEPENDENCIES += libgcrypt
  166. SYSTEMD_CONF_OPTS += -Ddefault-dnssec=allow-downgrade -Dgcrypt=true
  167. else
  168. SYSTEMD_CONF_OPTS += -Ddefault-dnssec=no -Dgcrypt=false
  169. endif
  170. ifeq ($(BR2_PACKAGE_P11_KIT),y)
  171. SYSTEMD_DEPENDENCIES += p11-kit
  172. SYSTEMD_CONF_OPTS += -Dp11kit=true
  173. else
  174. SYSTEMD_CONF_OPTS += -Dp11kit=false
  175. endif
  176. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  177. SYSTEMD_DEPENDENCIES += openssl
  178. SYSTEMD_CONF_OPTS += -Dopenssl=true
  179. else
  180. SYSTEMD_CONF_OPTS += -Dopenssl=false
  181. endif
  182. ifeq ($(BR2_PACKAGE_PCRE2),y)
  183. SYSTEMD_DEPENDENCIES += pcre2
  184. SYSTEMD_CONF_OPTS += -Dpcre2=true
  185. else
  186. SYSTEMD_CONF_OPTS += -Dpcre2=false
  187. endif
  188. ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),y)
  189. SYSTEMD_CONF_OPTS += -Dblkid=true
  190. else
  191. SYSTEMD_CONF_OPTS += -Dblkid=false
  192. endif
  193. ifeq ($(BR2_PACKAGE_UTIL_LINUX_NOLOGIN),y)
  194. SYSTEMD_CONF_OPTS += -Dnologin-path=/sbin/nologin
  195. else
  196. SYSTEMD_CONF_OPTS += -Dnologin-path=/bin/false
  197. endif
  198. ifeq ($(BR2_PACKAGE_SYSTEMD_INITRD),y)
  199. SYSTEMD_CONF_OPTS += -Dinitrd=true
  200. else
  201. SYSTEMD_CONF_OPTS += -Dinitrd=false
  202. endif
  203. ifeq ($(BR2_PACKAGE_SYSTEMD_KERNELINSTALL),y)
  204. SYSTEMD_CONF_OPTS += -Dkernel-install=true
  205. else
  206. SYSTEMD_CONF_OPTS += -Dkernel-install=false
  207. endif
  208. ifeq ($(BR2_PACKAGE_SYSTEMD_ANALYZE),y)
  209. SYSTEMD_CONF_OPTS += -Danalyze=true
  210. else
  211. SYSTEMD_CONF_OPTS += -Danalyze=false
  212. endif
  213. ifeq ($(BR2_PACKAGE_SYSTEMD_JOURNAL_REMOTE),y)
  214. # remote also depends on libcurl, this is already added above.
  215. SYSTEMD_DEPENDENCIES += libmicrohttpd
  216. SYSTEMD_CONF_OPTS += -Dremote=true -Dmicrohttpd=true
  217. SYSTEMD_REMOTE_USER = systemd-journal-remote -1 systemd-journal-remote -1 * - - - systemd Journal Remote
  218. else
  219. SYSTEMD_CONF_OPTS += -Dremote=false -Dmicrohttpd=false
  220. endif
  221. ifeq ($(BR2_PACKAGE_LIBQRENCODE),y)
  222. SYSTEMD_DEPENDENCIES += libqrencode
  223. SYSTEMD_CONF_OPTS += -Dqrencode=true
  224. else
  225. SYSTEMD_CONF_OPTS += -Dqrencode=false
  226. endif
  227. ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
  228. SYSTEMD_DEPENDENCIES += libselinux
  229. SYSTEMD_CONF_OPTS += -Dselinux=true
  230. else
  231. SYSTEMD_CONF_OPTS += -Dselinux=false
  232. endif
  233. ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
  234. SYSTEMD_CONF_OPTS += -Dhwdb=true
  235. define SYSTEMD_BUILD_HWDB
  236. $(HOST_DIR)/bin/udevadm hwdb --update --root $(TARGET_DIR)
  237. endef
  238. SYSTEMD_TARGET_FINALIZE_HOOKS += SYSTEMD_BUILD_HWDB
  239. define SYSTEMD_RM_HWDB_SRV
  240. rm -rf $(TARGET_DIR)/$(HOST_EUDEV_SYSCONFDIR)/udev/hwdb.d/
  241. endef
  242. SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_RM_HWDB_SRV
  243. else
  244. SYSTEMD_CONF_OPTS += -Dhwdb=false
  245. endif
  246. ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
  247. SYSTEMD_CONF_OPTS += -Dbinfmt=true
  248. else
  249. SYSTEMD_CONF_OPTS += -Dbinfmt=false
  250. endif
  251. ifeq ($(BR2_PACKAGE_SYSTEMD_VCONSOLE),y)
  252. SYSTEMD_CONF_OPTS += -Dvconsole=true
  253. else
  254. SYSTEMD_CONF_OPTS += -Dvconsole=false
  255. endif
  256. ifeq ($(BR2_PACKAGE_SYSTEMD_QUOTACHECK),y)
  257. SYSTEMD_CONF_OPTS += -Dquotacheck=true
  258. else
  259. SYSTEMD_CONF_OPTS += -Dquotacheck=false
  260. endif
  261. ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
  262. SYSTEMD_CONF_OPTS += -Dtmpfiles=true
  263. else
  264. SYSTEMD_CONF_OPTS += -Dtmpfiles=false
  265. endif
  266. ifeq ($(BR2_PACKAGE_SYSTEMD_SYSUSERS),y)
  267. SYSTEMD_CONF_OPTS += -Dsysusers=true
  268. else
  269. SYSTEMD_CONF_OPTS += -Dsysusers=false
  270. endif
  271. ifeq ($(BR2_PACKAGE_SYSTEMD_FIRSTBOOT),y)
  272. SYSTEMD_CONF_OPTS += -Dfirstboot=true
  273. else
  274. SYSTEMD_CONF_OPTS += -Dfirstboot=false
  275. endif
  276. ifeq ($(BR2_PACKAGE_SYSTEMD_RANDOMSEED),y)
  277. SYSTEMD_CONF_OPTS += -Drandomseed=true
  278. else
  279. SYSTEMD_CONF_OPTS += -Drandomseed=false
  280. endif
  281. ifeq ($(BR2_PACKAGE_SYSTEMD_BACKLIGHT),y)
  282. SYSTEMD_CONF_OPTS += -Dbacklight=true
  283. else
  284. SYSTEMD_CONF_OPTS += -Dbacklight=false
  285. endif
  286. ifeq ($(BR2_PACKAGE_SYSTEMD_RFKILL),y)
  287. SYSTEMD_CONF_OPTS += -Drfkill=true
  288. else
  289. SYSTEMD_CONF_OPTS += -Drfkill=false
  290. endif
  291. ifeq ($(BR2_PACKAGE_SYSTEMD_LOGIND),y)
  292. SYSTEMD_CONF_OPTS += -Dlogind=true
  293. else
  294. SYSTEMD_CONF_OPTS += -Dlogind=false
  295. endif
  296. ifeq ($(BR2_PACKAGE_SYSTEMD_MACHINED),y)
  297. SYSTEMD_CONF_OPTS += -Dmachined=true -Dnss-mymachines=true
  298. else
  299. SYSTEMD_CONF_OPTS += -Dmachined=false -Dnss-mymachines=false
  300. endif
  301. ifeq ($(BR2_PACKAGE_SYSTEMD_IMPORTD),y)
  302. SYSTEMD_CONF_OPTS += -Dimportd=true
  303. else
  304. SYSTEMD_CONF_OPTS += -Dimportd=false
  305. endif
  306. ifeq ($(BR2_PACKAGE_SYSTEMD_HOMED),y)
  307. SYSTEMD_CONF_OPTS += -Dhomed=true
  308. SYSTEMD_DEPENDENCIES += cryptsetup openssl
  309. else
  310. SYSTEMD_CONF_OPTS += -Dhomed=false
  311. endif
  312. ifeq ($(BR2_PACKAGE_SYSTEMD_HOSTNAMED),y)
  313. SYSTEMD_CONF_OPTS += -Dhostnamed=true
  314. else
  315. SYSTEMD_CONF_OPTS += -Dhostnamed=false
  316. endif
  317. ifeq ($(BR2_PACKAGE_SYSTEMD_MYHOSTNAME),y)
  318. SYSTEMD_CONF_OPTS += -Dnss-myhostname=true
  319. else
  320. SYSTEMD_CONF_OPTS += -Dnss-myhostname=false
  321. endif
  322. ifeq ($(BR2_PACKAGE_SYSTEMD_TIMEDATED),y)
  323. SYSTEMD_CONF_OPTS += -Dtimedated=true
  324. else
  325. SYSTEMD_CONF_OPTS += -Dtimedated=false
  326. endif
  327. ifeq ($(BR2_PACKAGE_SYSTEMD_LOCALED),y)
  328. SYSTEMD_CONF_OPTS += -Dlocaled=true
  329. else
  330. SYSTEMD_CONF_OPTS += -Dlocaled=false
  331. endif
  332. ifeq ($(BR2_PACKAGE_SYSTEMD_REPART),y)
  333. SYSTEMD_CONF_OPTS += -Drepart=true
  334. SYSTEMD_DEPENDENCIES += openssl
  335. else
  336. SYSTEMD_CONF_OPTS += -Drepart=false
  337. endif
  338. ifeq ($(BR2_PACKAGE_SYSTEMD_USERDB),y)
  339. SYSTEMD_CONF_OPTS += -Duserdb=true
  340. else
  341. SYSTEMD_CONF_OPTS += -Duserdb=false
  342. endif
  343. ifeq ($(BR2_PACKAGE_SYSTEMD_COREDUMP),y)
  344. SYSTEMD_CONF_OPTS += -Dcoredump=true
  345. SYSTEMD_COREDUMP_USER = systemd-coredump -1 systemd-coredump -1 * - - - systemd core dump processing
  346. else
  347. SYSTEMD_CONF_OPTS += -Dcoredump=false
  348. endif
  349. ifeq ($(BR2_PACKAGE_SYSTEMD_PSTORE),y)
  350. SYSTEMD_CONF_OPTS += -Dpstore=true
  351. else
  352. SYSTEMD_CONF_OPTS += -Dpstore=false
  353. endif
  354. ifeq ($(BR2_PACKAGE_SYSTEMD_POLKIT),y)
  355. SYSTEMD_CONF_OPTS += -Dpolkit=true
  356. SYSTEMD_DEPENDENCIES += polkit
  357. else
  358. SYSTEMD_CONF_OPTS += -Dpolkit=false
  359. endif
  360. ifeq ($(BR2_PACKAGE_SYSTEMD_PORTABLED),y)
  361. SYSTEMD_CONF_OPTS += -Dportabled=true
  362. else
  363. SYSTEMD_CONF_OPTS += -Dportabled=false
  364. endif
  365. ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),y)
  366. SYSTEMD_CONF_OPTS += -Dnetworkd=true
  367. SYSTEMD_NETWORKD_USER = systemd-network -1 systemd-network -1 * - - - systemd Network Management
  368. SYSTEMD_NETWORKD_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
  369. ifneq ($(SYSTEMD_NETWORKD_DHCP_IFACE),)
  370. define SYSTEMD_INSTALL_NETWORK_CONFS
  371. sed s/SYSTEMD_NETWORKD_DHCP_IFACE/$(SYSTEMD_NETWORKD_DHCP_IFACE)/ \
  372. $(SYSTEMD_PKGDIR)/dhcp.network > \
  373. $(TARGET_DIR)/etc/systemd/network/$(SYSTEMD_NETWORKD_DHCP_IFACE).network
  374. endef
  375. endif
  376. else
  377. SYSTEMD_CONF_OPTS += -Dnetworkd=false
  378. endif
  379. ifeq ($(BR2_PACKAGE_SYSTEMD_RESOLVED),y)
  380. define SYSTEMD_INSTALL_RESOLVCONF_HOOK
  381. ln -sf ../run/systemd/resolve/resolv.conf \
  382. $(TARGET_DIR)/etc/resolv.conf
  383. endef
  384. SYSTEMD_CONF_OPTS += -Dnss-resolve=true -Dresolve=true
  385. SYSTEMD_RESOLVED_USER = systemd-resolve -1 systemd-resolve -1 * - - - systemd Resolver
  386. else
  387. SYSTEMD_CONF_OPTS += -Dnss-resolve=false -Dresolve=false
  388. endif
  389. ifeq ($(BR2_PACKAGE_GNUTLS),y)
  390. SYSTEMD_CONF_OPTS += -Ddns-over-tls=gnutls -Ddefault-dns-over-tls=opportunistic
  391. SYSTEMD_DEPENDENCIES += gnutls
  392. else ifeq ($(BR2_PACKAGE_OPENSSL),y)
  393. SYSTEMD_CONF_OPTS += -Ddns-over-tls=openssl -Ddefault-dns-over-tls=opportunistic
  394. SYSTEMD_DEPENDENCIES += openssl
  395. else
  396. SYSTEMD_CONF_OPTS += -Ddns-over-tls=false -Ddefault-dns-over-tls=no
  397. endif
  398. ifeq ($(BR2_PACKAGE_SYSTEMD_TIMESYNCD),y)
  399. SYSTEMD_CONF_OPTS += -Dtimesyncd=true
  400. SYSTEMD_TIMESYNCD_USER = systemd-timesync -1 systemd-timesync -1 * - - - systemd Time Synchronization
  401. else
  402. SYSTEMD_CONF_OPTS += -Dtimesyncd=false
  403. endif
  404. ifeq ($(BR2_PACKAGE_SYSTEMD_SMACK_SUPPORT),y)
  405. SYSTEMD_CONF_OPTS += -Dsmack=true
  406. else
  407. SYSTEMD_CONF_OPTS += -Dsmack=false
  408. endif
  409. ifeq ($(BR2_PACKAGE_SYSTEMD_HIBERNATE),y)
  410. SYSTEMD_CONF_OPTS += -Dhibernate=true
  411. else
  412. SYSTEMD_CONF_OPTS += -Dhibernate=false
  413. endif
  414. ifeq ($(BR2_PACKAGE_SYSTEMD_BOOT),y)
  415. SYSTEMD_INSTALL_IMAGES = YES
  416. SYSTEMD_DEPENDENCIES += gnu-efi
  417. SYSTEMD_CONF_OPTS += \
  418. -Defi=true \
  419. -Dgnu-efi=true \
  420. -Defi-cc=$(TARGET_CC) \
  421. -Defi-ld=$(TARGET_LD) \
  422. -Defi-libdir=$(STAGING_DIR)/usr/lib \
  423. -Defi-ldsdir=$(STAGING_DIR)/usr/lib \
  424. -Defi-includedir=$(STAGING_DIR)/usr/include/efi
  425. SYSTEMD_BOOT_EFI_ARCH = $(call qstrip,$(BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH))
  426. define SYSTEMD_INSTALL_BOOT_FILES
  427. $(INSTALL) -D -m 0644 $(@D)/build/src/boot/efi/systemd-boot$(SYSTEMD_BOOT_EFI_ARCH).efi \
  428. $(BINARIES_DIR)/efi-part/EFI/BOOT/boot$(SYSTEMD_BOOT_EFI_ARCH).efi
  429. echo "boot$(SYSTEMD_BOOT_EFI_ARCH).efi" > \
  430. $(BINARIES_DIR)/efi-part/startup.nsh
  431. $(INSTALL) -D -m 0644 $(SYSTEMD_PKGDIR)/boot-files/loader.conf \
  432. $(BINARIES_DIR)/efi-part/loader/loader.conf
  433. $(INSTALL) -D -m 0644 $(SYSTEMD_PKGDIR)/boot-files/buildroot.conf \
  434. $(BINARIES_DIR)/efi-part/loader/entries/buildroot.conf
  435. endef
  436. else
  437. SYSTEMD_CONF_OPTS += -Defi=false -Dgnu-efi=false
  438. endif # BR2_PACKAGE_SYSTEMD_BOOT == y
  439. SYSTEMD_FALLBACK_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
  440. ifneq ($(SYSTEMD_FALLBACK_HOSTNAME),)
  441. SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
  442. endif
  443. define SYSTEMD_INSTALL_INIT_HOOK
  444. ln -fs multi-user.target \
  445. $(TARGET_DIR)/usr/lib/systemd/system/default.target
  446. endef
  447. define SYSTEMD_INSTALL_MACHINEID_HOOK
  448. touch $(TARGET_DIR)/etc/machine-id
  449. endef
  450. SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
  451. SYSTEMD_INSTALL_INIT_HOOK \
  452. SYSTEMD_INSTALL_MACHINEID_HOOK \
  453. SYSTEMD_INSTALL_RESOLVCONF_HOOK
  454. define SYSTEMD_INSTALL_IMAGES_CMDS
  455. $(SYSTEMD_INSTALL_BOOT_FILES)
  456. endef
  457. define SYSTEMD_USERS
  458. # udev user groups
  459. # systemd user groups
  460. - - systemd-journal -1 * - - - Journal
  461. $(SYSTEMD_REMOTE_USER)
  462. $(SYSTEMD_COREDUMP_USER)
  463. $(SYSTEMD_NETWORKD_USER)
  464. $(SYSTEMD_RESOLVED_USER)
  465. $(SYSTEMD_TIMESYNCD_USER)
  466. endef
  467. define SYSTEMD_INSTALL_NSSCONFIG_HOOK
  468. $(SED) '/^passwd:/ {/systemd/! s/$$/ systemd/}' \
  469. -e '/^group:/ {/systemd/! s/$$/ [SUCCESS=merge] systemd/}' \
  470. $(if $(BR2_PACKAGE_SYSTEMD_RESOLVED), \
  471. -e '/^hosts:/ s/[[:space:]]*mymachines//' \
  472. -e '/^hosts:/ {/resolve/! s/files/files resolve [!UNAVAIL=return]/}' ) \
  473. $(if $(BR2_PACKAGE_SYSTEMD_MYHOSTNAME), \
  474. -e '/^hosts:/ {/myhostname/! s/$$/ myhostname/}' ) \
  475. $(if $(BR2_PACKAGE_SYSTEMD_MACHINED), \
  476. -e '/^passwd:/ {/mymachines/! s/files/files mymachines/}' \
  477. -e '/^group:/ {/mymachines/! s/files/files [SUCCESS=merge] mymachines/}' \
  478. -e '/^hosts:/ {/mymachines/! s/files/files mymachines/}' ) \
  479. $(TARGET_DIR)/etc/nsswitch.conf
  480. endef
  481. SYSTEMD_TARGET_FINALIZE_HOOKS += SYSTEMD_INSTALL_NSSCONFIG_HOOK
  482. ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
  483. # systemd provides multiple units to autospawn getty as neede
  484. # * getty@.service to start a getty on normal TTY
  485. # * sertial-getty@.service to start a getty on serial lines
  486. # * console-getty.service for generic /dev/console
  487. # * container-getty@.service for a getty on /dev/pts/*
  488. #
  489. # the generator systemd-getty-generator will
  490. # * read the console= kernel command line parameter
  491. # * enable one of the above units depending on what it finds
  492. #
  493. # Systemd defaults to enablinb getty@tty1.service
  494. #
  495. # What we want to do
  496. # * Enable a getty on $BR2_TARGET_GENERIC_TTY_PATH
  497. # * Set the baudrate for all units according to BR2_TARGET_GENERIC_GETTY_BAUDRATE
  498. # * Always enable a getty on the console using systemd-getty-generator
  499. # (backward compatibility with previous releases of buildroot)
  500. #
  501. # What we do
  502. # * disable getty@tty1 (enabled by upstream systemd)
  503. # * enable getty@xxx if $BR2_TARGET_GENERIC_TTY_PATH is a tty
  504. # * enable serial-getty@xxx for other $BR2_TARGET_GENERIC_TTY_PATH
  505. # * rewrite baudrates if a baudrate is provided
  506. define SYSTEMD_INSTALL_SERVICE_TTY
  507. mkdir $(TARGET_DIR)/usr/lib/systemd/system/getty@.service.d; \
  508. printf '[Install]\nDefaultInstance=\n' \
  509. >$(TARGET_DIR)/usr/lib/systemd/system/getty@.service.d/buildroot-console.conf; \
  510. if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = "console" ]; \
  511. then \
  512. : ; \
  513. elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
  514. then \
  515. printf '[Install]\nDefaultInstance=%s\n' \
  516. $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) \
  517. >$(TARGET_DIR)/usr/lib/systemd/system/getty@.service.d/buildroot-console.conf; \
  518. else \
  519. mkdir $(TARGET_DIR)/usr/lib/systemd/system/serial-getty@.service.d;\
  520. printf '[Install]\nDefaultInstance=%s\n' \
  521. $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) \
  522. >$(TARGET_DIR)/usr/lib/systemd/system/serial-getty@.service.d/buildroot-console.conf;\
  523. fi; \
  524. if [ $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -gt 0 ] ; \
  525. then \
  526. $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/getty@.service; \
  527. $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/serial-getty@.service; \
  528. $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/console-getty@.service; \
  529. $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/container-getty@.service; \
  530. fi
  531. endef
  532. endif
  533. define SYSTEMD_INSTALL_PRESET
  534. $(INSTALL) -D -m 644 $(SYSTEMD_PKGDIR)/80-buildroot.preset $(TARGET_DIR)/usr/lib/systemd/system-preset/80-buildroot.preset
  535. endef
  536. define SYSTEMD_INSTALL_INIT_SYSTEMD
  537. $(SYSTEMD_INSTALL_PRESET)
  538. $(SYSTEMD_INSTALL_SERVICE_TTY)
  539. $(SYSTEMD_INSTALL_NETWORK_CONFS)
  540. endef
  541. define SYSTEMD_PRESET_ALL
  542. $(HOST_DIR)/bin/systemctl --root=$(TARGET_DIR) preset-all
  543. endef
  544. SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL
  545. SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
  546. SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
  547. define SYSTEMD_LINUX_CONFIG_FIXUPS
  548. $(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
  549. $(call KCONFIG_ENABLE_OPT,CONFIG_FHANDLE)
  550. $(call KCONFIG_ENABLE_OPT,CONFIG_EPOLL)
  551. $(call KCONFIG_ENABLE_OPT,CONFIG_SIGNALFD)
  552. $(call KCONFIG_ENABLE_OPT,CONFIG_TIMERFD)
  553. $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER)
  554. $(call KCONFIG_ENABLE_OPT,CONFIG_PROC_FS)
  555. $(call KCONFIG_ENABLE_OPT,CONFIG_SYSFS)
  556. $(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
  557. $(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
  558. $(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
  559. endef
  560. # We need a very minimal host variant, so we disable as much as possible.
  561. HOST_SYSTEMD_CONF_OPTS = \
  562. -Dsplit-bin=true \
  563. -Dsplit-usr=false \
  564. --prefix=/usr \
  565. --libdir=lib \
  566. --sysconfdir=/etc \
  567. --localstatedir=/var \
  568. -Dutmp=false \
  569. -Dhibernate=false \
  570. -Dldconfig=false \
  571. -Dresolve=false \
  572. -Defi=false \
  573. -Dtpm=false \
  574. -Denvironment-d=false \
  575. -Dbinfmt=false \
  576. -Drepart=false \
  577. -Dcoredump=false \
  578. -Dpstore=false \
  579. -Dlogind=false \
  580. -Dhostnamed=false \
  581. -Dlocaled=false \
  582. -Dmachined=false \
  583. -Dportabled=false \
  584. -Duserdb=false \
  585. -Dhomed=false \
  586. -Dnetworkd=false \
  587. -Dtimedated=false \
  588. -Dtimesyncd=false \
  589. -Dremote=false \
  590. -Dcreate-log-dirs=false \
  591. -Dnss-myhostname=false \
  592. -Dnss-mymachines=false \
  593. -Dnss-resolve=false \
  594. -Dnss-systemd=false \
  595. -Dfirstboot=false \
  596. -Drandomseed=false \
  597. -Dbacklight=false \
  598. -Dvconsole=false \
  599. -Dquotacheck=false \
  600. -Dsysusers=false \
  601. -Dtmpfiles=false \
  602. -Dimportd=false \
  603. -Dhwdb=false \
  604. -Drfkill=false \
  605. -Dman=false \
  606. -Dhtml=false \
  607. -Dsmack=false \
  608. -Dpolkit=false \
  609. -Dblkid=false \
  610. -Didn=false \
  611. -Dadm-group=false \
  612. -Dwheel-group=false \
  613. -Dzlib=false \
  614. -Dgshadow=false \
  615. -Dima=false \
  616. -Dtests=false \
  617. -Dglib=false \
  618. -Dacl=false \
  619. -Dsysvinit-path='' \
  620. -Dinitrd=false \
  621. -Dxdg-autostart=false \
  622. -Dkernel-install=false \
  623. -Dsystemd-analyze=false \
  624. -Dlibcryptsetup=false \
  625. -Daudit=false \
  626. -Dzstd=false
  627. HOST_SYSTEMD_DEPENDENCIES = \
  628. $(BR2_COREUTILS_HOST_DEPENDENCY) \
  629. host-util-linux \
  630. host-patchelf \
  631. host-libcap \
  632. host-gperf
  633. HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
  634. # Fix RPATH After installation
  635. # * systemd provides a install_rpath instruction to meson because the binaries
  636. # need to link with libsystemd which is not in a standard path
  637. # * meson can only replace the RPATH, not append to it
  638. # * the original rpath is thus lost.
  639. # * the original path had been tweaked by buildroot via LDFLAGS to add
  640. # $(HOST_DIR)/lib
  641. # * thus re-tweak rpath after the installation for all binaries that need it
  642. HOST_SYSTEMD_HOST_TOOLS = busctl journalctl systemctl systemd-* udevadm
  643. define HOST_SYSTEMD_FIX_RPATH
  644. for f in $(addprefix $(HOST_DIR)/bin/,$(HOST_SYSTEMD_HOST_TOOLS)); do \
  645. [ -e $$f ] || continue; \
  646. $(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $${f} \
  647. || exit 1; \
  648. done
  649. endef
  650. HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH
  651. $(eval $(meson-package))
  652. $(eval $(host-meson-package))