Re: [ptxdist] [ptxdist-commit] 19/22: templates: add src-meson-prog template
On Wed, Jun 05, 2019 at 07:38:10PM +0200, Michael Olbrich via Gitolite wrote: > This is an automated email from the git hooks/post-receive script. > > pengutronix.michael.olbrich pushed a commit to branch master > in repository ptxdist. > > commit 91749a01cd22dc2a7d72e841568a2dddb16200f7 > Author: Ulrich Ölmann > AuthorDate: Wed Jun 5 01:16:54 2019 +0200 > > templates: add src-meson-prog template > > Signed-off-by: Ulrich Ölmann > Signed-off-by: Michael Olbrich > --- > doc/dev_manual.rst | 36 +--- > rules/templates/src-meson-prog/@name@.c | 12 > rules/templates/src-meson-prog/COPYING | 12 > rules/templates/src-meson-prog/config.h.in | 1 + > rules/templates/src-meson-prog/meson.build | 13 + > rules/templates/src-meson-prog/wizard.sh | 17 ++ > rules/templates/template-src-meson-prog-in | 8 +++ > rules/templates/template-src-meson-prog-make | 83 > > scripts/lib/ptxd_lib_template.sh | 7 +++ > 9 files changed, 182 insertions(+), 7 deletions(-) > > diff --git a/doc/dev_manual.rst b/doc/dev_manual.rst > index e17aa9b1bb58..dfadcb241891 100644 > --- a/doc/dev_manual.rst > +++ b/doc/dev_manual.rst > @@ -206,6 +206,14 @@ handle: > and their settings. Creating such a package will also create a simple > template project to be used as a starting point for development. > > +- **src-meson-prog**: This kind of package is built for the target. > + It’s intended for developments based on the *meson* buildsystem. > + Various projects are using *meson* today and can be built > + with this package type. PTXdist will prepare it to compile sources in > + accordance to the target libraries and their settings. Creating such > + a package will also create a simple template project to be used as a > + starting point for development. > + > - **font**: This package is a helper to add X font files to the root > filesystem. This package does not create an additional IPKG, instead > it adds the font to the existing font IPKG. This includes the > @@ -1156,12 +1164,12 @@ So, in the rule file only the two variables > ``FOO_MAKE_ENV`` and > package’s buildsystem. If the package cannot be built in parallel, we > can also add the ``FOO_MAKE_PAR := NO``. ``YES`` is the default. > > -Managing CMake / QMake Packages > -^^^ > +Managing CMake/QMake/Meson Packages > +^^^ > > -Building packages that use ``cmake`` or ``qmake`` is much like building > -packages with an autotools based buildsystem. We need to specify the > -configuration tool: > +Building packages that use ``cmake``, ``qmake`` or ``meson`` is much like > +building packages with an autotools based buildsystem. We need to specify > +the configuration tool: > > .. code-block:: make > > @@ -1173,6 +1181,12 @@ or > > FOO_CONF_TOOL := qmake > > +or respectively > + > +.. code-block:: make > + > +FOO_CONF_TOOL := meson > + > And provide the correct configuration options. The syntax is different so > PTXdist provides additional macros to simplify configurable features. > For ``cmake`` the configuration options typically look like this: > @@ -1192,8 +1206,16 @@ For ``qmake`` the configuration options typically look > like this: > $(CROSS_QMAKE_OPT) \ > PREFIX=/usr > > -Please note that currently only host and target ``cmake`` packages and only > -target ``qmake`` packages are supported. > +And for ``meson`` the configuration options typically look like this: > + > +.. code-block:: make > + > +FOO_CONF_OPT := \ > + $(CROSS_MESON_USR) \ > + -Dbar=$(call ptx/truefalse,PTXCONF_FOO_BAR) > + > +Please note that currently only host and target ``cmake``\/``meson`` packages > +and only target ``qmake`` packages are supported. > > Managing Python Packages > > diff --git a/rules/templates/src-meson-prog/@name@.c > b/rules/templates/src-meson-prog/@name@.c > new file mode 100644 > index ..061debf310bc > --- /dev/null > +++ b/rules/templates/src-meson-prog/@name@.c > @@ -0,0 +1,12 @@ > +#include > +#include > + > +#include "config.h" > + > +int main(int argc, char *argv[]) > +{ > + printf("Hello World, I'm @name@!\n"); > + printf("My license is " LICENSE_STR ".\n"); > + > + exit(EXIT_SUCCESS); > +} > diff --git a/rules/templates/src-meson-prog/COPYING > b/rules/templates/src-meson-prog/COPYING > new file mode 100644 > index ..1844a019b31f > --- /dev/null > +++ b/rules/templates/src-meson-prog/COPYING > @@ -0,0 +1,12 @@ > +Copyright (C) 2006 by Rob Landley That Rob Landley is surely a very productive person, according to all the copyright lines he gets :) Maybe use "@YEAR@ by @AUTHOR@" here too? - Roland > + > +Permission to use, copy, modify, and/or distribute this software for any > purpose > +with or without fee is hereby granted. > + >
[ptxdist] [PATCH 1/2] doc: ref_make_macros: document the 'extract' macro
Signed-off-by: Roland Hieber --- doc/ref_make_macros.inc | 15 +++ 1 file changed, 15 insertions(+) diff --git a/doc/ref_make_macros.inc b/doc/ref_make_macros.inc index 329f3821ce77..749cf31edf66 100644 --- a/doc/ref_make_macros.inc +++ b/doc/ref_make_macros.inc @@ -97,6 +97,21 @@ The same for all other macros. These are the default build commands for the corresponding stages. For more details see the documentation of the default stages below. +extract +~~~ + +Usage: + +.. code-block:: make + + $(call extract, ) + +Extract a source archive into a directory. +The source archive to unpack is taken from the ``_SOURCE`` variable, +and the directory to unpack to is taken from the ``_DIR`` variable. +This macro doesn't do anything if ``_URL`` points to a local directory +instead of an archive or online URL. + compile ~~~ -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 2/2] doc: ref_make_macros: improve language, typos and markup
The literal blocks don't need to be code-blocks, as there is no code to be highlighted. Turn down the inline markup to make the text better readable. A technical term doesn't need to be emphasized every time it occurs. Use semantic newlines where applicable. Signed-off-by: Roland Hieber --- doc/ref_make_macros.inc | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/doc/ref_make_macros.inc b/doc/ref_make_macros.inc index 749cf31edf66..5bef79f44d00 100644 --- a/doc/ref_make_macros.inc +++ b/doc/ref_make_macros.inc @@ -44,11 +44,9 @@ Usage: $(call targetinfo) -Gives a feedback, what build *stage* is just started. That's why it -should always be the first call for each *stage*. For the package -*foo* and the *compile stage* it will output: - -.. code-block:: bash +Gives the user feedback about which build stage has just started. +That's why it should always be the first call for each stage. +For the package *foo* and the *compile* stage, this macro will output:: target: foo.compile @@ -63,11 +61,9 @@ Usage: $(call touch) -Gives a feedback, what build *stage* is just finished. That's why it -should always be the last call for each *stage*. For the package -*foo* and the *compile stage* it will output: - -.. code-block:: bash +Gives the user feedback about which build stage has just finished. +That's why it should always be the last call for each stage. +For the package *foo* and the *compile* stage, this macro will output:: finished target foo.compile @@ -123,7 +119,7 @@ Usage: This macro is very similar to ``world/compile``. The only differences is that is uses the specified ``build arguments`` instead of -``_MAKE_OPT``. This is usefull if ``make`` needs to be called more +``_MAKE_OPT``. This is useful if ``make`` needs to be called more than once in the compile stage. world/execute, execute -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH v1 2/2] pre/barebox: barebox-opts doesn't need any parameters
$(1) is never used in the barebox/opts macro, so barebox-opts doesn't need to pass it around. Also adjust the package template accordingly. Signed-off-by: Roland Hieber --- rules/pre/barebox.make| 2 +- rules/templates/template-barebox-make | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/pre/barebox.make b/rules/pre/barebox.make index 7875442cf935..bc7fe4340f87 100644 --- a/rules/pre/barebox.make +++ b/rules/pre/barebox.make @@ -12,17 +12,17 @@ barebox/opts = \ $(PARALLELMFLAGS) \ V=$(PTXDIST_VERBOSE) \ HOSTCC=$(HOSTCC) \ ARCH=$(PTXCONF_BAREBOX_ARCH_STRING) \ CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) barebox-opts = \ - $(call barebox/opts,$(strip $(1))) + $(call barebox/opts) barebox/url = \ http://www.barebox.org/download/barebox-$($(1)_VERSION).$($(1)_SUFFIX) barebox-url = \ $(call barebox/url,$(strip $(1))) # vim: syntax=make diff --git a/rules/templates/template-barebox-make b/rules/templates/template-barebox-make index 7493b849b6ab..4ada3c20bf00 100644 --- a/rules/templates/template-barebox-make +++ b/rules/templates/template-barebox-make @@ -36,17 +36,17 @@ BAREBOX_@PACKAGE@_PATH := PATH=$(HOST_PATH) BAREBOX_@PACKAGE@_WRAPPER_BLACKLIST := \ TARGET_HARDEN_STACKCLASH \ TARGET_HARDEN_RELRO \ TARGET_HARDEN_BINDNOW \ TARGET_HARDEN_PIE \ TARGET_DEBUG \ TARGET_BUILD_ID -BAREBOX_@PACKAGE@_CONF_OPT := $(call barebox-opts, BAREBOX_@PACKAGE@) +BAREBOX_@PACKAGE@_CONF_OPT := $(call barebox-opts) BAREBOX_@PACKAGE@_MAKE_OPT := $(BAREBOX_@PACKAGE@_CONF_OPT) BAREBOX_@PACKAGE@_IMAGES := @image@ BAREBOX_@PACKAGE@_IMAGES := $(addprefix $(BAREBOX_@PACKAGE@_DIR)/,$(BAREBOX_@PACKAGE@_IMAGES)) ifdef PTXCONF_BAREBOX_@PACKAGE@ $(BAREBOX_@PACKAGE@_CONFIG): @echo -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH v1 1/2] pre/barebox: only use _VERSION to build the URL
When adding another barebox package to a BSP, e.g. named barebox-foo, the BAREBOX_FOO variable will contain "barebox-foo-$(VERSION)". This variable is used to build BAREBOX_DIR, BAREBOX_SOURCE, and BAREBOX_FOO_URL. We must to keep the customized package postfix in the build directory, but in the latter case, the -foo postfix is transferred into the URL, which will lead to errors while downloading the source. We actually only need the barebox version to download the source tarball, so use a static "barebox-" string to build the barebox/url macro and also the BAREBOX_FOO_SOURCE variable in the package template, so the same tarball isn't downloaded multiple times with different names. Signed-off-by: Roland Hieber --- rules/pre/barebox.make| 2 +- rules/templates/template-barebox-make | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/pre/barebox.make b/rules/pre/barebox.make index 09fb400b72b2..7875442cf935 100644 --- a/rules/pre/barebox.make +++ b/rules/pre/barebox.make @@ -15,14 +15,14 @@ barebox/opts = \ HOSTCC=$(HOSTCC) \ ARCH=$(PTXCONF_BAREBOX_ARCH_STRING) \ CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) barebox-opts = \ $(call barebox/opts,$(strip $(1))) barebox/url = \ - http://www.barebox.org/download/$($(1)).$($(1)_SUFFIX) + http://www.barebox.org/download/barebox-$($(1)_VERSION).$($(1)_SUFFIX) barebox-url = \ $(call barebox/url,$(strip $(1))) # vim: syntax=make diff --git a/rules/templates/template-barebox-make b/rules/templates/template-barebox-make index 282de8846022..7493b849b6ab 100644 --- a/rules/templates/template-barebox-make +++ b/rules/templates/template-barebox-make @@ -19,17 +19,17 @@ PACKAGES-$(PTXCONF_BAREBOX_@PACKAGE@) += barebox-@package@ BAREBOX_@PACKAGE@_VERSION := @VERSION@ BAREBOX_@PACKAGE@_MD5 := BAREBOX_@PACKAGE@ := barebox-$(BAREBOX_@PACKAGE@_VERSION) BAREBOX_@PACKAGE@_SUFFIX := tar.bz2 BAREBOX_@PACKAGE@_DIR := $(BUILDDIR)/barebox-@package@-$(BAREBOX_@PACKAGE@_VERSION) BAREBOX_@PACKAGE@_CONFIG := $(call ptx/in-platformconfigdir, barebox-@package@.config.$(BAREBOX_@PACKAGE@_VERSION)) BAREBOX_@PACKAGE@_LICENSE := GPL-2.0-only BAREBOX_@PACKAGE@_URL := $(call barebox-url, BAREBOX_@PACKAGE@) -BAREBOX_@PACKAGE@_SOURCE := $(SRCDIR)/$(BAREBOX_@PACKAGE@).$(BAREBOX_@PACKAGE@_SUFFIX) +BAREBOX_@PACKAGE@_SOURCE := $(SRCDIR)/barebox-$(BAREBOX_@PACKAGE@_VERSION).$(BAREBOX_@PACKAGE@_SUFFIX) # # Prepare # # use host pkg-config for host tools BAREBOX_@PACKAGE@_PATH := PATH=$(HOST_PATH) -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 12/20] polkit: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- rules/polkit.in | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/polkit.in b/rules/polkit.in index ef7b1fae2..97b81e0c8 100644 --- a/rules/polkit.in +++ b/rules/polkit.in @@ -10,12 +10,16 @@ menuconfig POLKIT select GLIB select DBUS_GLIB select EGGDBUS - select SYSTEMD if POLKIT_SYSTEMD - select SYSTEMD_LOGIND if POLKIT_SYSTEMD + select SYSTEMD if POLKIT_SYSTEMD + select SYSTEMD_LOGIND if POLKIT_SYSTEMD + select ROOTFS_VAR_LIB if RUNTIME help PolicyKit offers an infrastructure for security policies for dbus applications. + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' for its run-time information. + if POLKIT config POLKIT_SYSTEMD -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 03/20] rootfs: '/var' is a mandatory directory according to FHS
Signed-off-by: Juergen Borleis --- rules/fake-overlayfs.in| 4 rules/initmethod-bbinit.in | 1 - rules/rootfs.in| 12 ++-- rules/rootfs.make | 2 -- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/rules/fake-overlayfs.in b/rules/fake-overlayfs.in index c328bc0fb..2469ddfad 100644 --- a/rules/fake-overlayfs.in +++ b/rules/fake-overlayfs.in @@ -18,23 +18,19 @@ comment "Copy the content of these directories" config FAKE_OVERLAYFS_VAR bool "/var" - select ROOTFS_VAR if ROOTFS if !FAKE_OVERLAYFS_VAR config FAKE_OVERLAYFS_VAR_LIB bool "/var/lib" - select ROOTFS_VAR if ROOTFS select ROOTFS_VAR_LIB if ROOTFS config FAKE_OVERLAYFS_VAR_TMP bool "/var/tmp" - select ROOTFS_VAR if ROOTFS select ROOTFS_VAR_TMP if ROOTFS config FAKE_OVERLAYFS_VAR_CACHE bool "/var/cache" - select ROOTFS_VAR if ROOTFS select ROOTFS_VAR_CACHE if ROOTFS endif diff --git a/rules/initmethod-bbinit.in b/rules/initmethod-bbinit.in index 383add59f..e0b3be178 100644 --- a/rules/initmethod-bbinit.in +++ b/rules/initmethod-bbinit.in @@ -33,7 +33,6 @@ config INITMETHOD_BBINIT_ETC_INITD_NETWORKING config INITMETHOD_BBINIT_ETC_INITD_RT_SET_BANDWIDTH bool prompt "install /etc/init.d/rt-set-bandwidth" - select ROOTFS_VAR select ROOTFS_VAR_RUN default y help diff --git a/rules/rootfs.in b/rules/rootfs.in index d844f825e..3ea4bde60 100644 --- a/rules/rootfs.in +++ b/rules/rootfs.in @@ -169,15 +169,7 @@ config ROOTFS_TMP Create a /tmp directory in the root filesystem. You should say yes here. -config ROOTFS_VAR - bool - prompt "/var" - default y - help - Create a /var directory in the root filesystem. - You should say yes here. - -if ROOTFS_VAR +menu "/var" config ROOTFS_VAR_OVERLAYFS bool @@ -256,7 +248,7 @@ config ROOTFS_VAR_TMP system reboots. Say 'y' here to ensure a '/var/tmp' directory is available at run-time. -endif # ROOTFS_VAR +endmenu endif # ROOTFS # diff --git a/rules/rootfs.make b/rules/rootfs.make index 8f0c61f52..8183d0288 100644 --- a/rules/rootfs.make +++ b/rules/rootfs.make @@ -96,9 +96,7 @@ endif ifdef PTXCONF_ROOTFS_TMP @$(call install_copy, rootfs, 0, 0, 1777, /tmp) endif -ifdef PTXCONF_ROOTFS_VAR @$(call install_copy, rootfs, 0, 0, 0755, /var) -endif ifdef PTXCONF_ROOTFS_VAR_LOG @$(call install_copy, rootfs, 0, 0, 0755, /var/log) endif -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 20/20] Update and sync autotools based package templates
Signed-off-by: Juergen Borleis --- rules/templates/src-autoconf-lib/Makefile.am | 2 +- rules/templates/src-autoconf-lib/configure.ac | 35 +-- rules/templates/src-autoconf-prog/Makefile.am | 3 +- .../templates/src-autoconf-prog/configure.ac | 110 +++- .../src-autoconf-proglib/Makefile.am | 2 +- .../src-autoconf-proglib/configure.ac | 100 ++- .../template-m4-macros/attributes.m4 | 2 +- .../template-m4-macros/ax_armv7_detection.m4 | 8 +- ...mv4_detection.m4 => ax_armv8_detection.m4} | 60 ++-- rules/templates/template-m4-macros/pkg.m4 | 256 +- rules/templates/template-src-autoconf-make| 37 +-- 11 files changed, 448 insertions(+), 167 deletions(-) rename rules/templates/template-m4-macros/{ax_armv4_detection.m4 => ax_armv8_detection.m4} (62%) diff --git a/rules/templates/src-autoconf-lib/Makefile.am b/rules/templates/src-autoconf-lib/Makefile.am index ae223891a..771b45454 100644 --- a/rules/templates/src-autoconf-lib/Makefile.am +++ b/rules/templates/src-autoconf-lib/Makefile.am @@ -28,10 +28,10 @@ EXTRA_DIST = \ autogen.sh \ m4/attributes.m4 \ m4/ptx.m4 \ - m4/ax_armv4_detection.m4 \ m4/ax_armv5_detection.m4 \ m4/ax_armv6_detection.m4 \ m4/ax_armv7_detection.m4 \ + m4/ax_armv8_detection.m4 \ m4/ax_floating_point.m4 \ m4/ax_code_coverage.m4 \ m4/pkg.m4 \ diff --git a/rules/templates/src-autoconf-lib/configure.ac b/rules/templates/src-autoconf-lib/configure.ac index 24d0cb189..f062e6be5 100644 --- a/rules/templates/src-autoconf-lib/configure.ac +++ b/rules/templates/src-autoconf-lib/configure.ac @@ -14,9 +14,15 @@ AM_SILENT_RULES([yes]) # TODO If you don't want the default installation path to be '/usr/local' change it here # AC_PREFIX_DEFAULT() -# TODO If possible, enable extensions to Posix +# If possible, enable extensions to Posix AC_USE_SYSTEM_EXTENSIONS +# support LFS +AC_SYS_LARGEFILE + +AM_MAINTAINER_MODE +AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules subdir-objects]) + # # libtool library versioning stuff # @@ -31,13 +37,10 @@ AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) -AM_MAINTAINER_MODE -AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules subdir-objects]) - # # Checks for programs. # -AC_PROG_CC +AC_PROG_CC_C99 # # TODO to only build the static library uncomment the following line @@ -120,15 +123,16 @@ PTX_LIBRARY_CHECKS # specific architectures. #AS_IF([test x${host_cpu} = "xarm"], -# [AX_DETECT_ARMV4([enable_arm4=yes], [enable_arm4=no]) -# AX_DETECT_ARMV5([enable_arm5=yes], [enable_arm5=no]) +# [AX_DETECT_ARMV5([enable_arm5=yes], [enable_arm5=no]) # AX_DETECT_ARMV6([enable_arm6=yes], [enable_arm6=no]) # AX_DETECT_ARMV7([enable_arm7=yes], [enable_arm7=no]) +# AX_DETECT_ARMV8([enable_arm8=yes], [enable_arm8=no]) # # AS_IF([test x${enable_arm4} = "xyes"], [AC_MSG_NOTICE([ARMv4 target])]) # AS_IF([test x${enable_arm5} = "xyes"], [AC_MSG_NOTICE([ARMv5 target])]) # AS_IF([test x${enable_arm6} = "xyes"], [AC_MSG_NOTICE([ARMv6 target])]) -# AS_IF([test x${enable_arm7} = "xyes"], [AC_MSG_NOTICE([ARMv7 target])])]) +# AS_IF([test x${enable_arm7} = "xyes"], [AC_MSG_NOTICE([ARMv7 target])]) +# AS_IF([test x${enable_arm8} = "xyes"], [AC_MSG_NOTICE([ARMv8 target])])]) # -- use all the settings @@ -177,14 +181,17 @@ AC_MSG_RESULT([ Target CPU:${host_cpu} Target OS: ${host_os} - Detected options: + User options: -- -CPPFLAGS: ${CPPFLAGS} CFLAGS:${CFLAGS} +CPPFLAGS: ${CPPFLAGS} LDFLAGS: ${LDFLAGS} + + Detected options: + -- Debug: ${enable_debug} Hidden symbols ${enable_hide} -Coverage: ${enable_coverage} +Coverage: ${enable_code_coverage} CPPFLAGS: ${CODE_COVERAGE_CPPFLAGS} CFLAGS: ${CODE_COVERAGE_CFLAGS} LDFLAGS:${CODE_COVERAGE_LDFLAGS} @@ -193,12 +200,6 @@ AC_MSG_RESULT([ Private libs: ${LIBS} Use abort(): ${enable_abort} - User options: - -- -CFLAGS:${CFLAGS} -CPPFLAGS: ${CPPFLAGS} -LDFLAGS: ${LDFLAGS} - Install options: -- prefix:${prefix} diff --git a/rules/templates/src-autoconf-prog/Makefile.am b/rules/templates/src-autoconf-prog/Makefile.am index 3b0782dac..2a197076b 100644 ---
[ptxdist] [PATCH 15/20] systemd: adapt package's '/var/lib' and '/var/cache' requirements
Signed-off-by: Juergen Borleis --- rules/systemd.in | 5 + 1 file changed, 5 insertions(+) diff --git a/rules/systemd.in b/rules/systemd.in index c6b8848f4..5ce43b99c 100644 --- a/rules/systemd.in +++ b/rules/systemd.in @@ -30,6 +30,8 @@ menuconfig SYSTEMD select ROOTFS_DEV select LIBBLKID select HOST_SYSTEMD if SYSTEMD_UDEV_HWDB + select ROOTFS_VAR_LIB if RUNTIME + select ROOTFS_VAR_CACHE if RUNTIME prompt "systemd " help systemd is a system and session manager for Linux, compatible with SysV @@ -43,6 +45,9 @@ menuconfig SYSTEMD http://www.freedesktop.org/wiki/Software/systemd + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' and '/var/cache' for its run-time information. + if SYSTEMD comment "D-Bus is needed for the enabled features" -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 05/20] networkmanager: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- .../usr/lib/systemd/system/NetworkManager-unmanage.service| 1 + projectroot/usr/lib/systemd/system/NetworkManager.service | 1 + rules/networkmanager.in | 4 3 files changed, 6 insertions(+) diff --git a/projectroot/usr/lib/systemd/system/NetworkManager-unmanage.service b/projectroot/usr/lib/systemd/system/NetworkManager-unmanage.service index 180af2992..fd11686ba 100644 --- a/projectroot/usr/lib/systemd/system/NetworkManager-unmanage.service +++ b/projectroot/usr/lib/systemd/system/NetworkManager-unmanage.service @@ -7,6 +7,7 @@ ConditionPathExists=!/var/run/NetworkManager.conf [Service] Type=oneshot ExecStart=/usr/lib/init/nm-unmanage.sh +StateDirectory=NetworkManager [Install] WantedBy=NetworkManager.service diff --git a/projectroot/usr/lib/systemd/system/NetworkManager.service b/projectroot/usr/lib/systemd/system/NetworkManager.service index 7c56d8e24..45973692d 100644 --- a/projectroot/usr/lib/systemd/system/NetworkManager.service +++ b/projectroot/usr/lib/systemd/system/NetworkManager.service @@ -21,6 +21,7 @@ CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_NET_BIND_SE ProtectSystem=true ProtectHome=read-only +StateDirectory=NetworkManager [Install] WantedBy=multi-user.target diff --git a/rules/networkmanager.in b/rules/networkmanager.in index 26e9fff9d..e966aa2c7 100644 --- a/rules/networkmanager.in +++ b/rules/networkmanager.in @@ -26,6 +26,7 @@ menuconfig NETWORKMANAGER select UDEV_LIBUDEV select WPA_SUPPLICANT if NETWORKMANAGER_WIRELESS && RUNTIME select WPA_SUPPLICANT_CTRL_IFACE_DBUS if NETWORKMANAGER_WIRELESS && RUNTIME + select ROOTFS_VAR_LIB if RUNTIME prompt "networkmanager" help NetworkManager is a tool to automate network configuration as far as @@ -33,6 +34,9 @@ menuconfig NETWORKMANAGER http://projects.gnome.org/NetworkManager/ + Note: on a read-only root filesystem this package still requires a + writable '/var/lib'. + if NETWORKMANAGER config NETWORKMANAGER_STARTSCRIPT -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 06/20] ntp: adapt package's '/var/lib' and '/var/log' requirements
Signed-off-by: Juergen Borleis --- projectroot/usr/lib/systemd/system/ntpd.service | 2 ++ rules/ntp.in| 5 + rules/ntp.make | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projectroot/usr/lib/systemd/system/ntpd.service b/projectroot/usr/lib/systemd/system/ntpd.service index 64fce1cb7..917456339 100644 --- a/projectroot/usr/lib/systemd/system/ntpd.service +++ b/projectroot/usr/lib/systemd/system/ntpd.service @@ -3,6 +3,8 @@ Description=ntpd [Service] ExecStart=/usr/sbin/ntpd -n -c /etc/ntp-server.conf +StateDirectory=ntp +LogsDirectory=ntpstats [Install] WantedBy=multi-user.target diff --git a/rules/ntp.in b/rules/ntp.in index c211c91cd..55bf38b94 100644 --- a/rules/ntp.in +++ b/rules/ntp.in @@ -10,10 +10,15 @@ menuconfig NTP select LIBC_M select LIBC_RT select GCCLIBS_GCC_S + select ROOTFS_VAR_LIB if RUNTIME + select ROOTFS_VAR_LOG if RUNTIME help Build the standard NTP Daemon Process and supplementary programs. This conflicts with BSD openntpd. + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' and '/var/log'. + # - Compile Options if NTP diff --git a/rules/ntp.make b/rules/ntp.make index 5d51ae4fc..411ad2ecf 100644 --- a/rules/ntp.make +++ b/rules/ntp.make @@ -160,7 +160,7 @@ $(STATEDIR)/ntp.targetinstall: @$(call install_fixup, ntp,PRIORITY,optional) @$(call install_fixup, ntp,SECTION,base) @$(call install_fixup, ntp,AUTHOR,"Robert Schwebel") - @$(call install_fixup, ntp,DESCRIPTION,missing) + @$(call install_fixup, ntp,DESCRIPTION, "Network Time Protocol Daemon") # # # # ntpdate -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 10/20] mariadb: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- projectroot/usr/lib/systemd/system/mariadb-init.service | 2 +- projectroot/usr/lib/systemd/system/mariadb.service | 1 + rules/mariadb.in| 4 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projectroot/usr/lib/systemd/system/mariadb-init.service b/projectroot/usr/lib/systemd/system/mariadb-init.service index af18afa0a..71e37b658 100644 --- a/projectroot/usr/lib/systemd/system/mariadb-init.service +++ b/projectroot/usr/lib/systemd/system/mariadb-init.service @@ -21,7 +21,6 @@ [Unit] Description=MariaDB Server Initialization Service -RequiresMountsFor=/var/lib/mysql ConditionPathExists=!/var/lib/mysql/data [Service] @@ -29,6 +28,7 @@ User=root Group=root Type=oneshot RemainAfterExit=yes +StateDirectory=mysql ExecStart=/bin/chown -R mysql:mysql /var/lib/mysql ExecStart=/bin/chmod 0755 /var/lib/mysql diff --git a/projectroot/usr/lib/systemd/system/mariadb.service b/projectroot/usr/lib/systemd/system/mariadb.service index 120bfefe6..5d00d9119 100644 --- a/projectroot/usr/lib/systemd/system/mariadb.service +++ b/projectroot/usr/lib/systemd/system/mariadb.service @@ -7,6 +7,7 @@ After=mariadb-init.service User=mysql Group=mysql PrivateDevices=true +StateDirectory=mysql ExecStart=/usr/bin/mysqld diff --git a/rules/mariadb.in b/rules/mariadb.in index b2127ea34..06cf4b9ad 100644 --- a/rules/mariadb.in +++ b/rules/mariadb.in @@ -16,10 +16,14 @@ config MARIADB select NCURSES select SYSTEMD if MARIADB_SYSTEMD select ZLIB + select ROOTFS_VAR_LIB if RUNTIME prompt "mariadb" if ALLYES help MariaDB, a SQL database engine + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' for the database. + if MARIADB config MARIADB_SYSTEMD -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 09/20] dnsmasq: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- projectroot/usr/lib/systemd/system/dnsmasq.service | 2 ++ rules/dnsmasq.in | 9 ++--- rules/dnsmasq.make | 5 +++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/projectroot/usr/lib/systemd/system/dnsmasq.service b/projectroot/usr/lib/systemd/system/dnsmasq.service index c663e018c..2da3a7250 100644 --- a/projectroot/usr/lib/systemd/system/dnsmasq.service +++ b/projectroot/usr/lib/systemd/system/dnsmasq.service @@ -6,6 +6,8 @@ ExecStart=/usr/sbin/dnsmasq --pid-file=/run/dnsmasq.pid ExecReload=/bin/kill -HUP $MAINPID Type=forking PIDFile=/run/dnsmasq.pid +# for the 'dnsmasq.leases' file +StateDirectory=misc [Install] WantedBy=network.target diff --git a/rules/dnsmasq.in b/rules/dnsmasq.in index 65f68f738..aec63dd0f 100644 --- a/rules/dnsmasq.in +++ b/rules/dnsmasq.in @@ -5,9 +5,9 @@ menuconfig DNSMASQ tristate prompt "dnsmasq " - select DBUS if DNSMASQ_DBUS - select LUA if DNSMASQ_SCRIPT_LUA - select ROOTFS_VAR_LIB + select DBUS if DNSMASQ_DBUS + select LUA if DNSMASQ_SCRIPT_LUA + select ROOTFS_VAR_LIB if DNSMASQ_DHCP && RUNTIME help A small caching DNS proxy and DHCP server. @@ -23,6 +23,9 @@ menuconfig DNSMASQ Note: In order to make dnsmasq work as DHCP, you have to enable the following kernel features: FIXME + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' for its leases database (DHCP feature enabled). + if DNSMASQ comment "build options ---" diff --git a/rules/dnsmasq.make b/rules/dnsmasq.make index 861936329..d9a134cdf 100644 --- a/rules/dnsmasq.make +++ b/rules/dnsmasq.make @@ -104,9 +104,10 @@ endif @$(call install_alternative, dnsmasq, 0, 0, 0644, /etc/dnsmasq.conf) -# for the 'dnsmasq.leases' file +ifdef PTXCONF_DNSMASQ_DHCP +# # for the 'dnsmasq.leases' file @$(call install_copy, dnsmasq, 0, 0, 0755, /var/lib/misc) - +endif @$(call install_finish, dnsmasq) @$(call touch) -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 19/20] dbus: adapt run-time socket path
'dbus' defaults to '/var/run' to establish its socket and thus, 'systemd' complains: /usr/lib/systemd/system/dbus.socket:4: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly. This change let the socket now defaults to '/run' instead. Signed-off-by: Juergen Borleis --- rules/dbus.make | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/dbus.make b/rules/dbus.make index 1458df957..da2135aef 100644 --- a/rules/dbus.make +++ b/rules/dbus.make @@ -42,6 +42,7 @@ DBUS_CONF_ENV := \ DBUS_CONF_TOOL := autoconf DBUS_CONF_OPT := \ $(CROSS_AUTOCONF_USR) \ + --runstatedir=/run \ --enable-silent-rules \ --disable-developer \ --disable-debug \ @@ -74,6 +75,7 @@ DBUS_CONF_OPT := \ --disable-relocation \ --disable-stats \ --$(call ptx/endis, PTXCONF_DBUS_SYSTEMD)-user-session \ + --with-system-socket=/run/dbus/system_bus_socket \ --with-dbus-user=messagebus \ --without-valgrind \ --$(call ptx/wwo, PTXCONF_DBUS_X)-x$(call ptx/ifdef,PTXCONF_DBUS_X,=$(SYSROOT)/usr,) \ -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 04/20] conman: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- projectroot/usr/lib/systemd/system/connman-ignore.service | 1 + projectroot/usr/lib/systemd/system/connman.service| 1 + rules/connman.in | 3 ++- rules/connman.make| 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projectroot/usr/lib/systemd/system/connman-ignore.service b/projectroot/usr/lib/systemd/system/connman-ignore.service index b31df07fb..df52faaed 100644 --- a/projectroot/usr/lib/systemd/system/connman-ignore.service +++ b/projectroot/usr/lib/systemd/system/connman-ignore.service @@ -7,6 +7,7 @@ ConditionPathExists=!/run/connman-ignore Type=oneshot RemainAfterExit=yes ExecStart=/usr/lib/systemd/connman-ignore +StateDirectory=conman [Install] WantedBy=connman.service diff --git a/projectroot/usr/lib/systemd/system/connman.service b/projectroot/usr/lib/systemd/system/connman.service index 4353276b5..c7fc639d6 100644 --- a/projectroot/usr/lib/systemd/system/connman.service +++ b/projectroot/usr/lib/systemd/system/connman.service @@ -10,6 +10,7 @@ Restart=on-failure EnvironmentFile=-/run/connman-ignore ExecStart=/usr/sbin/connmand -n $CONNMAN_IGNORE_OPTS StandardOutput=null +StateDirectory=conman [Install] WantedBy=multi-user.target diff --git a/rules/connman.in b/rules/connman.in index 9d4b1dbd3..3c2eb11a0 100644 --- a/rules/connman.in +++ b/rules/connman.in @@ -13,7 +13,8 @@ menuconfig CONNMAN select DBUS_PYTHON if CONNMAN_TESTS && RUNTIME select WPA_SUPPLICANT if CONNMAN_WIFI && RUNTIME select WPA_SUPPLICANT_CTRL_IFACE_DBUS if CONNMAN_WIFI - select BUSYBOX_START_STOP_DAEMONif CONNMAN_STARTSCRIPT + select BUSYBOX_START_STOP_DAEMONif CONNMAN_STARTSCRIPT && RUNTIME + select ROOTFS_VAR_LIB if RUNTIME prompt "connman " help The Connection Manager project provides a daemon for diff --git a/rules/connman.make b/rules/connman.make index 2f671f7d4..313098d1c 100644 --- a/rules/connman.make +++ b/rules/connman.make @@ -167,6 +167,7 @@ ifdef PTXCONF_CONNMAN_POLKIT endif # # ship settings which enable wired interfaces per default + @$(call install_copy, connman, 0, 0, 0755, /var/lib/connman) @$(call install_alternative, connman, 0, 0, 0600, \ /var/lib/connman/settings) -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 14/20] logrotate: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- projectroot/usr/lib/systemd/system/logrotate.service | 1 + rules/logrotate.in | 4 2 files changed, 5 insertions(+) diff --git a/projectroot/usr/lib/systemd/system/logrotate.service b/projectroot/usr/lib/systemd/system/logrotate.service index 722eb85de..40f2a7608 100644 --- a/projectroot/usr/lib/systemd/system/logrotate.service +++ b/projectroot/usr/lib/systemd/system/logrotate.service @@ -2,4 +2,5 @@ Description=logrotate [Service] +StateDirectory=logrotate ExecStart=/usr/sbin/logrotate /etc/logrotate.conf diff --git a/rules/logrotate.in b/rules/logrotate.in index 202dee573..097804017 100644 --- a/rules/logrotate.in +++ b/rules/logrotate.in @@ -5,6 +5,7 @@ menuconfig LOGROTATE prompt "logrotate " select LIBPOPT select ACL if LOGROTATE_ACL + select ROOTFS_VAR_LIB if RUNTIME help The logrotate utility is designed to simplify the administration of log files on a system which generates a lot @@ -14,6 +15,9 @@ menuconfig LOGROTATE log file gets to a certain size. Normally, logrotate runs as a daily cron job. + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' for its run-time information. + if LOGROTATE config LOGROTATE_ACL -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 13/20] nfsutils: adapt package's '/var/lib' requirements
Signed-off-by: Juergen Borleis --- rules/nfsutils.in | 12 +--- rules/nfsutils.make | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rules/nfsutils.in b/rules/nfsutils.in index bd1052ebb..ed62b6d08 100644 --- a/rules/nfsutils.in +++ b/rules/nfsutils.in @@ -9,11 +9,15 @@ menuconfig NFSUTILS select RPCBIND if RUNTIME select LIBTIRPC if GLOBAL_IPV6 select ROOTFS_PROTOCOLS if NFSUTILS_CLIENT + select ROOTFS_VAR_LIB if RUNTIME + select SYSTEMD if RUNTIME && NFSUTILS_SYSTEMD_UNIT help The Sun Network Filesystem (NFS) protocol provides transparent remote access to shared files across networks. The NFS protocol is designed to be portable across different machines, operating systems, network architectures, and transport protocols. + Note: this package expects write permissions to '/var/lib/nfs' for + its state information. if NFSUTILS @@ -27,18 +31,20 @@ config NFSUTILS_SERVER bool prompt "server" help - Install all tools and daemons to run a NFS server. + Install all tools and daemons to run an NFS server. config NFSUTILS_NFSD_STARTSCRIPT bool - depends on NFSUTILS_SERVER + depends on NFSUTILS_SERVER && !INITMETHOD_SYSTEMD default y prompt "install /etc/init.d/nfsd" config NFSUTILS_SYSTEMD_UNIT bool default y - depends on SYSTEMD + depends on INITMETHOD_SYSTEMD prompt "install systemd unit files" + help + Install all systemd related unit files to run the 'nfsutils'. endif diff --git a/rules/nfsutils.make b/rules/nfsutils.make index 929f53c72..4ce01c4e3 100644 --- a/rules/nfsutils.make +++ b/rules/nfsutils.make @@ -76,7 +76,7 @@ $(STATEDIR)/nfsutils.targetinstall: @$(call install_fixup, nfsutils,PRIORITY,optional) @$(call install_fixup, nfsutils,SECTION,base) @$(call install_fixup, nfsutils,AUTHOR,"Robert Schwebel ") - @$(call install_fixup, nfsutils,DESCRIPTION,missing) + @$(call install_fixup, nfsutils,DESCRIPTION,"Network Filesystem Support") @$(call install_copy, nfsutils, 0, 0, 0755, -, /usr/sbin/nfsstat) @$(call install_copy, nfsutils, 0, 0, 0755, -, /usr/sbin/nfsiostat) -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 08/20] dnsmasq: clean up rule file
The 'n' feature is autodetected in the meantime... Signed-off-by: Juergen Borleis --- rules/dnsmasq.make | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/dnsmasq.make b/rules/dnsmasq.make index 113392f02..861936329 100644 --- a/rules/dnsmasq.make +++ b/rules/dnsmasq.make @@ -81,12 +81,12 @@ $(STATEDIR)/dnsmasq.targetinstall: @$(call install_copy, dnsmasq, 0, 0, 0755, -, /usr/sbin/dnsmasq) ifdef PTXCONF_DNSMASQ_INETD - @$(call install_alternative, dnsmasq, 0, 0, 0644, /etc/inetd.conf.d/dnsmasq, n) + @$(call install_alternative, dnsmasq, 0, 0, 0644, /etc/inetd.conf.d/dnsmasq) endif ifdef PTXCONF_INITMETHOD_BBINIT ifdef PTXCONF_DNSMASQ_STARTSCRIPT - @$(call install_alternative, dnsmasq, 0, 0, 0755, /etc/init.d/dnsmasq, n) + @$(call install_alternative, dnsmasq, 0, 0, 0755, /etc/init.d/dnsmasq) ifneq ($(call remove_quotes,$(PTXCONF_DNSMASQ_BBINIT_LINK)),) @$(call install_link, dnsmasq, \ @@ -102,7 +102,7 @@ ifdef PTXCONF_DNSMASQ_SYSTEMD_UNIT /usr/lib/systemd/system/network.target.wants/dnsmasq.service) endif - @$(call install_alternative, dnsmasq, 0, 0, 0644, /etc/dnsmasq.conf, n) + @$(call install_alternative, dnsmasq, 0, 0, 0644, /etc/dnsmasq.conf) # for the 'dnsmasq.leases' file @$(call install_copy, dnsmasq, 0, 0, 0755, /var/lib/misc) -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 16/20] sysstat: adapt package's '/var/log' requirements
Signed-off-by: Juergen Borleis --- rules/sysstat.in | 4 1 file changed, 4 insertions(+) diff --git a/rules/sysstat.in b/rules/sysstat.in index 2c6e02d85..ff1f152df 100644 --- a/rules/sysstat.in +++ b/rules/sysstat.in @@ -4,6 +4,7 @@ config SYSSTAT tristate prompt "sysstat" select GCCLIBS_GCC_S + select ROOTFS_VAR_LOG if RUNTIME help sar, iostat and mpstat - system performance tools for Linux @@ -23,3 +24,6 @@ config SYSSTAT others. Both UP and SMP machines are fully supported. Homepage: http://pagesperso-orange.fr/sebastien.godard/ + + Note: on a read-only root filesystem this package still requires a + writable '/var/log'. -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 18/20] opkg: move opkg-database to a read-only location
The directory tree in '/var/lib' might not be persistent and thus, not in sync with the root filesystem. In this case it's required to store the opkg database at a location which has a fixed relation to the root filesystem's content it describes. This change moves the opkg's database to a read-only location in '/usr/share/opkg', which is then always in sync with the root filesystem's content. This changed opkg configuration works since commit a691341deb33077b9d5ede5fe349ee6b3fb99be1 "ptxd_make_image_extract_xpkg_files: use ptxd_get_alternative to find opkg.conf" Signed-off-by: Juergen Borleis --- doc/daily_work.inc | 3 +-- projectroot/etc/opkg/opkg.conf | 7 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/daily_work.inc b/doc/daily_work.inc index 470c14f93..58cf69f49 100644 --- a/doc/daily_work.inc +++ b/doc/daily_work.inc @@ -1426,8 +1426,7 @@ This is a very simple and optimistic approach and works for surprisingly many us cases. But some applications expect a writable ``/var/lib`` and will fail due to this setup. Using an additional RAM disk for ``/var/lib`` might not help in this use case, because it will bury all build-time generated data already present -in this directory tree (``opkg`` package information for example or other -packages pre-defined configuration files). +in this directory tree (package pre-defined configuration files for example). Overlay RAM Disk diff --git a/projectroot/etc/opkg/opkg.conf b/projectroot/etc/opkg/opkg.conf index 3ba17115b..67a64838f 100644 --- a/projectroot/etc/opkg/opkg.conf +++ b/projectroot/etc/opkg/opkg.conf @@ -6,7 +6,12 @@ @SRC@ dest root/ -option lock_file /var/lock/opkg.lock +option lock_file /run/lock/opkg.lock + +# move away the ipkg database from the default "/var/lib/opkg" to a r/o location +option lists_dir /usr/share/opkg/lists +option status_file /usr/share/opkg/status +option info_dir /usr/share/opkg/info arch @ARCH@ 10 arch all 1 -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 02/20] rootfs: keep '/var/tmp' permissions in sync with 'systemd'
This avoids 'systemd' warnings at run-time if a read-only filesystem is in use. Signed-off-by: Juergen Borleis --- rules/rootfs.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rootfs.make b/rules/rootfs.make index 21250e775..8f0c61f52 100644 --- a/rules/rootfs.make +++ b/rules/rootfs.make @@ -121,7 +121,7 @@ ifdef PTXCONF_ROOTFS_VAR_SPOOL_CRON @$(call install_copy, rootfs, 0, 0, 0755, /var/spool/cron) endif ifdef PTXCONF_ROOTFS_VAR_TMP - @$(call install_copy, rootfs, 0, 0, 0755, /var/tmp) + @$(call install_copy, rootfs, 0, 0, 01777, /var/tmp) endif ifdef PTXCONF_ROOTFS_VAR_OVERLAYFS @$(call install_alternative, rootfs, 0, 0, 0644, /usr/lib/systemd/system/run-varoverlayfs.mount) -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 01/20] rootfs: keep /var writable, even if the rootfs is read-only
Having a read-only root filesystem is always a source of pain and trouble. Many applications and tools expect to be able to store their state or caching data or at least their logs somewhere in the filesystem. The '/var' directory tree has a well known structure according to the "File System Hierarchy Standard" and is used by all carefully designed programs. Thus, this change provides a way to have this '/var' directory tree writable, even if the main root filesystem is mounted read-only. It uses an overlay filesystem and by default a RAM disk to store changed and added data to this directory tree in a non persistent manner. Due to the nature of the overlay filesystem the underlaying files from the main root filesystem can still be accessed. This approach requires the overlay filesystem support from the Linux kernel. In order to use it, the feature CONFIG_OVERLAY_FS must be enabled. The ugly details to establish the required overlaying filesystem are hidden behind a "mount helper" for a dummy filesystem (here called 'varoverlayfs'). Thus, a BSP can change the overlaying filesystem by providing its own 'run-varoverlay.mount' in order to restrict the default RAM disk differently or to switch to a different local storage. The '/etc/fstab' file gets touched in this change, to enable some already used RAM disks on demand, to gain backward compatibility if no overlay approach is used. Signed-off-by: Juergen Borleis --- doc/daily_work.inc| 97 +++ projectroot/etc/fstab | 6 +- .../lib/systemd/system/run-varoverlayfs.mount | 10 ++ projectroot/usr/lib/systemd/system/var.mount | 10 ++ projectroot/usr/sbin/mount.varoverlayfs | 11 +++ rules/rootfs.in | 58 ++- rules/rootfs.make | 19 +++- 7 files changed, 180 insertions(+), 31 deletions(-) create mode 100644 projectroot/usr/lib/systemd/system/run-varoverlayfs.mount create mode 100644 projectroot/usr/lib/systemd/system/var.mount create mode 100644 projectroot/usr/sbin/mount.varoverlayfs diff --git a/doc/daily_work.inc b/doc/daily_work.inc index 74da11953..470c14f93 100644 --- a/doc/daily_work.inc +++ b/doc/daily_work.inc @@ -1371,3 +1371,100 @@ in the build machine's filesystem also for the target filesystem image. With a different ``umask`` than ``0022`` at build-time this may fail badly at run-time with strange erroneous behaviour (for example some daemons with regular user permissions cannot acces their own configuration files). + +Read Only Filesystem + + +A system can run a read-only root filesystem in order to have a unit which +can be powered off at any time, without any previous shut down sequence. + +But many applications and tools are still expecting a writable filesystem to +temporarily store some kind of data or logging information for example. All +these write attempts will fail and thus, the applications and tools will fail, +too. + +According to the *Filesystem Hierarchy Standard 2.3* the directory tree in +``/var/`` is traditionally writable and its content is persistent across system +restarts. Thus, this directory tree is used by most applications and tools to +store their data. + +The *Filesystem Hierarchy Standard 2.3* defines the following directories +below ``/var/``: + +- ``cache/``: Application specific cache data +- ``crash/``: System crash dumps +- ``lib/``: Application specific variable state information +- ``lock/``: Lock files +- ``log/``: Log files and directories +- ``run/``: Data relevant to running processes +- ``spool/``: Application spool data +- ``tmp/``: Temporary files preserved between system reboots + +Although this writable directory tree is useful and valid for full blown host +machines, an embedded system can behave differently here: For example a +requirement can drop the persistency of changed data across reboots and always +start with empty directories. + +Partially RAM Disks +~~~ + +This is the default behaviour of PTXdist: it mounts a couple of RAM disks over +directories in ``/var`` expected to be writable by various applications and +tools. These RAM disks start always in an empty state and are defined as follows: + ++-+---+ +| mount point | mount options | ++=+===+ +| /var/log| nosuid,nodev,noexec,mode=0755,size=10%| ++-+---+ +| /var/lock | nosuid,nodev,noexec,mode=0755,size=1M | ++-+---+ +| /var/tmp| nosuid,nodev,mode=1777,size=20% |
[ptxdist] [PATCH 11/20] samba: adapt package's '/var/lib' and '/var/cache' requirements
Signed-off-by: Juergen Borleis --- ...ate-expected-directories-at-run-time.patch | 38 +++ patches/samba-4.9.5/series| 4 ++ rules/samba.in| 9 - 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 patches/samba-4.9.5/0001-Lets-systemd-create-expected-directories-at-run-time.patch create mode 100644 patches/samba-4.9.5/series diff --git a/patches/samba-4.9.5/0001-Lets-systemd-create-expected-directories-at-run-time.patch b/patches/samba-4.9.5/0001-Lets-systemd-create-expected-directories-at-run-time.patch new file mode 100644 index 0..8569e0737 --- /dev/null +++ b/patches/samba-4.9.5/0001-Lets-systemd-create-expected-directories-at-run-time.patch @@ -0,0 +1,38 @@ +From: Juergen Borleis +Date: Tue, 4 Jun 2019 20:24:15 +0200 +Subject: [PATCH] Lets systemd create expected directories at run-time + +'samba' requires '/var/lib/samba' and '/var/cache/samba'. + +Signed-off-by: Juergen Borleis +--- + packaging/systemd/nmb.service.in | 2 ++ + packaging/systemd/smb.service.in | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/packaging/systemd/nmb.service.in b/packaging/systemd/nmb.service.in +index a30812320c05..c9373d2ba0a6 100644 +--- a/packaging/systemd/nmb.service.in b/packaging/systemd/nmb.service.in +@@ -8,6 +8,8 @@ After=network.target network-online.target + Type=notify + NotifyAccess=all + PIDFile=@PIDDIR@/nmbd.pid ++StateDirectory=samba ++CacheDirectory=samba + EnvironmentFile=-@SYSCONFDIR@/sysconfig/samba + ExecStart=@SBINDIR@/nmbd --foreground --no-process-group $NMBDOPTIONS + ExecReload=/bin/kill -HUP $MAINPID +diff --git a/packaging/systemd/smb.service.in b/packaging/systemd/smb.service.in +index 18912ef0e98f..76aedfa20337 100644 +--- a/packaging/systemd/smb.service.in b/packaging/systemd/smb.service.in +@@ -9,6 +9,8 @@ Type=notify + NotifyAccess=all + PIDFile=@PIDDIR@/smbd.pid + LimitNOFILE=16384 ++StateDirectory=samba ++CacheDirectory=samba + EnvironmentFile=-@SYSCONFDIR@/sysconfig/samba + ExecStart=@SBINDIR@/smbd --foreground --no-process-group $SMBDOPTIONS + ExecReload=/bin/kill -HUP $MAINPID diff --git a/patches/samba-4.9.5/series b/patches/samba-4.9.5/series new file mode 100644 index 0..b2dcdc0a4 --- /dev/null +++ b/patches/samba-4.9.5/series @@ -0,0 +1,4 @@ +# generated by git-ptx-patches +#tag:base --start-number 1 +0001-Lets-systemd-create-expected-directories-at-run-time.patch +# 2d2f83b2911fe3f43bff610738827040 - git-ptx-patches magic diff --git a/rules/samba.in b/rules/samba.in index ec5423661..822a9758a 100644 --- a/rules/samba.in +++ b/rules/samba.in @@ -17,8 +17,10 @@ menuconfig SAMBA select LIBCAP select LIBPOPT select READLINE - select SYSTEMD if SAMBA_SYSTEMD_UNIT + select SYSTEMD if SAMBA_SYSTEMD_UNIT && RUNTIME select ZLIB + select ROOTFS_VAR_LIB if RUNTIME + select ROOTFS_VAR_CACHE if RUNTIME help Samba is an Open Source/Free Software suite that has, since 1992, provided file and print services to all manner of @@ -28,6 +30,9 @@ menuconfig SAMBA See http://www.samba.org for details. + Note: on a read-only root filesystem this package still requires a + writable '/var/lib' and '/var/cache'. + if SAMBA config SAMBA_COMMON @@ -64,7 +69,7 @@ config SAMBA_CUPS config SAMBA_STARTSCRIPT bool default y - depends on SAMBA_SERVER + depends on SAMBA_SERVER && !INITMETHOD_SYSTEMD prompt "install /etc/init.d/samba" config SAMBA_SYSTEMD_UNIT -- 2.20.1 ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] More collected changes
The first two changes are V2 after honoring the comments, all the remaining changes are V1 and most of them are related to the "overlay RAM disk feature on /var" introduced in the first change. The last change in this list updates and fixes the autotools based templates. Comments are welcome. Juergen ___ ptxdist mailing list ptxdist@pengutronix.de
[ptxdist] [PATCH 07/20] dnsmasq: version bump 2.79 -> 2.80
Signed-off-by: Juergen Borleis --- ...the-pkg-config-file-is-lua-no-lua5.2.patch | 4 +- patches/{dnsmasq-2.79 => dnsmasq-2.80}/series | 0 projectroot/etc/dnsmasq.conf | 275 ++ rules/dnsmasq.in | 3 +- rules/dnsmasq.make| 8 +- 5 files changed, 232 insertions(+), 58 deletions(-) rename patches/{dnsmasq-2.79 => dnsmasq-2.80}/0001-the-pkg-config-file-is-lua-no-lua5.2.patch (93%) rename patches/{dnsmasq-2.79 => dnsmasq-2.80}/series (100%) diff --git a/patches/dnsmasq-2.79/0001-the-pkg-config-file-is-lua-no-lua5.2.patch b/patches/dnsmasq-2.80/0001-the-pkg-config-file-is-lua-no-lua5.2.patch similarity index 93% rename from patches/dnsmasq-2.79/0001-the-pkg-config-file-is-lua-no-lua5.2.patch rename to patches/dnsmasq-2.80/0001-the-pkg-config-file-is-lua-no-lua5.2.patch index 42fe46a88..a30a5755f 100644 --- a/patches/dnsmasq-2.79/0001-the-pkg-config-file-is-lua-no-lua5.2.patch +++ b/patches/dnsmasq-2.80/0001-the-pkg-config-file-is-lua-no-lua5.2.patch @@ -8,10 +8,10 @@ Signed-off-by: Michael Olbrich 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index 73ea23e11d07..1dba188f9c30 100644 +index e71cf86908d3..c4945c0b44e8 100644 --- a/Makefile +++ b/Makefile -@@ -59,8 +59,8 @@ idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFI +@@ -60,8 +60,8 @@ idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFI idn2_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --libs libidn2` ct_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack` ct_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack` diff --git a/patches/dnsmasq-2.79/series b/patches/dnsmasq-2.80/series similarity index 100% rename from patches/dnsmasq-2.79/series rename to patches/dnsmasq-2.80/series diff --git a/projectroot/etc/dnsmasq.conf b/projectroot/etc/dnsmasq.conf index 1856481d1..8548b43ed 100644 --- a/projectroot/etc/dnsmasq.conf +++ b/projectroot/etc/dnsmasq.conf @@ -4,17 +4,34 @@ # as the long options legal on the command line. See # "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. +# Listen on this specific port instead of the standard DNS port +# (53). Setting this to zero completely disables DNS function, +# leaving only DHCP and/or TFTP. +#port=5353 + # The following two options make you a better netizen, since they # tell dnsmasq to filter out queries which the public DNS cannot # answer, and which load the servers (especially the root servers) -# uneccessarily. If you have a dial-on-demand link they also stop -# these requests from bringing up the link uneccessarily. +# unnecessarily. If you have a dial-on-demand link they also stop +# these requests from bringing up the link unnecessarily. # Never forward plain names (without a dot or domain part) #domain-needed # Never forward addresses in the non-routed address spaces. #bogus-priv +# Uncomment these to enable DNSSEC validation and caching: +# (Requires dnsmasq to be built with DNSSEC option.) +#conf-file=%%PREFIX%%/share/dnsmasq/trust-anchors.conf +#dnssec + +# Replies which are not DNSSEC signed may be legitimate, because the domain +# is unsigned, or may be forgeries. Setting this option tells dnsmasq to +# check that an unsigned reply is OK, by finding a secure proof that a DS +# record somewhere between the root and the domain does not exist. +# The cost of setting this is that even queries in unsigned domains will need +# one or more extra DNS queries to verify. +#dnssec-check-unsigned # Uncomment this to filter useless windows-originated DNS requests # which can trigger dial-on-demand links needlessly. @@ -57,21 +74,25 @@ #local=/localnet/ # Add domains which you want to force to an IP address here. -# The example below send any host in doubleclick.net to a local -# webserver. -#address=/doubleclick.net/127.0.0.1 +# The example below send any host in double-click.net to a local +# web-server. +#address=/double-click.net/127.0.0.1 # --address (and --server) work with IPv6 addresses too. #address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83 +# Add the IPs of all queries to yahoo.com, google.com, and their +# subdomains to the vpn and search ipsets: +#ipset=/yahoo.com/google.com/vpn,search + # You can control how dnsmasq talks to a server: this forces # queries to 10.1.2.3 to be routed via eth1 -# --server=10.1.2.3@eth1 +# server=10.1.2.3@eth1 # and this sets the source (ie local) address used to talk to -# 10.1.2.3 to 192.168.1.1 port 55 (there must be a interface with that +# 10.1.2.3 to 192.168.1.1 port 55 (there must be an interface with that # IP on the machine, obviously). -# --server=10.1.2.3@192.168.1.1#55 +# server=10.1.2.3@192.168.1.1#55 # If you want dnsmasq to change uid and
Re: [ptxdist] [PATCH] rootfs: keep /var writable, even if the rootfs is read-only
Hi Jürgen, please find some adjustments inline. On Tue, Jun 04 2019 at 18:00 +0200, Juergen Borleis wrote: > Having a read-only root filesystem is always a source of pain and trouble. > Many applications and tools expect to be able to store their state or > caching data or at least their logs somewhere in the filesystem. > > The '/var' directory tree has a well known structure according to the > "File System Hierarchy Standard" and is used by all carefully designed > programs. Thus, this change provides a way to have this '/var' directory > tree writable, even if the main root filesystem is mounted read-only. It > uses an overlay filesystem and by default a RAM disk to store changed and > added data to this directory tree in a non persistent manner. > > Due to the nature of the overlay filesystem the underlaying files from the > main root filesystem can still be accessed. > > This approach requires the overlay filesystem support from the Linux > kernel. In order to use it, the feature CONFIG_OVERLAY_FS must be enabled. > > A BSP can change the overlaying filesystem by providing its own > 'run-varoverlay.mount' in order to restrict the used RAM disk differently > or switch to a different local storage. > > Signed-off-by: Juergen Borleis > --- > doc/daily_work.inc| 97 +++ > projectroot/etc/fstab | 6 +- > .../lib/systemd/system/run-varoverlayfs.mount | 10 ++ > projectroot/usr/lib/systemd/system/var.mount | 9 ++ > projectroot/usr/sbin/mount.varoverlayfs | 11 +++ > rules/rootfs.in | 15 +++ > rules/rootfs.make | 23 - > 7 files changed, 164 insertions(+), 7 deletions(-) > create mode 100644 projectroot/usr/lib/systemd/system/run-varoverlayfs.mount > create mode 100644 projectroot/usr/lib/systemd/system/var.mount > create mode 100644 projectroot/usr/sbin/mount.varoverlayfs > > diff --git a/doc/daily_work.inc b/doc/daily_work.inc > index 74da11953..093f069bf 100644 > --- a/doc/daily_work.inc > +++ b/doc/daily_work.inc > @@ -1371,3 +1371,100 @@ in the build machine's filesystem also for the target > filesystem image. With > a different ``umask`` than ``0022`` at build-time this may fail badly at > run-time with strange erroneous behaviour (for example some daemons with > regular user permissions cannot acces their own configuration files). > + > +Read Only Filesystem > + > + > +A system can run a read-only root filesystem in order to have a unit which > +can be powered off at any time, without any previous shutting down sequence. s/shutting/shut/ > + > +But many applications and tools are still expecting a writable filesystem to > +temporarely store some kind of data or logging information for example. All s/temporarely/temporarily/ > +these write attempts will fail and thus, the applications and tools will > fail, > +too. > + > +According to the *Filesystem Hierarchy Standard 2.3* the directory tree in > +'/var/' is traditionally writable and its content is persistent across system > +restarts. Thus, this directory tree is used by most applications and tools to > +store their data. > + > +The *Filesystem Hierarchy Standard 2.3* defines the following directories > +below '/var': > + > +- 'cache/': Application specific cache data > +- 'crash/': System crash dumps > +- 'lib/': Application specific variable state information > +- 'lock/': Lock files > +- 'log/': Log files and directories > +- 'run/': Data relevant to run processes s/run/running/ > +- 'spool/': Application spool data > +- 'tmp/': Temporary files preserved between system reboots > + > +Since this writable directory tree is useful and valid for full blown host s/Since/Although/ ? > +machines, an embedded system can behave differently here: For example the s/For example the/for example a/ > +requirement can drop the persistency of changed data across reboots and > always s/persistency/persistence/ > +start with empty directories. > + > +Partially RAM Disks > +~~~ > + > +This is the default behaviour of PTXdist: it mounts a couple of RAM disks > over > +directories in ``/var`` expected to be writable by various applications and > +tools. These RAM disks start alway in an empty state and are defined as > follows: s/alway/always/ > + > ++-+---+ > +| mount point | mount options > | > ++=+===+ > +| /var/log| nosuid,nodev,noexec,mode=0755,size=10% > | > ++-+---+ > +| /var/lock | nosuid,nodev,noexec,mode=0755,size=1M > | > ++-+---+ > +| /var/tmp|