read-only rootfs support
v6 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.
The following changes since commit 4a36a32567ecfbc7ce7b967803e6e23314953ef5:
libpng: fix packaging (2012-12-26 11:34:09 +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 two funtions to support readonly rootfs core-image.bbclass: support read-only rootfs
initscripts: support read-only rootfs
core-image-minimal: support read-only rootfs
core-image-sato: support read-only rootfs
meta/classes/core-image.bbclass | 5 +- meta/classes/image.bbclass | 29 +- meta/recipes-core/images/core-image-minimal.bb | 10 + .../images/files/volatiles-readonly-minimal | 8 + .../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 | 5 +- 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 | 8 + .../images/files/volatiles-readonly-sato | 14 + 12 files changed, 215 insertions(+), 161 deletions(-) create mode 100644 meta/recipes-core/images/files/volatiles-readonly-minimal create mode 100644 meta/recipes-sato/images/files/volatiles-readonly-sato
Signature · 1 line
1.7.9.5
PATCH v6 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 v6 2/6 image.bbclass: add two funtions 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.
choose_volatile_conf: this function is exported and should be overriden by the specific image recipe. Config files specific to read-only rootfs are closely related to the image types. So these config file should be provided by the corresponding image recipes.
In addition, this function adds support to customized config files for customized images.
[YOCTO #3406]
--- meta/classes/image.bbclass | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
meta/classes/image.bbclass +24 -5
@@ -167,6 +167,7 @@ inherit ${IMAGE_CLASSES} IMAGE_POSTPROCESS_COMMAND ?= "" MACHINE_POSTPROCESS_COMMAND ?= "" ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; " +ROOTFS_POSTPROCESS_COMMAND_prepend = "choose_volatile_conf; " # some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
@@ -185,6 +186,11 @@ do_build[nostamp] = "1" # task, so that we have a single fakeroot context for the whole process. do_rootfs[umask] = "022" +choose_volatile_conf () { + # This task should be overriden by the specific image recipe. + # It is used to install the correct conf file for volatile storage + # handling to support read-only rootfs. +} run_intercept_scriptlets () { if [ -d ${WORKDIR}/intercept_scripts ]; then
@@ -396,6 +402,21 @@ zap_root_password () { mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd } +# A hook function to support read-only-rootfs IMAGE_FEATURES +read_only_rootfs_hook () { + # 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 +} + # allow openssh accept login with empty password string openssh_allow_empty_password () { if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
@@ -458,11 +479,9 @@ rootfs_trim_schemas () { done } -EXPORT_FUNCTIONS zap_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup +EXPORT_FUNCTIONS zap_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup choose_volatile_conf -do_fetch[noexec] = "1" -do_unpack[noexec] = "1" -do_patch[noexec] = "1" +# do_fetch, do_unpack and do_patch are needed to copy conf files to workdir do_configure[noexec] = "1" do_compile[noexec] = "1" do_install[noexec] = "1"
@@ -472,4 +491,4 @@ do_package_write_ipk[noexec] = "1" do_package_write_deb[noexec] = "1" do_package_write_rpm[noexec] = "1" -addtask rootfs before do_build +addtask rootfs before do_build after do_patch
Signature · 1 line
1.7.9.5
Re: [PATCH V6 2/6] image.bbclass: add two funtions to support readonly rootfs
Quoted 82 lines · On 01/06/2013 01:44 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.
choose_volatile_conf: this function is exported and should be overriden by the specific image recipe. Config files specific to read-only rootfs are closely related to the image types. So these config file should be provided by the corresponding image recipes.
In addition, this function adds support to customized config files for customized images.[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/classes/image.bbclass | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)meta/classes/image.bbclass +23
-4@@ -167,6 +167,7 @@ inherit ${IMAGE_CLASSES} IMAGE_POSTPROCESS_COMMAND ?= "" MACHINE_POSTPROCESS_COMMAND ?= "" ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; " +ROOTFS_POSTPROCESS_COMMAND_prepend = "choose_volatile_conf; " # some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb"@@ -185,6 +186,11 @@ do_build[nostamp] = "1" # task, so that we have a single fakeroot context for the whole process. do_rootfs[umask] = "022" +choose_volatile_conf () { + # This task should be overriden by the specific image recipe. + # It is used to install the correct conf file for volatile storage + # handling to support read-only rootfs. +} run_intercept_scriptlets () { if [ -d ${WORKDIR}/intercept_scripts ]; then@@ -396,6 +402,21 @@ zap_root_password () { mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd } +# A hook function to support read-only-rootfs IMAGE_FEATURES +read_only_rootfs_hook () { + # 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 +} + # allow openssh accept login with empty password string openssh_allow_empty_password () { if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then@@ -458,11 +479,9 @@ rootfs_trim_schemas () { done } -EXPORT_FUNCTIONS zap_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup +EXPORT_FUNCTIONS zap_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup choose_volatile_conf -do_fetch[noexec] = "1" -do_unpack[noexec] = "1" -do_patch[noexec] = "1" +# do_fetch, do_unpack and do_patch are needed to copy conf files to workdir do_configure[noexec] = "1" do_compile[noexec] = "1" do_install[noexec] = "1"
meta/classes/image.bbclass do_package_write_ipk[noexec] = "1" · line 494
Quoted 5 lines
meta/classes/image.bbclass +1
-1@@ -472,4 +491,4 @@ do_package_write_ipk[noexec] = "1" do_package_write_deb[noexec] = "1" do_package_write_rpm[noexec] = "1" -addtask rootfs before do_build +addtask rootfs before do_build after do_patch
Why is this needed, and will it continue to be needed if we move to the *-volatile-conf packages?
Sau!
Re: [PATCH V6 2/6] image.bbclass: add two funtions to support readonly rootfs
Quoted 91 lines · Saul Wold
Quoted 90 lines · On 01/06/2013 01:44 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.
choose_volatile_conf: this function is exported and should be overriden by the specific image recipe. Config files specific to read-only rootfs are closely related to the image types. So these config file should be provided by the corresponding image recipes.
In addition, this function adds support to customized config files for customized images.[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/classes/image.bbclass | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)meta/classes/image.bbclass +1
-0@@ -167,6 +167,7 @@ inherit ${IMAGE_CLASSES} IMAGE_POSTPROCESS_COMMAND ?= "" MACHINE_POSTPROCESS_COMMAND ?= "" ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; " +ROOTFS_POSTPROCESS_COMMAND_prepend = "choose_volatile_conf; " # some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb"@@ -185,6 +186,11 @@ do_build[nostamp] = "1" # task, so that we have a single fakeroot context for the wholeprocess.
do_rootfs[umask] = "022"meta/classes/image.bbclass +3
-0+choose_volatile_conf () { + # This task should be overriden by the specific image recipe. + # It is used to install the correct conf file for volatilestorage
meta/classes/image.bbclass +9
-0+ # handling to support read-only rootfs. +} run_intercept_scriptlets () { if [ -d ${WORKDIR}/intercept_scripts ]; then@@ -396,6 +402,21 @@ zap_root_password () { mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd } +# A hook function to support read-only-rootfs IMAGE_FEATURES +read_only_rootfs_hook () { + # 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
meta/classes/image.bbclass +8
-1+ 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 +} + # allow openssh accept login with empty password string openssh_allow_empty_password () { if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then@@ -458,11 +479,9 @@ rootfs_trim_schemas () { done } -EXPORT_FUNCTIONS zap_root_password remove_init_link do_rootfs
make_zimage_symlink_relativeset_image_autologinrootfs_update_timestamprootfs_no_x_startup+EXPORT_FUNCTIONSzap_root_passwordremove_init_linkdo_rootfsmake_zimage_symlink_relativeset_image_autologinrootfs_update_timestamprootfs_no_x_startupchoose_volatile_confmeta/classes/image.bbclass +1
-3-do_fetch[noexec] = "1" -do_unpack[noexec] = "1" -do_patch[noexec] = "1" +# do_fetch, do_unpack and do_patch are needed to copy conf files toworkdir
do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_install[noexec] = "1"meta/classes/image.bbclass +0
-0@@ -472,4 +491,4 @@ do_package_write_ipk[noexec] = "1" do_package_write_deb[noexec] = "1" do_package_write_rpm[noexec] = "1"
Quoted 5 lines
meta/classes/image.bbclass do_package_write_ipk[noexec] = "1" · line 494
Quoted 3 lines
meta/classes/image.bbclass +1
-1-addtask rootfs before do_build +addtask rootfs before do_build after do_patchWhy is this needed, and will it continue to be needed if we move to the *-volatile-conf packages?
The read_only_rootfs_hook function is always needed.
The choose_volatile_conf function is not needed any more if we move to the *-volatile-conf package.
Thanks,
Chen Qi
Quoted 4 lines
Sau!
PATCH v6 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes/core-image.bbclass +3 -2
@@ -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"
@@ -73,9 +74,9 @@ inherit image # Create /etc/timestamp during image construction to give a reasonably sane default time setting 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)}' # Allow openssh accept empty password login if both debug-tweaks and ssh-server-openssh are enabled ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks ssh-server-openssh", "openssh_allow_empty_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
Re: [PATCH V6 3/6] core-image.bbclass: support read-only rootfs
Quoted 25 lines · On Sun, Jan 06, 2013 at 05:44:25PM +0800, [email protected] wrote:
From: Chen Qi <[email protected]>
The hook function is appended to
ROOTFS_POSTPROCESS_COMMANDproperly to support the 'read-only-rootfs' image feature.[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/classes/core-image.bbclass | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)meta/classes/core-image.bbclass +1
-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"
meta/classes/core-image.bbclass inherit image · line 81
Quoted 10 lines
meta/classes/core-image.bbclass +1
-2@@ -73,9 +74,9 @@ inherit image # Create /etc/timestamp during image construction to give a reasonably sane default time setting 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)}' # Allow openssh accept empty password login if both debug-tweaks and ssh-server-openssh are enabled ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks ssh-server-openssh", "openssh_allow_empty_password; ", "",d)}' - +# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled
This read_only_rootfs_hook does more than that, please update comment
Cheers,
Quoted 9 lines
meta/classes/core-image.bbclass +1
-0+ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'Signature · 7 lines
1.7.9.5 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [PATCH V6 3/6] core-image.bbclass: support read-only rootfs
Quoted 38 lines · Martin Jansa
Quoted 25 lines · On Sun, Jan 06, 2013 at 05:44:25PM +0800, [email protected] wrote:
From: Chen Qi <[email protected]>
The hook function is appended to
ROOTFS_POSTPROCESS_COMMANDproperly to support the 'read-only-rootfs' image feature.[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>--- meta/classes/core-image.bbclass | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)meta/classes/core-image.bbclass +1
-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"meta/classes/core-image.bbclass inherit image · line 81
Quoted 10 lines
meta/classes/core-image.bbclass +1
-2@@ -73,9 +74,9 @@ inherit image # Create /etc/timestamp during image construction to give a reasonably sane default time setting 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)}' # Allow openssh accept empty password login if both debug-tweaks and ssh-server-openssh are enabled ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks ssh-server-openssh", "openssh_allow_empty_password; ", "",d)}' - +# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabledThis
read_only_rootfs_hookdoes more than that, please update comment
Quoted 2 lines
Cheers,
Thank you for your kindly reminding.
I've modified the comment and sent out this patch again.
Cheers,
Chen Qi
Quoted 9 lines
Quoted 9 lines
meta/classes/core-image.bbclass +1
-0+ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'Signature · 7 lines
1.7.9.5 _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
PATCH v6 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 | 5 +- 4 files changed, 143 insertions(+), 153 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 +3 -2
@@ -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 = "r138" +PR = "r139" INHIBIT_DEFAULT_DEPS = "1"
@@ -31,7 +31,7 @@ SRC_URI = "file://functions \ file://populate-volatile.sh \ file://volatiles \ file://save-rtc.sh \ - file://GPLv2.patch" + file://GPLv2.patch" SRC_URI_append_arm = " file://alignment.sh"
@@ -86,6 +86,7 @@ do_install () { install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core + if [ "${TARGET_ARCH}" = "arm" ]; then install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d fi
Signature · 1 line
1.7.9.5
PATCH v6 5/6 core-image-minimal: support read-only rootfs
In reply to [email protected]From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile storage.
[YOCTO #3406]
--- meta/recipes-core/images/core-image-minimal.bb | 10 ++++++++++ .../images/files/volatiles-readonly-minimal | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 meta/recipes-core/images/files/volatiles-readonly-minimal
meta/recipes-core/images/core-image-minimal.bb +10 -0
@@ -6,9 +6,19 @@ IMAGE_LINGUAS = " " LICENSE = "MIT" +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://volatiles-readonly-minimal" + inherit core-image IMAGE_ROOTFS_SIZE = "8192" # remove not needed ipkg informations ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; " + +# install read-only rootfs specific conf file for minimal image +choose_volatile_conf () { + cp ${WORKDIR}/volatiles-readonly-minimal \ + ${IMAGE_ROOTFS}/etc/default/volatiles/00_core_readonly +}
meta/recipes-core/images/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
Signature · 1 line
1.7.9.5
PATCH v6 6/6 core-image-sato: support read-only rootfs
In reply to [email protected]From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile storage.
[YOCTO #3406]
--- meta/recipes-sato/images/core-image-sato.bb | 8 ++++++++ .../images/files/volatiles-readonly-sato | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 meta/recipes-sato/images/files/volatiles-readonly-sato
meta/recipes-sato/images/core-image-sato.bb +8 -0
@@ -6,6 +6,14 @@ IMAGE_FEATURES += "splash package-management x11-base x11-sato ssh-server-dropbe LICENSE = "MIT" +SRC_URI += "file://volatiles-readonly-sato" + inherit core-image IMAGE_INSTALL += "packagegroup-core-x11-sato-games" + +# install read-only rootfs specific conf file for sato image +choose_volatile_conf () { + cp ${WORKDIR}/volatiles-readonly-sato \ + ${IMAGE_ROOTFS}/etc/default/volatiles/00_core_readonly +}
meta/recipes-sato/images/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
Signature · 1 line
1.7.9.5
Re: [PATCH V6 6/6] core-image-sato: support read-only rootfs
Quoted 7 lines · On Sun, Jan 6, 2013 at 7:44 AM, <[email protected]> wrote:
From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile storage.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>
I prefer this solution than the previous one however why you don't use a sato-volatile-conf package to provide this?
--
Otavio Salvador O.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Re: [PATCH V6 6/6] core-image-sato: support read-only rootfs
Quoted 10 lines · Otavio Salvador
Quoted 7 lines · On Sun, Jan 6, 2013 at 7:44 AM, <[email protected]> wrote:
From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile storage.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>I prefer this solution than the previous one however why you don't use a sato-volatile-conf package to provide this?
Because the there exists a one-to-one (or almost one-to-one) correspondence between the volatile conf file and the specific image.
If there is a 'sato-volatile-conf' package, then there should be a 'minimal-volatile-conf', and maybe a 'custom-volatile-conf' if users are using a customized image.
So I think it's simpler to let the image recipe provide the conf file.
The only thing we have to do, when adding read-only rootfs support to some image, is to add the conf file to SRC_URI and install it in choose_volatile_conf.
Kind Regards,
Chen Qi
Quoted 7 lines
--
Otavio SalvadorO.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Re: [PATCH V6 6/6] core-image-sato: support read-only rootfs
Quoted 19 lines · ChenQi
Quoted 8 lines · Otavio Salvador
Quoted 6 lines · On Sun, Jan 6, 2013 at 7:44 AM, <[email protected]> wrote:
From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile storage.
Quoted 6 lines
Quoted 3 lines
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>I prefer this solution than the previous one however why you don't use a sato-volatile-conf package to provide this?
Because the there exists a one-to-one (or almost one-to-one) correspondence between the volatile conf file and the specific image.
Quoted 8 lines
If there is a 'sato-volatile-conf' package, then there should be a 'minimal-volatile-conf', and maybe a 'custom-volatile-conf' if users are using a customized image.
So I think it's simpler to let the image recipe provide the conf file. The only thing we have to do, when adding read-only rootfs support to some image, is to add the conf file to
SRC_URIand install it inchoose_volatile_conf.
The problem of not using a package for it is regarding upgrades; it is not possible to upgrade the configuration file using the package manager. I know most systems using the read-only-fs will be small and do not use a package manager at all but some use cases will do (mine, in case).
So I do believe we ought to have a one-to-one correspondence here.
--
Otavio Salvador O.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Re: [PATCH V6 6/6] core-image-sato: support read-only rootfs
Quoted 24 lines · Otavio Salvador
Quoted 15 lines · ChenQi
Quoted 11 lines · Otavio Salvador
Quoted 8 lines · On Sun, Jan 6, 2013 at 7:44 AM, <[email protected]> wrote:
From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile storage.
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>I prefer this solution than the previous one however why you don't use a sato-volatile-conf package to provide this?
Because the there exists a one-to-one (or almost one-to-one) correspondence between the volatile conf file and the specific image.
Quoted 8 lines
If there is a 'sato-volatile-conf' package, then there should be a 'minimal-volatile-conf', and maybe a 'custom-volatile-conf' if users are using a customized image.
So I think it's simpler to let the image recipe provide the conf file. The only thing we have to do, when adding read-only rootfs support to some image, is to add the conf file to
SRC_URIand install it inchoose_volatile_conf.
Quoted 5 lines
The problem of not using a package for it is regarding upgrades; it is not possible to upgrade the configuration file using the package manager. I know most systems using the read-only-fs will be small and do not use a package manager at all but some use cases will do (mine, in case).
Sounds reasonable.
I'll think about it :)
Thanks,
Chen Qi
Quoted 8 lines
So I do believe we ought to have a one-to-one correspondence here.
--
Otavio SalvadorO.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Re: [PATCH V6 6/6] core-image-sato: support read-only rootfs
Quoted 28 lines · ChenQi
Quoted 27 lines · Otavio Salvador
Quoted 26 lines · ChenQi
Quoted 7 lines · Otavio Salvador
Quoted 6 lines · On Sun, Jan 6, 2013 at 7:44 AM, <[email protected]> wrote:
From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile
storage.Quoted 5 lines
Quoted 3 lines
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>I prefer this solution than the previous one however why you don't use a sato-volatile-conf package to provide this?
Because the there exists a one-to-one (or almost one-to-one) correspondence
between the volatile conf file and the specific image.If there is a 'sato-volatile-conf' package, then there should be a 'minimal-volatile-conf', and maybe a 'custom-volatile-conf' if users are using a customized image.
So I think it's simpler to let the image recipe provide the conf file. The only thing we have to do, when adding read-only rootfs support to some
image, is to add the conf file toSRC_URIand install it inchoose_volatile_conf.
Quoted 8 lines
Quoted 5 lines
The problem of not using a package for it is regarding upgrades; it is not possible to upgrade the configuration file using the package manager. I know most systems using the read-only-fs will be small and do not use a package manager at all but some use cases will do (mine, in case).
Sounds reasonable.
I'll think about it :)
+1 for creating a *-volatile-conf package instead of having it buried in the image recipe.
Sau!
Quoted 19 lines
Thanks,
Chen QiQuoted 8 lines
So I do believe we ought to have a one-to-one correspondence here.
--
Otavio SalvadorO.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Re: [PATCH V6 6/6] core-image-sato: support read-only rootfs
Quoted 34 lines · Saul Wold
Quoted 33 lines · ChenQi
Quoted 32 lines · Otavio Salvador
Quoted 21 lines · ChenQi
Quoted 7 lines · Otavio Salvador
Quoted 6 lines · On Sun, Jan 6, 2013 at 7:44 AM, <[email protected]> wrote:
From: Chen Qi <[email protected]>
Support read-only rootfs by providing a specific conf file for volatile
storage.Quoted 5 lines
Quoted 3 lines
[YOCTO #3406]
Signed-off-by Chen Qi <[email protected]>I prefer this solution than the previous one however why you don't use a sato-volatile-conf package to provide this?
Because the there exists a one-to-one (or almost one-to-one) correspondence
between the volatile conf file and the specific image.If there is a 'sato-volatile-conf' package, then there should be a 'minimal-volatile-conf', and maybe a 'custom-volatile-conf' if users are using a customized image.
Quoted 5 lines
So I think it's simpler to let the image recipe provide the conf file. The only thing we have to do, when adding read-only rootfs support to some
image, is to add the conf file toSRC_URIand install it inchoose_volatile_conf.The problem of not using a package for it is regarding upgrades; it is not possible to upgrade the configuration file using the package manager. I know most systems using the read-only-fs will be small and do not use a package manager at all but some use cases will do (mine, in case).
Quoted 7 lines
Quoted 3 lines
Sounds reasonable.
I'll think about it :)+1 for creating a *-volatile-conf package instead of having it buried in the image recipe.
I'll rework on it and send out the patch again.
Thanks for your review :)
Cheers,
Chen Qi
Quoted 22 lines
Sau!
Quoted 19 lines
Thanks,
Chen QiQuoted 8 lines
So I do believe we ought to have a one-to-one correspondence here.
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: [email protected] http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core