From: Mike Looijmans <mike.looijmans@topic.nl>
To: OE-core <Openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] image.bbclass: Always try to run populate-volatile.sh at rootfs time
Date: Mon, 24 Aug 2015 15:07:44 +0200 [thread overview]
Message-ID: <55DB1720.6090808@topic.nl> (raw)
In-Reply-To: <1439362843-27419-1-git-send-email-mike.looijmans@topic.nl>
Any comments on this?
And if unacceptable, how about at least making
"rootfs_populate_volatile_cache" available as a sort of library method so it
doesn't get repeated at each image recipe?
On 12-08-15 09:00, Mike Looijmans wrote:
> Currently populate-volatile.sh will only run when "readonly-rootfs" is
> selected.
>
> Running this script is very useful even on read/write root filesystems,
> because it reduces the number of "fixup" actions at first boot of the
> device. That not only reduces boot time, it also reduces the flash space
> usage. Also, when the system happens to have a read-only filesystem
> because for example the "read-only" switch of the SD card was set, or
> because the filesystem had errors on it, it will still be able to boot.
>
> I've been manually adding these lines to each and every image recipe I've
> used, so I guess it's time to move this into core.
>
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---
> meta/classes/image.bbclass | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index ff2ed0d..68deb84 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -185,6 +185,9 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'deb
> # Create /etc/timestamp during image construction to give a reasonably sane default time setting
> ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
>
> +# Create the volatile cache. Required for read-only rootfs, useful for all sysvinit systems to reduce writes to the system
> +ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "rootfs_populate_volatile_cache;", "", d)}'
> +
> # Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled
> ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
>
> @@ -216,6 +219,16 @@ do_rootfs[cleandirs] += "${S}"
> # task, so that we have a single fakeroot context for the whole process.
> do_rootfs[umask] = "022"
>
> +
> +# Run populate-volatile.sh at rootfs time to set up basic files and
> +# directories to reduce writes at first boot and to support read-only
> +# rootfs.
> +rootfs_populate_volatile_cache() {
> + if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
> + ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
> + fi
> +}
> +
> # A hook function to support read-only-rootfs IMAGE_FEATURES
> read_only_rootfs_hook () {
> # Tweak the mount option and fs_passno for rootfs in fstab
> @@ -226,11 +239,6 @@ read_only_rootfs_hook () {
> if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
> sed -i 's/ROOTFS_READ_ONLY=no/ROOTFS_READ_ONLY=yes/' ${IMAGE_ROOTFS}/etc/default/rcS
> fi
> - # Run populate-volatile.sh at rootfs time to set up basic files
> - # and directories to support read-only rootfs.
> - if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
> - ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
> - fi
> # If we're using openssh and the /etc/ssh directory has no pre-generated keys,
> # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
> # and the keys under /var/run/ssh.
>
Kind regards,
Mike Looijmans
System Expert
TOPIC Embedded Products
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
Telefax: +31 (0) 499 33 69 70
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
prev parent reply other threads:[~2015-08-24 13:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 7:00 [PATCH] image.bbclass: Always try to run populate-volatile.sh at rootfs time Mike Looijmans
2015-08-24 13:07 ` Mike Looijmans [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55DB1720.6090808@topic.nl \
--to=mike.looijmans@topic.nl \
--cc=Openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox