Openembedded Core Discussions
 help / color / mirror / Atom feed
From: ChenQi <Qi.Chen@windriver.com>
To: Saul Wold <sgw@linux.intel.com>
Cc: Zhenfeng.Zhao@windriver.com, openembedded-core@lists.openembedded.org
Subject: Re: [PATCH V6 2/6] image.bbclass: add two funtions to support readonly rootfs
Date: Mon, 14 Jan 2013 10:34:37 +0800	[thread overview]
Message-ID: <50F36EBD.5070903@windriver.com> (raw)
In-Reply-To: <50F0A151.20609@linux.intel.com>

On 01/12/2013 07:33 AM, Saul Wold wrote:
> On 01/06/2013 01:44 AM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@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.Chen@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
>>
> Why 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

> Sau!
>
>
>




  reply	other threads:[~2013-01-14  2:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06  9:44 [PATCH V6 0/6] read-only rootfs support Qi.Chen
2013-01-06  9:44 ` [PATCH V6 1/6] sysvinit: add ROOTFS_READ_ONLY variable to rcS-default Qi.Chen
2013-01-06  9:44 ` [PATCH V6 2/6] image.bbclass: add two funtions to support readonly rootfs Qi.Chen
2013-01-11 23:33   ` Saul Wold
2013-01-14  2:34     ` ChenQi [this message]
2013-01-06  9:44 ` [PATCH V6 3/6] core-image.bbclass: support read-only rootfs Qi.Chen
2013-01-06  9:52   ` Martin Jansa
2013-01-07  3:14     ` ChenQi
2013-01-06  9:44 ` [PATCH V6 4/6] initscripts: " Qi.Chen
2013-01-06  9:44 ` [PATCH V6 5/6] core-image-minimal: " Qi.Chen
2013-01-06  9:44 ` [PATCH V6 6/6] core-image-sato: " Qi.Chen
2013-01-06 19:05   ` Otavio Salvador
2013-01-07  3:06     ` ChenQi
2013-01-07 10:30       ` Otavio Salvador
2013-01-08  2:22         ` ChenQi
2013-01-11 23:32           ` Saul Wold
2013-01-14  2:35             ` ChenQi

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=50F36EBD.5070903@windriver.com \
    --to=qi.chen@windriver.com \
    --cc=Zhenfeng.Zhao@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=sgw@linux.intel.com \
    /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