config BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
	bool
	# see src/basic/architecture.h
	default y if BR2_arc
	default y if BR2_aarch64 || BR2_aarch64_be
	default y if BR2_arm || BR2_armeb
	default y if BR2_i386 || BR2_x86_64
	default y if BR2_m68k
	default y if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
	default y if BR2_nios2
	default y if BR2_riscv
	default y if BR2_sh4 || BR2_sh4eb || BR2_sh4a || BR2_sh4aeb
	default y if BR2_sparc || BR2_sparc64
	default y if BR2_s390x

menuconfig BR2_PACKAGE_SYSTEMD
	bool "systemd"
	depends on BR2_INIT_SYSTEMD
	depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
	depends on BR2_USE_MMU
	depends on !BR2_STATIC_LIBS # kmod
	depends on BR2_TOOLCHAIN_USES_GLIBC
	depends on BR2_TOOLCHAIN_HAS_SSP
	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
	depends on BR2_HOST_GCC_AT_LEAST_5 # host-systemd
	select BR2_PACKAGE_HAS_UDEV
	select BR2_PACKAGE_DBUS # runtime dependency only
	select BR2_PACKAGE_LIBCAP
	select BR2_PACKAGE_UTIL_LINUX
	select BR2_PACKAGE_UTIL_LINUX_LIBS
	select BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
	select BR2_PACKAGE_UTIL_LINUX_AGETTY
	select BR2_PACKAGE_UTIL_LINUX_MOUNT
	select BR2_PACKAGE_UTIL_LINUX_FSCK
	select BR2_PACKAGE_KMOD
	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
	select BR2_PACKAGE_KMOD_TOOLS
	select BR2_TARGET_TZ_INFO
	select BR2_NEEDS_HOST_UTF8_LOCALE
	select BR2_PACKAGE_HOST_SYSTEMD # for systemctl preset-all, during target-finalize
	help
	  systemd is a system and service manager for Linux,
	  compatible with SysV and LSB init scripts. systemd provides
	  aggressive parallelization capabilities, uses socket and
	  D-Bus activation for starting services, offers on-demand
	  starting of daemons, keeps track of processes using Linux
	  cgroups, supports snapshotting and restoring of the system
	  state, maintains mount and automount points and implements
	  an elaborate transactional dependency-based service control
	  logic.  It can work as a drop-in replacement for sysvinit.

	  Systemd requires a Linux kernel >= 3.0 with the following
	  options enabled:

	  - CONFIG_CGROUPS
	  - CONFIG_INOTIFY_USER
	  - CONFIG_FHANDLE
	  - CONFIG_AUTOFS4_FS
	  - CONFIG_TMPFS_POSIX_ACL
	  - CONFIG_TMPFS_XATTR

	  These options will be automatically enabled by Buildroot if
	  it is responsible for building the kernel. Otherwise, if you
	  are building your kernel outside of Buildroot, make sure
	  these options are enabled.

	  Systemd also provides udev, the userspace device daemon.

	  The selection of other packages will enable some features:

	  - acl package will add support for multi-seat.
	  - xz and/or l4 packages will add compression support in
	    journal and coredump.
	  - libcurl package will add support for systemd-journal-upload.
	  - libgcrypt package will add support for journal sealing and
	    DNSSEC verification in resolved.

	  Notice that systemd selects the fsck wrapper from util-linux
	  but no particular fsck.<fstype> is selected. You must choose
	  the apropriate ones (e.g. e2fsck, from the e2fsprogs
	  package) according to the system configuration.

	  http://freedesktop.org/wiki/Software/systemd

if BR2_PACKAGE_SYSTEMD

config BR2_PACKAGE_PROVIDES_UDEV
	default "systemd"

config BR2_PACKAGE_SYSTEMD_BOOT
	bool "systemd-boot"
	depends on BR2_i386 || BR2_x86_64
	select BR2_PACKAGE_GNU_EFI
	help
	  systemd-boot is a simple UEFI boot manager which executes
	  configured EFI images. The default entry is selected by a
	  configured pattern (glob) or an on-screen menu.

	  systemd-boot operates on the EFI System Partition (ESP)
	  only. Configuration file fragments, kernels, initrds, other
	  EFI images need to reside on the ESP. Linux kernels need to
	  be built with CONFIG_EFI_STUB to be able to be directly
	  executed as an EFI image.

	  See the Grub2 help text for details on preparing an EFI
	  capable disk image using systemd-boot: the instructions are
	  exactly the same, except that the systemd-boot configuration
	  files will be located in /loader/ inside the EFI partition.

	  https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/

config BR2_PACKAGE_SYSTEMD_INITRD
	bool "Services for booting from initrd"
	help
	  Install various services that are only useful if systemd is
	  run from an initrd.

config BR2_PACKAGE_SYSTEMD_KERNELINSTALL
	bool "install kernel-install and related files"
	help
	  kernel-install is used to install and remove kernel and
	  initramfs images to and from the boot loader partition.
	  The boot loader partition will usually be one of
	  /boot, /efi, or /boot/efi.

config BR2_PACKAGE_SYSTEMD_ANALYZE
	bool "systemd-analyze"
	help
	  systemd-analyze may be used to determine system boot-up
	  performance statistics and retrieve other state and tracing
	  information from the system and service manager, and to
	  verify the correctness of unit files.
	  It is also used to access special functions useful for
	  advanced system manager debugging.

config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH
	string
	default "ia32"  if BR2_i386
	default "x64"   if BR2_x86_64
	depends on BR2_PACKAGE_SYSTEMD_BOOT

config BR2_PACKAGE_SYSTEMD_JOURNAL_REMOTE
	bool "enable journal remote tools"
	select BR2_PACKAGE_LIBCURL
	select BR2_PACKAGE_LIBMICROHTTPD
	help
	  journal remote functionality adds three tools:

	  systemd-journal-gatewayd serves journal events over the
	  network.

	  systemd-journal-remote is a command to receive serialized
	  journal events and store them to journal files.

	  systemd-journal-upload will upload journal entries to the
	  URL specified with --url=.

	  https://www.freedesktop.org/software/systemd/man/systemd-journal-gatewayd.service.html
	  https://www.freedesktop.org/software/systemd/man/systemd-journal-remote.service.html
	  https://www.freedesktop.org/software/systemd/man/systemd-journal-upload.html

config BR2_PACKAGE_SYSTEMD_BACKLIGHT
	bool "enable backlight support"
	help
	  systemd-backlight is a service that restores the display
	  backlight brightness at early boot and saves it at shutdown.

	  http://www.freedesktop.org/software/systemd/man/systemd-backlight@.service.html

config BR2_PACKAGE_SYSTEMD_BINFMT
	bool "enable binfmt tool"
	help
	  systemd-binfmt is an early boot service that registers
	  additional binary formats for executables in the kernel.

	  http://www.freedesktop.org/software/systemd/man/systemd-binfmt.service.html

config BR2_PACKAGE_SYSTEMD_COREDUMP
	bool "enable coredump hook"
	help
	  systemd-coredump can be used as a helper binary by the
	  kernel when a user space program receives a fatal signal and
	  dumps core.

	  http://www.freedesktop.org/software/systemd/man/systemd-coredump.html

config BR2_PACKAGE_SYSTEMD_PSTORE
	bool "enable pstore support"
	default y
	help
	  When this features is enabled, additional tools and services
	  are built to support archiving contents of the persistent
	  storage filesytem.

	  https://www.freedesktop.org/software/systemd/man/systemd-pstore.html

config BR2_PACKAGE_SYSTEMD_FIRSTBOOT
	bool "enable firstboot support"
	help
	  systemd-firstboot initializes the most basic system settings
	  interactively on the first boot.

	  http://www.freedesktop.org/software/systemd/man/systemd-firstboot.html

config BR2_PACKAGE_SYSTEMD_HIBERNATE
	bool "enable hibernation support"
	select BR2_PACKAGE_SYSTEMD_INITRD
	help
	  When this features is enabled, additional tools and services
	  are built to support suspending and resuming the system.

	  http://www.freedesktop.org/software/systemd/man/systemd-sleep.html

config BR2_PACKAGE_SYSTEMD_HOMED
	bool "enable home daemon"
	depends on BR2_TOOLCHAIN_HAS_THREADS # cryptsetup -> lvm2
	depends on BR2_USE_MMU # cryptsetup -> lvm2
	depends on !BR2_STATIC_LIBS # cryptsetup -> lvm2
	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # cryptsetup -> json-c
	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12 # fscrypt_key
	select BR2_PACKAGE_CRYPTSETUP
	select BR2_PACKAGE_OPENSSL
	select BR2_PACKAGE_UTIL_LINUX_LIBFDISK
	help
	  systemd-homed is a system service that may be used to create,
	  remove, change or inspect home directories.

	  https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html

comment "homed support needs a toolchain w/ threads, dynamic library, kernel headers >= 4.12"
	depends on BR2_USE_MMU
	depends on BR2_TOOLCHAIN_HAS_SYNC_4
	depends on !BR2_TOOLCHAIN_HAS_THREADS || \
		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12

config BR2_PACKAGE_SYSTEMD_HOSTNAMED
	bool "enable hostname daemon"
	default y
	help
	  systemd-hostnamed is a system service that may be used as a
	  mechanism to change the system's hostname.

	  http://www.freedesktop.org/software/systemd/man/systemd-hostnamed.service.html

config BR2_PACKAGE_SYSTEMD_HWDB
	bool "enable hwdb installation"
	default y
	help
	  Enables hardware database installation to /usr/lib/udev/hwdb.d

	  Disabling this option improves first boot time (or every boot
	  time in case of initramfs images) and saves several MB space.

	  https://www.freedesktop.org/software/systemd/man/hwdb.html

config BR2_PACKAGE_SYSTEMD_IMPORTD
	bool "enable import daemon"
	depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS # libgcrypt
	select BR2_PACKAGE_LIBCURL
	select BR2_PACKAGE_LIBGCRYPT
	select BR2_PACKAGE_XZ
	select BR2_PACKAGE_ZLIB
	help
	  systemd-importd is a system service that manages virtual
	  machine and container images for systemd-machined and
	  machinectl.

	  http://www.freedesktop.org/software/systemd/man/machinectl.html#Image%20Transfer%20Commands

config BR2_PACKAGE_SYSTEMD_LOCALED
	bool "enable locale daemon"
	help
	  systemd-localed is a system service that may be used as
	  mechanism to change the system locale settings, as well as
	  the console key mapping and default X11 key mapping.

	  http://www.freedesktop.org/software/systemd/man/systemd-localed.service.html

config BR2_PACKAGE_SYSTEMD_LOGIND
	bool "enable login daemon"
	help
	  systemd-logind is a system service that manages user logins.

	  http://www.freedesktop.org/software/systemd/man/systemd-logind.service.html

config BR2_PACKAGE_SYSTEMD_MACHINED
	bool "enable machine daemon"
	help
	  systemd-machined is a system service that keeps track of
	  virtual machines and containers, and processes belonging to
	  them.

	  http://www.freedesktop.org/software/systemd/man/systemd-machined.service.html

config BR2_PACKAGE_SYSTEMD_MYHOSTNAME
	bool "enable myhostname NSS plugin"
	default y
	help
	  nss-myhostname is a plug-in module for the GNU Name Service
	  Switch (NSS) functionality of the GNU C Library (glibc),
	  primarily providing hostname resolution for the locally
	  configured system hostname as returned by gethostname(2).

	  http://www.freedesktop.org/software/systemd/man/nss-myhostname.html

config BR2_PACKAGE_SYSTEMD_NETWORKD
	bool "enable network manager"
	default y
	help
	  systemd-networkd is a system service that manages networks.
	  It detects and configures network devices as they appear, as
	  well as creating virtual network devices.

	  This simple network configuration solution is an alternative
	  to dhcpcd or ISC dhcp.

	  http://www.freedesktop.org/software/systemd/man/systemd-networkd.html

config BR2_PACKAGE_SYSTEMD_POLKIT
	bool "enable polkit support"
	depends on BR2_HOST_GCC_AT_LEAST_4_9 # polkit
	depends on BR2_INSTALL_LIBSTDCPP # polkit
	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # polkit
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # polkit
	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # polkit
	depends on BR2_USE_WCHAR # libglib2
	select BR2_PACKAGE_POLKIT
	help
	  If enabled, systemd is built with polkit support and policy
	  files for its services are generated and installed. It is
	  useful for allowing unprivileged processes to speak to
	  systemd's many privileged processes.

	  http://wiki.freedesktop.org/www/Software/polkit/

comment "polkit support needs a toolchain with C++, wchar, NPTL, gcc >= 4.9"
	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS
	depends on !BR2_INSTALL_LIBSTDCPP || \
		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
		!BR2_HOST_GCC_AT_LEAST_4_9 || \
		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
		!BR2_USE_WCHAR

config BR2_PACKAGE_SYSTEMD_PORTABLED
	bool "enable portable services"
	help
	  Portable services are systemd services that can be dynamically
	  attached and detached from the system.

	  These services must come with their own root directory which
	  they are bound to through an automatically generated drop-in.

	  They also have restrictions applied by the host system in the
	  form of profiles.

	  This functionality is provided by the system service
	  systemd-portabled along with the corresponding CLI
	  portablectl.

	  https://systemd.io/PORTABLE_SERVICES/

config BR2_PACKAGE_SYSTEMD_QUOTACHECK
	bool "enable quotacheck tools"
	help
	  systemd-quotacheck is a service responsible for file system
	  quota checks. It is run once at boot after all necessary
	  file systems are mounted. It is pulled in only if at least
	  one file system has quotas enabled.

	  http://www.freedesktop.org/software/systemd/man/systemd-quotacheck.service.html

config BR2_PACKAGE_SYSTEMD_RANDOMSEED
	bool "enable random-seed support"
	help
	  systemd-random-seed is a service that restores the random
	  seed of the system at early boot and saves it at
	  shutdown. Saving/restoring the random seed across boots
	  increases the amount of available entropy early at boot.

	  http://www.freedesktop.org/software/systemd/man/systemd-random-seed.service.html

config BR2_PACKAGE_SYSTEMD_REPART
	bool "enable repart support"
	select BR2_PACKAGE_OPENSSL
	select BR2_PACKAGE_UTIL_LINUX_LIBFDISK
	help
	  systemd-repart grows and adds partitions to a partition table,
	  based on the configuration files described in repart.d.

	  https://www.freedesktop.org/software/systemd/man/systemd-repart.html

config BR2_PACKAGE_SYSTEMD_RESOLVED
	bool "enable resolve daemon"
	default y
	help
	  systemd-resolved is a system service that provides network
	  name resolution to local applications. It implements a
	  caching and validating DNS/DNSSEC stub resolver, as well as
	  an LLMNR resolver and responder.

	  http://www.freedesktop.org/software/systemd/man/systemd-resolved.html

config BR2_PACKAGE_SYSTEMD_RFKILL
	bool "enable rfkill tools"
	help
	  systemd-rfkill is a service that restores the RF kill switch
	  state at early boot and saves it at shutdown.

	  http://www.freedesktop.org/software/systemd/man/systemd-rfkill@.service.html

config BR2_PACKAGE_SYSTEMD_SMACK_SUPPORT
	bool "enable SMACK support"
	select BR2_PACKAGE_ATTR
	select BR2_PACKAGE_SMACK
	help
	  Enable support for SMACK, the Simple Mandatory Access
	  Control Kernel, a minimal approach to Access Control
	  implemented as a kernel LSM.

	  This feature requires a kernel >= 3.8.

	  When this feature is enabled, Systemd mounts smackfs and
	  manages security labels for sockets.

config BR2_PACKAGE_SYSTEMD_SYSUSERS
	bool "enable sysusers support"
	help
	  systemd-sysusers creates system users and groups, based on
	  the file format and location specified in sysusers.d(5).

	  http://www.freedesktop.org/software/systemd/man/systemd-sysusers.html

config BR2_PACKAGE_SYSTEMD_TIMEDATED
	bool "enable timedate daemon"
	default y
	help
	  systemd-timedated is a system service that may be used as a
	  mechanism to change the system clock and timezone, as well
	  as to enable/disable NTP time synchronization.

	  http://www.freedesktop.org/software/systemd/man/systemd-timedated.service.html

config BR2_PACKAGE_SYSTEMD_TIMESYNCD
	bool "enable timesync daemon"
	default y
	help
	  systemd-timesyncd is a service that may be used to
	  synchronize the local system clock with a Network Time
	  Protocol server.

	  This simple NTP solution is an alternative to sntp/ntpd from
	  the ntp package.

	  http://www.freedesktop.org/software/systemd/man/systemd-timesyncd.html

config BR2_PACKAGE_SYSTEMD_TMPFILES
	bool "enable tmpfiles support"
	default y
	help
	  systemd-tmpfiles creates, deletes, and cleans up volatile
	  and temporary files and directories, based on the
	  configuration file format and location specified in
	  tmpfiles.d(5).

	  http://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html

config BR2_PACKAGE_SYSTEMD_USERDB
	bool "enable userdb daemon"
	help
	  systemd-userdbd is a system service that multiplexes
	  user/group lookups to all local services that provide JSON
	  user/group record definitions to the system. In addition it
	  synthesizes JSON user/group records from classic UNIX/glibc
	  NSS user/group records in order to provide full backwards
	  compatibility.

	  https://www.freedesktop.org/software/systemd/man/systemd-userdbd.service.html

config BR2_PACKAGE_SYSTEMD_VCONSOLE
	bool "enable vconsole tool"
	default y
	help
	  systemd-vconsole-setup is an early boot service that
	  configures the virtual console font and console keymap.

	  http://www.freedesktop.org/software/systemd/man/systemd-vconsole-setup.service.html

endif
