Patchwork [V8,5/6] volatile-conf-minimal: add recipe

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Jan. 22, 2013, 6:36 a.m.
Message ID <55f028c6a820eca153b31716bc7b8516a77ef06f.1358836314.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/43131/
State New
Headers show

Comments

Qi.Chen@windriver.com - Jan. 22, 2013, 6:36 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

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 <Qi.Chen@windriver.com>
---
 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
Saul Wold - Jan. 22, 2013, 10:57 p.m.
On 01/21/2013 10:36 PM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> 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 <Qi.Chen@windriver.com>
> ---
>   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
>
> diff --git a/meta/recipes-core/images/core-image-minimal.bb b/meta/recipes-core/images/core-image-minimal.bb
> index 0d2613e..f6baeae 100644
> --- a/meta/recipes-core/images/core-image-minimal.bb
> +++ b/meta/recipes-core/images/core-image-minimal.bb
> @@ -6,6 +6,9 @@ IMAGE_LINGUAS = " "
>
>   LICENSE = "MIT"
>
> +RDEPENDS += "volatile-conf-minimal"
This needs to be RDEPENDS_${PN}

> +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!

>   inherit core-image
>
>   IMAGE_ROOTFS_SIZE = "8192"
> diff --git a/meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal b/meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal
> new file mode 100644
> index 0000000..b7146a2
> --- /dev/null
> +++ b/meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal
> @@ -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
> diff --git a/meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb b/meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb
> new file mode 100644
> index 0000000..c5744e1
> --- /dev/null
> +++ b/meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb
> @@ -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
> +}
>
Qi.Chen@windriver.com - Jan. 23, 2013, 3:24 a.m.
On 01/23/2013 06:57 AM, Saul Wold wrote:
> On 01/21/2013 10:36 PM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> 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 <Qi.Chen@windriver.com>
>> ---
>>   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
>>
>> diff --git a/meta/recipes-core/images/core-image-minimal.bb 
>> b/meta/recipes-core/images/core-image-minimal.bb
>> index 0d2613e..f6baeae 100644
>> --- a/meta/recipes-core/images/core-image-minimal.bb
>> +++ b/meta/recipes-core/images/core-image-minimal.bb
>> @@ -6,6 +6,9 @@ IMAGE_LINGUAS = " "
>>
>>   LICENSE = "MIT"
>>
>> +RDEPENDS += "volatile-conf-minimal"
> This needs to be RDEPENDS_${PN}
>
>> +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
Saul Wold - Jan. 23, 2013, 4:20 a.m.
On 01/22/2013 07:24 PM, ChenQi wrote:
> On 01/23/2013 06:57 AM, Saul Wold wrote:
>> On 01/21/2013 10:36 PM, Qi.Chen@windriver.com wrote:
>>> From: Chen Qi <Qi.Chen@windriver.com>
>>>
>>> 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 <Qi.Chen@windriver.com>
>>> ---
>>>   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
>>>
>>> diff --git a/meta/recipes-core/images/core-image-minimal.bb
>>> b/meta/recipes-core/images/core-image-minimal.bb
>>> index 0d2613e..f6baeae 100644
>>> --- a/meta/recipes-core/images/core-image-minimal.bb
>>> +++ b/meta/recipes-core/images/core-image-minimal.bb
>>> @@ -6,6 +6,9 @@ IMAGE_LINGUAS = " "
>>>
>>>   LICENSE = "MIT"
>>>
>>> +RDEPENDS += "volatile-conf-minimal"
>> This needs to be RDEPENDS_${PN}
>>
>>> +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?
>
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!

> Cheers,
> Chen Qi
>
>
>
>
>
>
Qi.Chen@windriver.com - Jan. 23, 2013, 4:52 a.m.
On 01/23/2013 12:20 PM, Saul Wold wrote:
> On 01/22/2013 07:24 PM, ChenQi wrote:
>> On 01/23/2013 06:57 AM, Saul Wold wrote:
>>> On 01/21/2013 10:36 PM, Qi.Chen@windriver.com wrote:
>>>> From: Chen Qi <Qi.Chen@windriver.com>
>>>>
>>>> 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 <Qi.Chen@windriver.com>
>>>> ---
>>>>   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
>>>>
>>>> diff --git a/meta/recipes-core/images/core-image-minimal.bb
>>>> b/meta/recipes-core/images/core-image-minimal.bb
>>>> index 0d2613e..f6baeae 100644
>>>> --- a/meta/recipes-core/images/core-image-minimal.bb
>>>> +++ b/meta/recipes-core/images/core-image-minimal.bb
>>>> @@ -6,6 +6,9 @@ IMAGE_LINGUAS = " "
>>>>
>>>>   LICENSE = "MIT"
>>>>
>>>> +RDEPENDS += "volatile-conf-minimal"
>>> This needs to be RDEPENDS_${PN}
>>>
>>>> +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?
>>
> 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?
>

Good idea! It's cleaner and more manageable.
I'll investigate this idea more and try it out :)

Thanks,
Chen Qi

> Sau!
>
>> Cheers,
>> Chen Qi
>>
>>
>>
>>
>>
>>
>
>

Patch

diff --git a/meta/recipes-core/images/core-image-minimal.bb b/meta/recipes-core/images/core-image-minimal.bb
index 0d2613e..f6baeae 100644
--- a/meta/recipes-core/images/core-image-minimal.bb
+++ b/meta/recipes-core/images/core-image-minimal.bb
@@ -6,6 +6,9 @@  IMAGE_LINGUAS = " "
 
 LICENSE = "MIT"
 
+RDEPENDS += "volatile-conf-minimal"
+IMAGE_INSTALL += "volatile-conf-minimal"
+
 inherit core-image
 
 IMAGE_ROOTFS_SIZE = "8192"
diff --git a/meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal b/meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal
new file mode 100644
index 0000000..b7146a2
--- /dev/null
+++ b/meta/recipes-core/readonly-volatile-conf/files/volatiles-readonly-minimal
@@ -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
diff --git a/meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb b/meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb
new file mode 100644
index 0000000..c5744e1
--- /dev/null
+++ b/meta/recipes-core/readonly-volatile-conf/volatile-conf-minimal_1.0.bb
@@ -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
+}