Add image specific optional volatile log handling

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2018-11-06 23:55:08 +01:00
parent a7329e1e3d
commit 846401b219
4 changed files with 40 additions and 3 deletions

13
README
View File

@@ -33,6 +33,17 @@ Additionally this layer checks the following variable in local.conf:
Set MORTSGNA_ARMV7_TUNE="1"
* If you are intersted in best optimization for your machine and/or you have
a fast build host with lots of disk-space: don't!
see conf/distro/include/mortsgna-armv7-tune.inc for more information
-------------------------------------------------------------------------------
The following image specific variables are handled:
* MORTSGNA_IMAGE_VOLATILE_LOG_DIR
* If set to "1", journal goes to volatile /run/log and /var/log is linked to
/run/log which is volatile
* Otherwise all log goes to /var/log which is persistent
see conf/distro/include/mortsgna-image-logfile-volatile.inc for more
information
-------------------------------------------------------------------------------
This layer contains the following folders:
@@ -43,7 +54,7 @@ appends:
for the layer is ignored (see conf/layer.conf).
classes:
Currently instant-remote.bbclass and user-with-full-skel.bbclass.
Our classes to tailor build.
conf:
layer.conf / and distro configurations

View File

@@ -0,0 +1,22 @@
# override bitbake.conf default
VOLATILE_LOG_DIR = "false"
# Do alignment on journal and /var/log
ROOTFS_POSTPROCESS_COMMAND += "postinst_volatile_log; "
postinst_volatile_log () {
if [ "${MORTSGNA_IMAGE_VOLATILE_LOG_DIR}" = "1" ]; then
# systemd journal
if [ -f "${IMAGE_ROOTFS}${sysconfdir}/systemd/journald.conf" ]; then
sed -i \
-e 's:.*Storage=.*:Storage=volatile:g' \
${IMAGE_ROOTFS}${sysconfdir}/systemd/journald.conf
fi
# link /var/log -> /run/log
if [ -e ${IMAGE_ROOTFS}${localstatedir}/log ]; then
rm -rf ${IMAGE_ROOTFS}${localstatedir}/log
fi
ln -sf ../run/log ${IMAGE_ROOTFS}${localstatedir}/log
fi
}

View File

@@ -116,5 +116,8 @@ DISTRO_FEATURES += "${DISTRO_WAYLAND}"
# Inherit the default LIBC features superset from OE-core
DISTRO_FEATURES += "${DISTRO_FEATURES_LIBC}"
# image specific volatile logfile handlding with MORTSGNA_IMAGE_VOLATILE_LOG_DIR
require conf/distro/include/mortsgna-image-logfile-volatile.inc
# Yocto tweaks
require conf/distro/include/mortsgna-core-tweaks.inc

View File

@@ -115,8 +115,9 @@ EXTRA_IMAGE_FEATURES += " \
allow-empty-password \
post-install-logging \
"
# Ensure postinst.log non volatile
POSTINST_LOGFILE = "${localstatedir}/postinstall.log"
# default: persistent log
MORTSGNA_IMAGE_VOLATILE_LOG_DIR ?= "0"
# make x11-base a valid IMAGE_FEATURES
IMAGE_FEATURES[validitems] += "x11-base"