read-only rootfs support
v8 cover read-only rootfs support
From: Chen Qi <[email protected]>
The series of patches add support to read-only rootfs.
The main idea is to use symbolic links to create the illuion that some directories are writable in case of a read-only rootfs.
This set of patches have been tested on minimal images with and without 'read-only-rootfs' image feature enabled. Everything is OK.
For sato images, everything is the same as before if 'read-only-rootfs' is not enabled. With 'read-only-rootfs' enabled, sato image could work if graphic interface is diabled. When all postinstall problems are resolved, sato image should work well (maybe with some small changes in volatiles-readonly-sato conf file).
Changes for Version 4:
1) Improve the commit messages to be clearer.
2) Use 'sed -i' to replace 'sed' and 'mv' operations to cut down the exec overhead.
Changes for Version 5:
Fix the problem of failing to build the live images
Changes for Version 6:
1) Let the image recipes provide the corresponding conf files for read-only rootfs. The config files are closely related to the image types, so it's more reasonable to let these image recipes provide the config files.
2) Support customized conf files for customized images.
Changes for Version 7:
1) Separate read-only-rootfs specific conf files from image recipes. Create recipes for them and let image recipes depend on the them.
2) 'choose_volatiel_conf' is no more need, thus removed.
Changes for Version 8:
Rebase these patches against the latest master branch (after the systemd integration)
The following changes since commit 37e025f6f9c410005e0f1dee0767e38eaec01cbd:
bitbake: hob: Hob should display warnings generated during parsing (2013-01-21 19:05:31 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/readonly-rootfs
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/readonly-rootfs
Chen Qi (6):
sysvinit: add ROOTFS_READ_ONLY variable to rcS-default image.bbclass: add a hook funtion to support readonly rootfs core-image.bbclass: support read-only rootfs
initscripts: support read-only rootfs
volatile-conf-minimal: add recipe
volatile-conf-sato: add recipe
meta/classes/core-image.bbclass | 4 + meta/classes/image.bbclass | 18 ++ meta/recipes-core/images/core-image-minimal.bb | 3 + .../initscripts/initscripts-1.0/bootmisc.sh | 9 +- .../initscripts-1.0/populate-volatile.sh | 281 ++++++++++---------- .../initscripts/initscripts-1.0/volatiles | 1 + meta/recipes-core/initscripts/initscripts_1.0.bb | 2 +- .../files/volatiles-readonly-minimal | 8 + .../volatile-conf-minimal_1.0.bb | 15 ++ meta/recipes-core/sysvinit/sysvinit/rcS-default | 4 + meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb | 2 +- meta/recipes-sato/images/core-image-sato.bb | 3 + .../files/volatiles-readonly-sato | 14 + .../volatile-conf-sato_1.0.bb | 15 ++ 14 files changed, 226 insertions(+), 153 deletions(-) create mode 100644 meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal create mode 100644 meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb create mode 100644 meta/recipes-sato/readonly-volatile-conf/files/volatiles-readonly-sato create mode 100644 meta/recipes-sato/readonly-volatile-conf/volatile-conf-sato_1.0.bb
Signature · 1 line
1.7.9.5
PATCH v8 1/6 sysvinit: add ROOTFS_READ_ONLY variable to rcS-default
From: Chen Qi <[email protected]>
This variable indicates whether the rootfs is intended to be read-only or not. Changing this value from 'no' to 'yes' on a currently running system with read-write rootfs and rebooting will give the user a working system with read-only rootfs.
However, it is not suggested to change its value. Normally, if a read-only rootfs is required, we should build an image with 'read-only-rootfs' image feature.
[YOCTO #3406]
--- meta/recipes-core/sysvinit/sysvinit/rcS-default | 4 ++++ meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/sysvinit/sysvinit/rcS-default +4 -0
@@ -23,3 +23,7 @@ FSCKFIX=yes #TICKADJ=10000 # Enable caching in populate-volatile.sh VOLATILE_ENABLE_CACHE=yes +# Indicate whether the rootfs is intended to be read-only or not. +# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs. +# Normally you should not change this value. +ROOTFS_READ_ONLY=no
meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb +1 -1
@@ -5,7 +5,7 @@ SECTION = "base" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4" -PR = "r9" +PR = "r10" RDEPENDS_${PN} = "${PN}-inittab"
Signature · 1 line
1.7.9.5
PATCH v8 2/6 image.bbclass: add a hook funtion to support readonly rootfs
In reply to [email protected]From: Chen Qi <[email protected]>
read_only_rootfs_hook: this funtion is invoked only if 'read-only-rootfs' is in IMAGE_FEATURES. It tweaks some basic files and makes populate- volatile.sh script run at rootfs time.
For now, it has real effect only if the init system is sysvinit.
[YOCTO #3406]
--- meta/classes/image.bbclass | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
meta/classes/image.bbclass +18 -0
@@ -201,6 +201,24 @@ run_intercept_scriptlets () { fi } +# A hook function to support read-only-rootfs IMAGE_FEATURES +# Currently, it only supports sysvinit system. +read_only_rootfs_hook () { + if ${@base_contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then + # Tweak the mount option in fstab + sed -i '/rootfs/ s/defaults/ro/' ${IMAGE_ROOTFS}/etc/fstab + # Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes + 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 [ -e ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then + ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh + fi + fi +} + fakeroot do_rootfs () { #set -x # When use the rpm incremental image generation, don't remove the rootfs
Signature · 1 line
1.7.9.5
Re: [PATCH V8 2/6] image.bbclass: add a hook funtion to support readonly rootfs
Quoted 5 lines · On 01/22/2013 07:36 AM, [email protected] wrote:
From: Chen Qi <[email protected]>
read_only_rootfs_hook: this funtion is invoked only if 'read-only-rootfs' is inIMAGE_FEATURES. It tweaks some basic files and makes populate-volatile.shscript run at rootfs time.
To me, it seems running populate-volatile at rootfs is a good thing for writable rootfs as well, it reduces the writing at first boot. Why not ALWAYS do this?
Signature · 1 line
Mike Looijmans - Topic Automation
Re: [PATCH V8 2/6] image.bbclass: add a hook funtion to support readonly rootfs
Quoted 9 lines · Mike Looijmans
Quoted 5 lines · On 01/22/2013 07:36 AM, [email protected] wrote:
From: Chen Qi <[email protected]>
read_only_rootfs_hook: this funtion is invoked only if 'read-only-rootfs' is inIMAGE_FEATURES. It tweaks some basic files and makes populate-volatile.shscript run at rootfs time.To me, it seems running populate-volatile at rootfs is a good thing for writable rootfs as well, it reduces the writing at first boot. Why not ALWAYS do this?
Hi Mike,
The reason I didn't make it *always* run at rootfs is that it's not *necessary*.
Besides, I want to encapsulate all all necessary tweaks at rootfs time into one function -- read-only-rootfs-hook. In this way, I can ensure that it doesn't mess up with other components.
Thanks,
Chen Qi
PATCH v8 3/6 core-image.bbclass: support read-only rootfs
In reply to [email protected]From: Chen Qi <[email protected]>
The hook function is appended to ROOTFS_POSTPROCESS_COMMAND properly to support the 'read-only-rootfs' image feature.
[YOCTO #3406]
--- meta/classes/core-image.bbclass | 4 ++++ 1 file changed, 4 insertions(+)
meta/classes/core-image.bbclass +4 -0
@@ -28,6 +28,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3 # - dev-pkgs - development packages (headers, etc.) for all installed packages in the rootfs # - dbg-pkgs - debug symbol packages for all installed packages in the rootfs # - doc-pkgs - documentation packages for all installed packages in the rootfs +# - read-only-rootfs - tweaks an image to support read-only rootfs # PACKAGE_GROUP_x11 = "packagegroup-core-x11" PACKAGE_GROUP_x11-base = "packagegroup-core-x11-base"
@@ -76,3 +77,6 @@ ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; " # Zap the root password if debug-tweaks feature is not enabled ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "", "zap_root_password ; ",d)}' + +# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled +ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
Signature · 1 line
1.7.9.5
PATCH v8 4/6 initscripts: support read-only rootfs
In reply to [email protected]From: Chen Qi <[email protected]>
To support a read-only rootfs, we use symbolic links which point to volatile storage to create the illusion that some directories are writable.
Improve populate-volatile.sh script to support read-only rootfs. Add two default config files specific to read-only-rootfs image.
[YOCTO #3406]
--- .../initscripts/initscripts-1.0/bootmisc.sh | 9 +- .../initscripts-1.0/populate-volatile.sh | 281 ++++++++++---------- .../initscripts/initscripts-1.0/volatiles | 1 + meta/recipes-core/initscripts/initscripts_1.0.bb | 2 +- 4 files changed, 141 insertions(+), 152 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh +1 -8
@@ -54,14 +54,7 @@ fi # # This is as good a place as any for a sanity check -# /tmp should be a symlink to /var/tmp to cut down on the number -# of mounted ramdisks. -if test ! -L /tmp && test -d /var/tmp -then - rm -rf /tmp - ln -sf /var/tmp /tmp -fi - +# # Set the system clock from hardware clock # If the timestamp is more recent than the current time, # use the timestamp instead.
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +138 -143
330 lines not on this page · raw message
meta/recipes-core/initscripts/initscripts-1.0/volatiles +1 -0
@@ -31,6 +31,7 @@ l root root 1777 /var/lock /var/volatile/lock l root root 0755 /var/log /var/volatile/log l root root 0755 /var/run /var/volatile/run l root root 1777 /var/tmp /var/volatile/tmp +l root root 1777 /tmp /var/tmp d root root 0755 /var/lock/subsys none f root root 0664 /var/log/wtmp none f root root 0664 /var/run/utmp none
meta/recipes-core/initscripts/initscripts_1.0.bb +1 -1
@@ -3,7 +3,7 @@ DESCRIPTION = "Initscripts provide the basic system startup initialization scrip SECTION = "base" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" -PR = "r139" +PR = "r140" INHIBIT_DEFAULT_DEPS = "1"
Signature · 1 line
1.7.9.5
PATCH v8 5/6 volatile-conf-minimal: add recipe
In reply to [email protected]From: Chen Qi <[email protected]>
This recipe provides a config file for core-image-minimal. This config file is used for volatile storage handling in case of a readonly rootfs.
Also, let core-image-minimal depend on this recipe.
[YOCTO #3406]
--- meta/recipes-core/images/core-image-minimal.bb | 3 +++ .../files/volatiles-readonly-minimal | 8 ++++++++ .../volatile-conf-minimal_1.0.bb | 15 +++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal create mode 100644 meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb
meta/recipes-core/images/core-image-minimal.bb +3 -0
@@ -6,6 +6,9 @@ IMAGE_LINGUAS = " " LICENSE = "MIT" +RDEPENDS += "volatile-conf-minimal" +IMAGE_INSTALL += "volatile-conf-minimal" + inherit core-image IMAGE_ROOTFS_SIZE = "8192"
meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal new file +8 -0
@@ -0,0 +1,8 @@ +# This configuration file lists filesystem objects specific to minimal image +# with read-only rootfs. +# This configuration file will only be applied if the image is minimal and the +# rootfs is read-only. +# For the detailed format information, refer to /etc/default/volatiles/00_core. +d root root 0755 /var/volatile/lib/ none +d root root 0755 /var/volatile/lib/urandom/ none +l root root 0755 /var/lib/urandom /var/volatile/lib/urandom
meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb new file +15 -0
@@ -0,0 +1,15 @@ +SUMMARY = "Provide config files for core-image-minimal" +DESCRIPTION = "This package contains a config file for core-image-minimal. \ +It is used to handle volatile storage in case of a read-only rootfs." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = "file://volatiles-readonly-minimal" + +PR = "r1" + +do_install () { + install -d ${D}${sysconfdir}/default/volatiles + install -m 0644 ${WORKDIR}/volatiles-readonly-minimal ${D}${sysconfdir}/default/volatiles/00_core_readonly +}
Signature · 1 line
1.7.9.5
Re: [PATCH V8 5/6] volatile-conf-minimal: add recipe
Quoted 24 lines · On 01/21/2013 10:36 PM, [email protected] wrote:
From: Chen Qi <[email protected]>
This recipe provides a config file for core-image-minimal. This config file is used for volatile storage handling in case of a readonly rootfs.
Also, let core-image-minimal depend on this recipe.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/recipes-core/images/core-image-minimal.bb | 3 +++ .../files/volatiles-readonly-minimal | 8 ++++++++ .../volatile-conf-minimal_1.0.bb | 15 +++++++++++++++ 3 files changed, 26 insertions(+)create mode 100644 meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal create mode 100644 meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb
meta/recipes-core/images/core-image-minimal.bb +0
-0
meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 9
Quoted 4 lines
meta/recipes-core/images/core-image-minimal.bb +1
-0@@ -6,6 +6,9 @@ IMAGE_LINGUAS = " " LICENSE = "MIT" +RDEPENDS += "volatile-conf-minimal"
This needs to be RDEPENDS_${PN}
meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 11
Quoted 2 lines
meta/recipes-core/images/core-image-minimal.bb +2
-0+IMAGE_INSTALL += "volatile-conf-minimal" +
I am still digging into this idea of having a image specific volatile package, RP is not wild about it either. What's different now from before is the minimal version cut down from the orignal version? Is there any reason we can't use a larger volatile conf?
Sau!
Quoted 39 lines
meta/recipes-core/images/core-image-minimal.bb +0
-0inherit core-image IMAGE_ROOTFS_SIZE = "8192"meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal new file +8
-0@@ -0,0 +1,8 @@ +# This configuration file lists filesystem objects specific to minimal image +# with read-only rootfs. +# This configuration file will only be applied if the image is minimal and the +# rootfs is read-only. +# For the detailed format information, refer to /etc/default/volatiles/00_core. +d root root 0755 /var/volatile/lib/ none +d root root 0755 /var/volatile/lib/urandom/ none +l root root 0755 /var/lib/urandom /var/volatile/lib/urandommeta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb new file +15
-0@@ -0,0 +1,15 @@ +SUMMARY = "Provide config files for core-image-minimal" +DESCRIPTION = "This package contains a config file for core-image-minimal. \ +It is used to handle volatile storage in case of a read-only rootfs." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = "file://volatiles-readonly-minimal" + +PR = "r1" + +do_install () { + install -d ${D}${sysconfdir}/default/volatiles + install -m 0644 ${WORKDIR}/volatiles-readonly-minimal ${D}${sysconfdir}/default/volatiles/00_core_readonly +}
Re: [PATCH V8 5/6] volatile-conf-minimal: add recipe
Quoted 31 lines · Saul Wold
Quoted 30 lines · On 01/21/2013 10:36 PM, [email protected] wrote:
From: Chen Qi <[email protected]>
This recipe provides a config file for core-image-minimal. This config file is used for volatile storage handling in case of a readonly rootfs.
Also, let core-image-minimal depend on this recipe.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/recipes-core/images/core-image-minimal.bb | 3 +++ .../files/volatiles-readonly-minimal | 8 ++++++++ .../volatile-conf-minimal_1.0.bb | 15 +++++++++++++++ 3 files changed, 26 insertions(+)create mode 100644
meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal
create mode 100644
meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bbmeta/recipes-core/images/core-image-minimal.bb +0
-0@@ -6,6 +6,9 @@ IMAGE_LINGUAS = " " LICENSE = "MIT"
Quoted 9 lines
meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 9
Quoted 1 line
meta/recipes-core/images/core-image-minimal.bb +1
-0+RDEPENDS += "volatile-conf-minimal"This needs to be RDEPENDS_${PN}
meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 11
Quoted 2 lines
meta/recipes-core/images/core-image-minimal.bb +2
-0+IMAGE_INSTALL += "volatile-conf-minimal" +I am still digging into this idea of having a image specific volatile package, RP is not wild about it either. What's different now from before is the minimal version cut down from the orignal version? Is there any reason we can't use a larger volatile conf?
Sau!
Hi Saul,
I thought about this, but didn't dig deep into it because I thought one conf file for one image would be clearer. On a second thought, maybe we could use a config file like below.
<pkg1>
readonly specific config items for pkg1
</pkg1>
<pkg2>
readonly specific config items for pkg2
</pkg2>
....
(Let's denote it as the original config file.)
In this way, all config items are centred into one place. And the strategy would be like:
1. get a list of pkgs that are to be installed on target
L = [pkg1, pkg2, ..., pkgn]
2. original config file -- [select items according to L] --> final config file
The selecting procedure is simply something like:
for pkg in $pkgs; do cat origin | sed -ne "/<$pkg>/,/<\/$pkg>/ {
/<$pkg>/n; /<\/$pkg>/n; p; }" ; done > final
The final config file should look like the ones that we use for now
so that we can still use populate-volatile.sh to create the dirs and links.
3. Parse the final config file with populate-volatile.sh to create the proper directories and links.
The problem is that I don't know how to get the pkg list. Could somebody help me?
What do you think about this strategy?
Cheers,
Chen Qi
Re: [PATCH V8 5/6] volatile-conf-minimal: add recipe
Quoted 77 lines · ChenQi
Quoted 36 lines · Saul Wold
Quoted 29 lines · On 01/21/2013 10:36 PM, [email protected] wrote:
From: Chen Qi <[email protected]>
This recipe provides a config file for core-image-minimal. This config file is used for volatile storage handling in case of a readonly rootfs.
Also, let core-image-minimal depend on this recipe.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/recipes-core/images/core-image-minimal.bb | 3 +++ .../files/volatiles-readonly-minimal | 8 ++++++++ .../volatile-conf-minimal_1.0.bb | 15 +++++++++++++++ 3 files changed, 26 insertions(+)create mode 100644
meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimalcreate mode 100644
meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bbmeta/recipes-core/images/core-image-minimal.bb +0
-0meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 9
Quoted 4 lines
meta/recipes-core/images/core-image-minimal.bb +1
-0@@ -6,6 +6,9 @@ IMAGE_LINGUAS = " " LICENSE = "MIT" +RDEPENDS += "volatile-conf-minimal"This needs to be RDEPENDS_${PN}
Quoted 9 lines
meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 11
Quoted 2 lines
meta/recipes-core/images/core-image-minimal.bb +2
-0+IMAGE_INSTALL += "volatile-conf-minimal" +I am still digging into this idea of having a image specific volatile package, RP is not wild about it either. What's different now from before is the minimal version cut down from the orignal version? Is there any reason we can't use a larger volatile conf?
Sau!
Hi Saul,
I thought about this, but didn't dig deep into it because I thought one conf file for one image would be clearer.
On a second thought, maybe we could use a config file like below.<pkg1>
readonly specific config items for pkg1
</pkg1><pkg2>
readonly specific config items for pkg2
</pkg2>....
(Let's denote it as the original config file.)In this way, all config items are centred into one place. And the strategy would be like:
1. get a list of pkgs that are to be installed on targetL = [pkg1, pkg2, ..., pkgn]2. original config file -- [select items according to L] --> final config file
The selecting procedure is simply something like:
for pkg in $pkgs; do cat origin | sed -ne "/<$pkg>/,/<\/$pkg>/ {
/<$pkg>/n; /<\/$pkg>/n; p; }" ; done > final
The final config file should look like the ones that we use for now
so that we can still usepopulate-volatile.shto create the dirs and links.
3. Parse the final config file withpopulate-volatile.shto create the proper directories and links.
Quoted 5 lines
The problem is that I don't know how to get the pkg list. Could somebody help me?
What do you think about this strategy?
Hmm, once you put it this way, another thought came to mind we could create a volatile class similar to update-rc.d or useradd where we specify the a VOLATILE_PKGS, VOLATILE_DIR, VOLATILE_LINK in the appropriate recipes directly and then inherit the volatile class.
Thoughts?
Sau!
Quoted 8 lines
Cheers,
Chen Qi
Re: [PATCH V8 5/6] volatile-conf-minimal: add recipe
Quoted 79 lines · Saul Wold
Quoted 78 lines · ChenQi
Quoted 37 lines · Saul Wold
Quoted 30 lines · On 01/21/2013 10:36 PM, [email protected] wrote:
From: Chen Qi <[email protected]>
This recipe provides a config file for core-image-minimal. This config file is used for volatile storage handling in case of a readonly rootfs.
Also, let core-image-minimal depend on this recipe.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/recipes-core/images/core-image-minimal.bb | 3 +++ .../files/volatiles-readonly-minimal | 8 ++++++++ .../volatile-conf-minimal_1.0.bb | 15 +++++++++++++++ 3 files changed, 26 insertions(+)create mode 100644
meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimalcreate mode 100644
meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bbmeta/recipes-core/images/core-image-minimal.bb +0
-0meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 9
Quoted 4 lines
meta/recipes-core/images/core-image-minimal.bb +1
-0@@ -6,6 +6,9 @@ IMAGE_LINGUAS = " " LICENSE = "MIT" +RDEPENDS += "volatile-conf-minimal"This needs to be RDEPENDS_${PN}
Quoted 9 lines
meta/recipes-core/images/core-image-minimal.bb IMAGE_LINGUAS = " " · line 11
Quoted 2 lines
meta/recipes-core/images/core-image-minimal.bb +2
-0+IMAGE_INSTALL += "volatile-conf-minimal" +I am still digging into this idea of having a image specific volatile package, RP is not wild about it either. What's different now from before is the minimal version cut down from the orignal version? Is there any reason we can't use a larger volatile conf?
Sau!
Hi Saul,
I thought about this, but didn't dig deep into it because I thought one conf file for one image would be clearer.
On a second thought, maybe we could use a config file like below.<pkg1>
readonly specific config items for pkg1
</pkg1><pkg2>
readonly specific config items for pkg2
</pkg2>....
(Let's denote it as the original config file.)In this way, all config items are centred into one place. And the strategy would be like:
1. get a list of pkgs that are to be installed on targetL = [pkg1, pkg2, ..., pkgn]2. original config file -- [select items according to L] --> final config file
The selecting procedure is simply something like:
for pkg in $pkgs; do cat origin | sed -ne "/<$pkg>/,/<\/$pkg>/ {
/<$pkg>/n; /<\/$pkg>/n; p; }" ; done > final
The final config file should look like the ones that we use for now
so that we can still usepopulate-volatile.shto create the dirs and links.
3. Parse the final config file withpopulate-volatile.shto create the proper directories and links.
Quoted 9 lines
Quoted 5 lines
The problem is that I don't know how to get the pkg list. Could somebody help me?
What do you think about this strategy?
Hmm, once you put it this way, another thought came to mind we could create a volatile class similar to update-rc.d or useradd where we specify the a
VOLATILE_PKGS,VOLATILE_DIR,VOLATILE_LINKin the appropriate recipes directly and then inherit the volatile class.Thoughts?
Good idea! It's cleaner and more manageable.
I'll investigate this idea more and try it out :)
Thanks,
Chen Qi
Quoted 12 lines
Sau!
Quoted 8 lines
Cheers,
Chen Qi
PATCH v8 6/6 volatile-conf-sato: add recipe
In reply to [email protected]From: Chen Qi <[email protected]>
This recipe provides a config file for core-image-sato. The config file is used to handle volatile storage in case of a read-only-rootfs image.
Also, let core-image-sato.bb depend on this recipe.
[YOCTO #3406]
--- meta/recipes-sato/images/core-image-sato.bb | 3 +++ .../files/volatiles-readonly-sato | 14 ++++++++++++++ .../volatile-conf-sato_1.0.bb | 15 +++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 meta/recipes-sato/readonly-volatile-conf/files/volatiles-readonly-sato create mode 100644 meta/recipes-sato/readonly-volatile-conf/volatile-conf-sato_1.0.bb
meta/recipes-sato/images/core-image-sato.bb +3 -0
@@ -6,6 +6,9 @@ IMAGE_FEATURES += "splash package-management x11-base x11-sato ssh-server-dropbe LICENSE = "MIT" +RDEPENDS += "volatile-conf-sato" +IMAGE_INSTALL += "volatile-conf-sato" + inherit core-image IMAGE_INSTALL += "packagegroup-core-x11-sato-games"
meta/recipes-sato/readonly-volatile-conf/files/volatiles-readonly-sato new file +14 -0
@@ -0,0 +1,14 @@ +# This configuration file lists filesystem objects specific to sato image +# with read-only rootfs. +# This configuration file will only be applied if the image is sato and the +# rootfs is read-only. +# For the detailed format information, refer to /etc/default/volatiles/00_core. +d root root 0755 /var/volatile/lib/ none +d root root 0755 /var/volatile/lib/urandom/ none +d root root 0755 /var/volatile/lib/dropbear/ none +d root root 0755 /var/volatile/lib/nfs/ none +d root root 0755 /var/volatile/lib/dbus/ none +l root root 0755 /var/lib/urandom /var/volatile/lib/urandom +l root root 0755 /var/lib/dropbear /var/volatile/lib/dropbear +l root root 0755 /var/lib/nfs /var/volatile/lib/nfs +l root root 0755 /var/lib/dbus /var/volatile/lib/dbus
meta/recipes-sato/readonly-volatile-conf/volatile-conf-sato_1.0.bb new file +15 -0
@@ -0,0 +1,15 @@ +SUMMARY = "Provide config files for core-image-sato" +DESCRIPTION = "This package contains a config file for core-image-sato. \ +It is used to handle volatile storage in case of a read-only rootfs." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = "file://volatiles-readonly-sato" + +PR = "r1" + +do_install () { + install -d ${D}${sysconfdir}/default/volatiles + install -m 0644 ${WORKDIR}/volatiles-readonly-sato ${D}${sysconfdir}/default/volatiles/00_core_readonly +}
Signature · 1 line
1.7.9.5