systemd.mk 20 KB

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