diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk index 559a169aee..30783dfd26 100644 --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk @@ -32,6 +32,7 @@ define SKELETON_INIT_SYSTEMD_ROOT_RO_OR_RW echo "/dev/root / auto ro 0 1" >$(TARGET_DIR)/etc/fstab endef +ifeq ($(BR2_INIT_SYSTEMD_VAR_FACTORY),y) define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR rm -rf $(TARGET_DIR)/usr/share/factory/var mv $(TARGET_DIR)/var $(TARGET_DIR)/usr/share/factory/var @@ -55,14 +56,16 @@ define SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR $(TARGET_DIR)/usr/lib/systemd/system/var.mount endef SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR +endif # BR2_INIT_SYSTEMD_VAR_FACTORY +endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW -endif - +ifeq ($(BR2_INIT_SYSTEMD_POPULATE_TMPFILES),y) define SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \ $(SKELETON_INIT_SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR) endef SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK +endif # BR2_INIT_SYSTEMD_POPULATE_TMPFILES define SKELETON_INIT_SYSTEMD_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/home diff --git a/system/Config.in b/system/Config.in index 888c24ce81..806a747315 100644 --- a/system/Config.in +++ b/system/Config.in @@ -154,10 +154,48 @@ source "$BR2_BASE_DIR/.br2-external.in.init" endchoice +if BR2_INIT_SYSTEMD + +config BR2_INIT_SYSTEMD_VAR_FACTORY + bool "build a factory to populate a tmpfs on /var" + default y # legacy + depends on !BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW + help + Build a factory of the content of /var as installed by + packages, mount a tmpfs on /var at runtime, so that + systemd-tmpfiles can populate it from the factory. + + This may help on a read-only rootfs. + + It probably does not play very well with triggering a call + to systemd-tmpfiles at build time (below). + + Note: Buildroot mounts a tmpfs on /var to at least make the + system bootable out of the box; mounting a filesystem from + actual storage is left to the integration, as it is too + specific and may need preparatory work like partitionning a + device and/or formatting a filesystem first, so that falls + out of the scope of Buildroot. + + To use persistent storage, provide a systemd dropin for the + var.mount unit, that overrides the What and Type, and possibly + the Options and After, fields. + +config BR2_INIT_SYSTEMD_POPULATE_TMPFILES + bool "trigger systemd-tmpfiles during build" + default y # legacy + help + Act on the systemd-tmpfiles.d database at build time, when + assembling the root filesystems. + + This may help on a read-only filesystem. + + It probably does not play very well with the /var factory + (above). + config BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET string "The default unit systemd starts at bootup" default "multi-user.target" - depends on BR2_INIT_SYSTEMD help Specify the name of the unit configuration file to be started at bootup by systemd. Should end in ".target". @@ -165,6 +203,8 @@ config BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET https://www.freedesktop.org/software/systemd/man/systemd.special.html#default.target +endif # BR2_INIT_SYSTEMD + choice prompt "/dev management" if !BR2_INIT_SYSTEMD default BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_DEVTMPFS