From: Chen Qi <qi.c...@windriver.com> 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] Signed-off-by: Chen Qi <qi.c...@windriver.com> --- meta/classes/image.bbclass | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index d3a416d..0cd49f0 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -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 -- 1.7.9.5 _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core