Skip to contentSkip to conversation

busybox: add config fragments

PATCH In review [email protected] 4 participants 14 messages Feb 1, 2013 – Feb 13, 2013

lore
Share & tools
lore
#0 lore raw

cover busybox: add config fragments

From: Chen Qi <[email protected]>

Test Cases
----------
1. Backward Compatibility
Operation:
No config fragments, build busybox

Expected Result:
Everything should be the same with before, especially the .config file

[Actual Result (Success/Fail): Success]

2. Single config fragment: enable a utility
Operation:
Add a config fragment which enables hostid functionality and build core-image-minimal

Expected Result:
hostid command on target could work

[Actual Result (Success/Fail): Success]

3. Multiple config fragments: enable utilities
Followed by test case 2, add a config fragment which enables cal and build minimal image

Expected Result:
cal command on target could work

[Actual Result (Success/Fail): Success]

4. Mutliple config fragments: enable some utilities and disable some utilities Operation:
Followed by test case 3, add a config fragment which disables and build minimal image

Expected Result:
vi command on target could not work

[Actual Result (Success/Fail): Success]

The following changes since commit 9a26b9c69c47c87ce71a06f76682c187767e7897:

rpm: Ensure native binaries are correctly wrapped (2013-01-30 14:47:30 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/busybox-config-fragments
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/busybox-config-fragments

Chen Qi (1):
busybox: add config fragments

 meta/recipes-core/busybox/busybox.inc |   45 +++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 busybox: add config fragments

From: Chen Qi <[email protected]>

Add config fragments to busybox.

Both the implementation and the use case are similar to yocto kernel's configuration fragments.

[YOCTO #3379]

---
 meta/recipes-core/busybox/busybox.inc |   45 +++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
meta/recipes-core/busybox/busybox.inc +45 -0
index 972e7d0..66044f8 100644
@@ -112,8 +112,53 @@ do_prepare_config () {
 	fi
 }
 
+# returns all the elements from the src uri that are .cfg files
+def find_cfgs(d):
+    sources=src_patches(d, True)
+    sources_list=[]
+    for s in sources:
+        if s.endswith('.cfg'):
+            sources_list.append(s)
+
+    return sources_list
+
+# Merge config fragments
+# All config fragments for busybox should end with .cfg
+do_merge_config() {
+        SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
+        MERGE_LIST="${@" ".join(find_cfgs(d))}"
+        if [ -n "$MERGE_LIST" ]; then
+                # Make a temp file, merge .config and .cfg files into it
+                TMP_FILE=`mktemp .tmp.config.XXXXXXXX`
+                cp .config $TMP_FILE
+                for MERGE_FILE in $MERGE_LIST; do
+                        CFG_LIST=`sed -n "${SED_CONFIG_EXP}" $MERGE_FILE`
+                        for CFG in $CFG_LIST ; do
+                                grep -q -w $CFG $TMP_FILE
+                                if [ $? -eq 0 ] ; then
+                                        PREV_VAL=`grep -w $CFG $TMP_FILE`
+                                        NEW_VAL=`grep -w $CFG $MERGE_FILE`
+                                        if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
+                                                echo Value of $CFG is redefined by fragment $MERGE_FILE:
+                                                echo Previous  value: $PREV_VAL
+                                                echo New value:       $NEW_VAL
+                                                echo
+                                        fi
+                                        sed -i "/$CFG[ =]/d" $TMP_FILE
+                                fi
+                        done
+                        echo >> $TMP_FILE
+                        cat $MERGE_FILE >> $TMP_FILE
+                done
+                # Copy the temp file to .config, do some cleanup
+		cp $TMP_FILE .config
+		rm $TMP_FILE
+        fi
+}
+
 do_configure () {
 	do_prepare_config
+	do_merge_config
 	cml1_do_configure
 }
 
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 7 lines · On Fri, Feb 1, 2013 at 4:00 AM, <[email protected]> wrote:

From: Chen Qi <[email protected]>

Add config fragments to busybox.

Both the implementation and the use case are similar to yocto kernel's configuration fragments.

I can fairly easily tweak the configuration parts of the kern-tools to handle this
use case as well. That would allow us to re-use the kernel's merge_config.sh script (with a minor dependency change) and save some duplicated code. It also gets you the advantage that you can consolidate configuration fragments outside of any build system, which isn't as critical here, but something that
is used quite a bit during kernel testing.

To be clear, I'm not talking about the entire kern-tools here, just the config parts.

Cheers,

Bruce

Quoted 82 lines

[YOCTO #3379]

---
 meta/recipes-core/busybox/busybox.inc |   45
+++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
meta/recipes-core/busybox/busybox.inc +14 -0
index 972e7d0..66044f8 100644
@@ -112,8 +112,53 @@ do_prepare_config () {
        fi
 }
 
+# returns all the elements from the src uri that are .cfg files
+def find_cfgs(d):
+    sources=src_patches(d, True)
+    sources_list=[]
+    for s in sources:
+        if s.endswith('.cfg'):
+            sources_list.append(s)
+
+    return sources_list
+
+# Merge config fragments
+# All config fragments for busybox should end with .cfg
+do_merge_config() {
+        SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[=

].*/\2/p"

meta/recipes-core/busybox/busybox.inc +13 -0
+        MERGE_LIST="${@" ".join(find_cfgs(d))}"
+        if [ -n "$MERGE_LIST" ]; then
+                # Make a temp file, merge .config and .cfg files into it
+                TMP_FILE=`mktemp .tmp.config.XXXXXXXX`
+                cp .config $TMP_FILE
+                for MERGE_FILE in $MERGE_LIST; do
+                        CFG_LIST=`sed -n "${SED_CONFIG_EXP}" $MERGE_FILE`
+                        for CFG in $CFG_LIST ; do
+                                grep -q -w $CFG $TMP_FILE
+                                if [ $? -eq 0 ] ; then
+                                        PREV_VAL=`grep -w $CFG $TMP_FILE`
+                                        NEW_VAL=`grep -w $CFG $MERGE_FILE`
+                                        if [ "x$PREV_VAL" != "x$NEW_VAL"

] ; then
+ echo Value of $CFG is
redefined by fragment $MERGE_FILE:
+ echo Previous value:
$PREV_VAL
+ echo New value:
$NEW_VAL

meta/recipes-core/busybox/busybox.inc +15 -1
+                                                echo
+                                        fi
+                                        sed -i "/$CFG[ =]/d" $TMP_FILE
+                                fi
+                        done
+                        echo >> $TMP_FILE
+                        cat $MERGE_FILE >> $TMP_FILE
+                done
+                # Copy the temp file to .config, do some cleanup
+               cp $TMP_FILE .config
+               rm $TMP_FILE
+        fi
+}
+
 do_configure () {
        do_prepare_config
+       do_merge_config
        cml1_do_configure
 }
 
--

1.7.9.5

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
#3 lore raw
Quoted 14 lines · Bruce Ashfield

On Fri, Feb 1, 2013 at 4:00 AM, <[email protected] <mailto:[email protected]>> wrote:

From: Chen Qi <[email protected] <mailto:[email protected]>>

Add config fragments to busybox.

Both the implementation and the use case are similar to yocto kernel's configuration fragments.

Quoted 9 lines

I can fairly easily tweak the configuration parts of the kern-tools to handle this
use case as well. That would allow us to re-use the kernel's merge_config.sh script (with a minor dependency change) and save some duplicated code. It also gets you the advantage that you can consolidate configuration fragments outside of any build system, which isn't as critical here, but something that
is used quite a bit during kernel testing.

Bruce,

Where is the merge_config.sh script today? Would you propose moving it to the scripts dir and have the busybox recipe call it?

What would be your timing on making such a change, ie hold this patch until your get it merge or merge this and then fix it when you merge your changes?

Sau!

Quoted 108 lines

To be clear, I'm not talking about the entire kern-tools here, just the config parts.

Cheers,

Bruce

[YOCTO #3379]

<mailto:[email protected]>>
---
meta/recipes-core/busybox/busybox.inc | 45
+++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 972e7d0..66044f8 100644
--- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc @@ -112,8 +112,53 @@ do_prepare_config () {
fi
}

+# returns all the elements from the src uri that are .cfg files +def find_cfgs(d):
+ sources=src_patches(d, True)
+ sources_list=[]
+ for s in sources:
+ if s.endswith('.cfg'):
+ sources_list.append(s)
+
+ return sources_list
+
+# Merge config fragments
+# All config fragments for busybox should end with .cfg +do_merge_config() {
+ SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[=
].*/\2/p"
+ MERGE_LIST="${@" ".join(find_cfgs(d))}"
+ if [ -n "$MERGE_LIST" ]; then
+ # Make a temp file, merge .config and .cfg files
into it
+ TMP_FILE=mktemp .tmp.config.XXXXXXXX
+ cp .config $TMP_FILE
+ for MERGE_FILE in $MERGE_LIST; do
+ CFG_LIST=`sed -n "${SED_CONFIG_EXP}"
$MERGE_FILE`
+ for CFG in $CFG_LIST ; do
+ grep -q -w $CFG $TMP_FILE
+ if [ $? -eq 0 ] ; then
+ PREV_VAL=`grep -w $CFG
$TMP_FILE`
+ NEW_VAL=`grep -w $CFG
$MERGE_FILE`
+ if [ "x$PREV_VAL" !=
"x$NEW_VAL" ] ; then
+ echo Value of $CFG
is redefined by fragment $MERGE_FILE:
+ echo Previous
value: $PREV_VAL
+ echo New value:
$NEW_VAL
+ echo
+ fi
+ sed -i "/$CFG[ =]/d" $TMP_FILE
+ fi
+ done
+ echo >> $TMP_FILE
+ cat $MERGE_FILE >> $TMP_FILE
+ done
+ # Copy the temp file to .config, do some cleanup
+ cp $TMP_FILE .config
+ rm $TMP_FILE
+ fi
+}
+
do_configure () {
do_prepare_config
+ do_merge_config
cml1_do_configure
}

--
1.7.9.5

_______________________________________________
Openembedded-core mailing list [email protected] <mailto:[email protected]>
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#4 lore raw
Quoted 29 lines · Saul Wold
Quoted 27 lines · Bruce Ashfield

On Fri, Feb 1, 2013 at 4:00 AM, <[email protected] <mailto:[email protected]>**> wrote:

From: Chen Qi <[email protected] <mailto:[email protected]>**

Quoted 1 line

Add config fragments to busybox.

Both the implementation and the use case are similar to yocto kernel's configuration fragments.

I can fairly easily tweak the configuration parts of the kern-tools to handle this
use case as well. That would allow us to re-use the kernel's merge_config.sh
script (with a minor dependency change) and save some duplicated code. It also gets you the advantage that you can consolidate configuration fragments
outside of any build system, which isn't as critical here, but something that
is used quite a bit during kernel testing.

Quoted 5 lines
Quoted 1 line

Bruce,

Where is the merge_config.sh script today? Would you propose moving it to the scripts dir and have the busybox recipe call it?

It's part of the mainline kernel, hence why grabbing the guts out of it reproducing
it here isn't the best idea, we'll have a need to keep them in sync. In fact, I have
2 or 3 pending patches for it in the kern-tools repository that I need to get upstream
(as an example).

I'd propose either creating a separate recipe for it (i.e. like kconfig-frontends) or I could
keep it in kern-tools (badly named, but we can work on that ;) and maintain / coordinate
changes to it.

I just don't want to see the effort happen twice, we are busy enough!

Quoted 5 lines

What would be your timing on making such a change, ie hold this patch until your get it merge or merge this and then fix it when you merge your changes?

I could feasibly get it done in the next few weeks, the changes aren't bug, I just
have to avoid regressions on either side (kernel or busy box).

That being said, the interface to the SRC_URI is the same for the two, so if we are
ok with me arriving and removing the in-recipe support, I guess I can't object too
much :) The only risk is that if anyone starts using this first support immediately,
I do risk regressing their use case, where if it never goes in, that won't happen.

Cheers,

Bruce

Quoted 117 lines

Sau!

To be clear, I'm not talking about the entire kern-tools here, just the

Quoted 113 lines

config parts.

Cheers,

Bruce

[YOCTO #3379]

<mailto:[email protected]>**>

---
meta/recipes-core/busybox/**busybox.inc | 45
++++++++++++++++++++++++++++++**+++
1 file changed, 45 insertions(+)

diff --git a/meta/recipes-core/busybox/**busybox.inc b/meta/recipes-core/busybox/**busybox.inc index 972e7d0..66044f8 100644
--- a/meta/recipes-core/busybox/**busybox.inc +++ b/meta/recipes-core/busybox/**busybox.inc @@ -112,8 +112,53 @@ do_prepare_config () {
fi
}

+# returns all the elements from the src uri that are .cfg files +def find_cfgs(d):
+ sources=src_patches(d, True)
+ sources_list=[]
+ for s in sources:
+ if s.endswith('.cfg'):
+ sources_list.append(s)
+
+ return sources_list
+
+# Merge config fragments
+# All config fragments for busybox should end with .cfg +do_merge_config() {
+ SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]***\)[=
].*/\2/p"
+ MERGE_LIST="${@" ".join(find_cfgs(d))}"
+ if [ -n "$MERGE_LIST" ]; then
+ # Make a temp file, merge .config and .cfg files
into it
+ TMP_FILE=mktemp .tmp.config.XXXXXXXX
+ cp .config $TMP_FILE
+ for MERGE_FILE in $MERGE_LIST; do
+ CFG_LIST=`sed -n "${SED_CONFIG_EXP}"
$MERGE_FILE`
+ for CFG in $CFG_LIST ; do
+ grep -q -w $CFG $TMP_FILE
+ if [ $? -eq 0 ] ; then
+ PREV_VAL=`grep -w $CFG
$TMP_FILE`
+ NEW_VAL=`grep -w $CFG
$MERGE_FILE`
+ if [ "x$PREV_VAL" !=
"x$NEW_VAL" ] ; then
+ echo Value of $CFG
is redefined by fragment $MERGE_FILE:
+ echo Previous
value: $PREV_VAL
+ echo New value:
$NEW_VAL
+ echo
+ fi
+ sed -i "/$CFG[ =]/d"
$TMP_FILE
+ fi
+ done
+ echo >> $TMP_FILE
+ cat $MERGE_FILE >> $TMP_FILE
+ done
+ # Copy the temp file to .config, do some cleanup
+ cp $TMP_FILE .config
+ rm $TMP_FILE
+ fi
+}
+
do_configure () {
do_prepare_config
+ do_merge_config
cml1_do_configure
}

--
1.7.9.5

______________________________**_________________
Openembedded-core mailing list Openembedded-core@lists.**openembedded.org<[email protected]> <mailto:Openembedded-core@**lists.openembedded.org<[email protected]>

Quoted 1 line

http://lists.linuxtogo.org/**cgi-bin/mailman/listinfo/**
openembedded-core<http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core>

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

______________________________**_________________
Openembedded-core mailing list Openembedded-core@lists.**openembedded.org<[email protected]>
http://lists.linuxtogo.org/**cgi-bin/mailman/listinfo/**openembedded-core<http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core>

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
author
#5 lore raw
Quoted 52 lines · Bruce Ashfield

On Fri, Feb 1, 2013 at 1:56 PM, Saul Wold <[email protected] <mailto:[email protected]>> wrote:

On 02/01/2013 06:18 AM, Bruce Ashfield wrote:

On Fri, Feb 1, 2013 at 4:00 AM, <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:

From: Chen Qi <[email protected]
<mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>

Add config fragments to busybox.

Both the implementation and the use case are similar to
yocto kernel's
configuration fragments.

I can fairly easily tweak the configuration parts of the kern-tools to
handle this
use case as well. That would allow us to re-use the kernel's merge_config.sh
script (with a minor dependency change) and save some duplicated code. It
also gets you the advantage that you can consolidate configuration fragments
outside of any build system, which isn't as critical here, but something
that
is used quite a bit during kernel testing.

Bruce,

Where is the merge_config.sh script today? Would you propose moving it to the scripts dir and have the busybox recipe call it?

It's part of the mainline kernel, hence why grabbing the guts out of it reproducing it here isn't the best idea, we'll have a need to keep them in sync. In fact, I have 2 or 3 pending patches for it in the kern-tools repository that I need to get upstream (as an example).

Quoted 5 lines

I'd propose either creating a separate recipe for it (i.e. like kconfig-frontends) or I could keep it in kern-tools (badly named, but we can work on that ;) and maintain / coordinate changes to it.

I just don't want to see the effort happen twice, we are busy enough!

I thought about keeping the codes in sync but couldn't figure out a nice way. It would be great if you do so.

Thanks in advance :)

Best Regards,
Chen Qi

Quoted 149 lines

What would be your timing on making such a change, ie hold this patch until your get it merge or merge this and then fix it when you merge your changes?

I could feasibly get it done in the next few weeks, the changes aren't bug, I just have to avoid regressions on either side (kernel or busy box).

That being said, the interface to the SRC_URI is the same for the two, so if we are ok with me arriving and removing the in-recipe support, I guess I can't object too much :) The only risk is that if anyone starts using this first support immediately, I do risk regressing their use case, where if it never goes in, that won't happen.

Cheers,

Bruce

Sau!

To be clear, I'm not talking about the entire kern-tools here, just the
config parts.

Cheers,

Bruce

[YOCTO #3379]

<mailto:[email protected]>
<mailto:[email protected]
<mailto:[email protected]>>>

---
meta/recipes-core/busybox/busybox.inc | 45
+++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 972e7d0..66044f8 100644
--- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc @@ -112,8 +112,53 @@ do_prepare_config () {
fi
}

+# returns all the elements from the src uri that are .cfg
files
+def find_cfgs(d):
+ sources=src_patches(d, True)
+ sources_list=[]
+ for s in sources:
+ if s.endswith('.cfg'):
+ sources_list.append(s)
+
+ return sources_list
+
+# Merge config fragments
+# All config fragments for busybox should end with .cfg +do_merge_config() {
+ SED_CONFIG_EXP="s/^\(#
\)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[=
].*/\2/p"
+ MERGE_LIST="${@" ".join(find_cfgs(d))}"
+ if [ -n "$MERGE_LIST" ]; then
+ # Make a temp file, merge .config and
.cfg files
into it
+ TMP_FILE=mktemp .tmp.config.XXXXXXXX
+ cp .config $TMP_FILE
+ for MERGE_FILE in $MERGE_LIST; do
+ CFG_LIST=`sed -n "${SED_CONFIG_EXP}"
$MERGE_FILE`
+ for CFG in $CFG_LIST ; do
+ grep -q -w $CFG $TMP_FILE
+ if [ $? -eq 0 ] ; then
+ PREV_VAL=`grep -w $CFG
$TMP_FILE`
+ NEW_VAL=`grep -w $CFG
$MERGE_FILE`
+ if [ "x$PREV_VAL" !=
"x$NEW_VAL" ] ; then
+ echo Value of $CFG
is redefined by fragment $MERGE_FILE:
+ echo Previous
value: $PREV_VAL
+ echo New value:
$NEW_VAL
+ echo
+ fi
+ sed -i "/$CFG[
=]/d" $TMP_FILE
+ fi
+ done
+ echo >> $TMP_FILE
+ cat $MERGE_FILE >> $TMP_FILE
+ done
+ # Copy the temp file to .config, do some
cleanup
+ cp $TMP_FILE .config
+ rm $TMP_FILE
+ fi
+}
+
do_configure () {
do_prepare_config
+ do_merge_config
cml1_do_configure
}

--
1.7.9.5

_______________________________________________
Openembedded-core mailing list
[email protected] <mailto:[email protected]>
<mailto:[email protected]
<mailto:[email protected]>>

http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

--
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"

_______________________________________________
Openembedded-core mailing list [email protected] <mailto:[email protected]>
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 1 line
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
author
#6 lore raw
In reply to Bruce Ashfield
Quoted 67 lines · Bruce Ashfield

On Fri, Feb 1, 2013 at 1:56 PM, Saul Wold <[email protected] <mailto:[email protected]>> wrote:

On 02/01/2013 06:18 AM, Bruce Ashfield wrote:

On Fri, Feb 1, 2013 at 4:00 AM, <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:

From: Chen Qi <[email protected]
<mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>

Add config fragments to busybox.

Both the implementation and the use case are similar to
yocto kernel's
configuration fragments.

I can fairly easily tweak the configuration parts of the kern-tools to
handle this
use case as well. That would allow us to re-use the kernel's merge_config.sh
script (with a minor dependency change) and save some duplicated code. It
also gets you the advantage that you can consolidate configuration fragments
outside of any build system, which isn't as critical here, but something
that
is used quite a bit during kernel testing.

Bruce,

Where is the merge_config.sh script today? Would you propose moving it to the scripts dir and have the busybox recipe call it?

It's part of the mainline kernel, hence why grabbing the guts out of it reproducing it here isn't the best idea, we'll have a need to keep them in sync. In fact, I have 2 or 3 pending patches for it in the kern-tools repository that I need to get upstream (as an example).

I'd propose either creating a separate recipe for it (i.e. like kconfig-frontends) or I could keep it in kern-tools (badly named, but we can work on that ;) and maintain / coordinate changes to it.

I just don't want to see the effort happen twice, we are busy enough!

What would be your timing on making such a change, ie hold this patch until your get it merge or merge this and then fix it when you merge your changes?

I could feasibly get it done in the next few weeks, the changes aren't bug, I just have to avoid regressions on either side (kernel or busy box).

Quoted 10 lines

That being said, the interface to the SRC_URI is the same for the two, so if we are ok with me arriving and removing the in-recipe support, I guess I can't object too much :) The only risk is that if anyone starts using this first support immediately, I do risk regressing their use case, where if it never goes in, that won't happen.

Cheers,

Bruce

Hi Bruce,

I just tried to reuse the kernel's merge_config.sh script, and it turned out well. The patch is in attachment.

Is it enough for now?
If so, I'll send out the patch.

Thanks,
Chen Qi

From a9d36bf24f349f046e9b65ccf4af3352c4dedabf Mon Sep 17 00:00:00 2001
From: Chen Qi <[email protected]>
Date: Tue, 5 Feb 2013 14:36:40 +0800
Subject: [PATCH] busybox: add config fragments

Add config fragments to busybox.

The implementation makes use of merge_config.sh script in kern-tools-native. The use case is similar to the yocto kernel's configuration fragments.

[YOCTO #3379]

---
 meta/recipes-core/busybox/busybox.inc |   13 +++++++++++++
 1 file changed, 13 insertions(+)
meta/recipes-core/busybox/busybox.inc +13 -0
index 972e7d0..6ed5e09 100644
@@ -37,6 +37,8 @@ RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
 
 inherit cml1 update-rc.d
 
+do_config[depends] = "kern-tools-native:do_populate_sysroot"
+
 # internal helper
 def busybox_cfg(feature, features, tokens, cnf, rem):
 	if type(tokens) == type(""):
@@ -112,8 +114,19 @@ do_prepare_config () {
 	fi
 }
 
+# returns all the elements from the src uri that are .cfg files
+def find_cfgs(d):
+    sources=src_patches(d, True)
+    sources_list=[]
+    for s in sources:
+        if s.endswith('.cfg'):
+            sources_list.append(s)
+
+    return sources_list
+
 do_configure () {
 	do_prepare_config
+	merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
 	cml1_do_configure
 }
 
Signature · 1 line
1.7.9.5
#7 lore raw
Quoted 85 lines · ChenQi

On 02/02/2013 03:08 AM, Bruce Ashfield wrote:

Quoted 30 lines · Saul Wold
Quoted 28 lines · Bruce Ashfield

On Fri, Feb 1, 2013 at 4:00 AM, <[email protected]
<mailto:[email protected]>> wrote:

From: Chen Qi <[email protected] <mailto:[email protected]>>

Add config fragments to busybox.

Both the implementation and the use case are similar to yocto
kernel's
configuration fragments.

I can fairly easily tweak the configuration parts of the kern-tools to handle this
use case as well. That would allow us to re-use the kernel's merge_config.sh
script (with a minor dependency change) and save some duplicated code. It also gets you the advantage that you can consolidate configuration fragments
outside of any build system, which isn't as critical here, but something that
is used quite a bit during kernel testing.

Quoted 5 lines
Quoted 1 line

Bruce,

Where is the merge_config.sh script today? Would you propose moving it to the scripts dir and have the busybox recipe call it?

It's part of the mainline kernel, hence why grabbing the guts out of it
reproducing
it here isn't the best idea, we'll have a need to keep them in sync. In fact, I have
2 or 3 pending patches for it in the kern-tools repository that I need to get upstream
(as an example).

I'd propose either creating a separate recipe for it (i.e. like
kconfig-frontends) or I could
keep it in kern-tools (badly named, but we can work on that ;) and maintain / coordinate
changes to it.

I just don't want to see the effort happen twice, we are busy enough!

Quoted 5 lines

What would be your timing on making such a change, ie hold this patch until your get it merge or merge this and then fix it when you merge your changes?

I could feasibly get it done in the next few weeks, the changes aren't
bug, I just
have to avoid regressions on either side (kernel or busy box).

That being said, the interface to the SRC_URI is the same for the two,
so if we are
ok with me arriving and removing the in-recipe support, I guess I can't object too
much :) The only risk is that if anyone starts using this first support immediately,
I do risk regressing their use case, where if it never goes in, that won't happen.

Cheers,

Bruce

Quoted 8 lines

Hi Bruce,

I just tried to reuse the kernel's merge_config.sh script, and it turned out well.
The patch is in attachment.

Is it enough for now?

Yep, this is enough for now. It re-uses the significant part of the infrastructure, which
is the important part. Once it is in tree, I can refine the dependency and some other
minor modifications.

Feel free to add my Signed-off-by: to the patch as well.

Cheers,

Bruce

Quoted 5 lines

If so, I'll send out the patch.

Thanks,
Chen Qi

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
#8 lore raw
Quoted 81 lines · Bruce Ashfield

On Tue, Feb 5, 2013 at 1:42 AM, ChenQi <[email protected]> wrote:
On 02/02/2013 03:08 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 1:56 PM, Saul Wold
> <[email protected]> wrote:
> On 02/01/2013 06:18 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 4:00 AM,
> <[email protected]
> <mailto:[email protected]>> wrote:
> <mailto:[email protected]>>
> Both the implementation and the use case
> are similar to yocto kernel's
> configuration fragments.
> I can fairly easily tweak the configuration
> parts of the kern-tools to
> handle this
> use case as well. That would allow us to
> re-use the kernel's merge_config.sh
> script (with a minor dependency change) and
> save some duplicated code. It
> also gets you the advantage that you can
> consolidate configuration fragments
> outside of any build system, which isn't as
> critical here, but something
> that
> is used quite a bit during kernel testing.
> Bruce,
>
> Where is the merge_config.sh script today? Would
> you propose moving it to the scripts dir and have
> the busybox recipe call it?
>
>
> It's part of the mainline kernel, hence why grabbing the > guts out of it reproducing
> it here isn't the best idea, we'll have a need to keep them > in sync. In fact, I have
> 2 or 3 pending patches for it in the kern-tools repository > that I need to get upstream
> (as an example).
>
>
> I'd propose either creating a separate recipe for it (i.e. > like kconfig-frontends) or I could
> keep it in kern-tools (badly named, but we can work on > that ;) and maintain / coordinate
> changes to it.
>
>
> I just don't want to see the effort happen twice, we are > busy enough!
>
>
> What would be your timing on making such a change,
> ie hold this patch until your get it merge or merge
> this and then fix it when you merge your changes?

> I could feasibly get it done in the next few weeks, the > changes aren't bug, I just
> have to avoid regressions on either side (kernel or busy > box).

> That being said, the interface to the SRC_URI is the same > for the two, so if we are
> ok with me arriving and removing the in-recipe support, I > guess I can't object too
> much :) The only risk is that if anyone starts using this > first support immediately,
> I do risk regressing their use case, where if it never goes > in, that won't happen.

> Cheers,
> Bruce

Hi Bruce,

I just tried to reuse the kernel's merge_config.sh script, and it turned out well.
The patch is in attachment.

Is it enough for now?

Quoted 7 lines

Yep, this is enough for now. It re-uses the significant part of the infrastructure, which
is the important part. Once it is in tree, I can refine the dependency and some other
minor modifications.

Feel free to add my Signed-off-by: to the patch as well.

This patch triggers a failure on the autobuilder:

http://autobuilder.yoctoproject.org:8010/builders/p1022ds/builds/246/steps/shell_59/logs/stdio

(its reproducible, this is the second one now)

I suspect there is a missing DEPENDS += "kern-tools-native".

You'd be able to reproduce this with a:

bitbake busybox kern-tools-native; bitbake busybox kern-tools-native -c clean; bitbake busybox

Cheers,

Richard

#9 lore raw
Quoted 88 lines · Richard Purdie
Quoted 87 lines · Bruce Ashfield

On Tue, Feb 5, 2013 at 1:42 AM, ChenQi <[email protected]> wrote:
On 02/02/2013 03:08 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 1:56 PM, Saul Wold
> <[email protected]> wrote:
> On 02/01/2013 06:18 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 4:00 AM,
> <[email protected]
> <mailto:[email protected]>> wrote:
> <mailto:[email protected]>>
> Both the implementation and the use case
> are similar to yocto kernel's
> configuration fragments.
> I can fairly easily tweak the configuration
> parts of the kern-tools to
> handle this
> use case as well. That would allow us to
> re-use the kernel's merge_config.sh
> script (with a minor dependency change) and
> save some duplicated code. It
> also gets you the advantage that you can
> consolidate configuration fragments
> outside of any build system, which isn't as
> critical here, but something
> that
> is used quite a bit during kernel testing.
> Bruce,
>
> Where is the merge_config.sh script today? Would
> you propose moving it to the scripts dir and have
> the busybox recipe call it?
>
>
> It's part of the mainline kernel, hence why grabbing the > guts out of it reproducing
> it here isn't the best idea, we'll have a need to keep them > in sync. In fact, I have
> 2 or 3 pending patches for it in the kern-tools repository > that I need to get upstream
> (as an example).
>
>
> I'd propose either creating a separate recipe for it (i.e. > like kconfig-frontends) or I could
> keep it in kern-tools (badly named, but we can work on > that ;) and maintain / coordinate
> changes to it.
>
>
> I just don't want to see the effort happen twice, we are > busy enough!
>
>
> What would be your timing on making such a change,
> ie hold this patch until your get it merge or merge
> this and then fix it when you merge your changes?

> I could feasibly get it done in the next few weeks, the > changes aren't bug, I just
> have to avoid regressions on either side (kernel or busy > box).

> That being said, the interface to the SRC_URI is the same > for the two, so if we are
> ok with me arriving and removing the in-recipe support, I > guess I can't object too
> much :) The only risk is that if anyone starts using this > first support immediately,
> I do risk regressing their use case, where if it never goes > in, that won't happen.

> Cheers,
> Bruce

Hi Bruce,

I just tried to reuse the kernel's merge_config.sh script, and it turned out well.
The patch is in attachment.

Is it enough for now?

Yep, this is enough for now. It re-uses the significant part of the infrastructure, which
is the important part. Once it is in tree, I can refine the dependency and some other
minor modifications.

Quoted 3 lines
Quoted 1 line

Feel free to add my Signed-off-by: to the patch as well.

This patch triggers a failure on the autobuilder:

Hmmm. I didn't realize this had been picked up yet, I was waiting for a repost with the Sign-offs. I assume this is master under test ? I can pick up the patch from there and send an updated patch, since Chen Qi won't be around to look into this for a few days.

Cheers,

Bruce

Quoted 7 lines

http://autobuilder.yoctoproject.org:8010/builders/p1022ds/builds/246/steps/shell_59/logs/stdio

(its reproducible, this is the second one now)

I suspect there is a missing DEPENDS += "kern-tools-native".

Quoted 9 lines

You'd be able to reproduce this with a:

bitbake busybox kern-tools-native; bitbake busybox kern-tools-native -c clean; bitbake busybox

Cheers,

Richard

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

#10 lore raw
Quoted 90 lines · Bruce Ashfield
Quoted 88 lines · Richard Purdie
Quoted 87 lines · Bruce Ashfield

On Tue, Feb 5, 2013 at 1:42 AM, ChenQi <[email protected]> wrote:
On 02/02/2013 03:08 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 1:56 PM, Saul Wold
> <[email protected]> wrote:
> On 02/01/2013 06:18 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 4:00 AM,
> <[email protected]
> <mailto:[email protected]>> wrote:
> <mailto:[email protected]>>
> Both the implementation and the use case
> are similar to yocto kernel's
> configuration fragments.
> I can fairly easily tweak the configuration
> parts of the kern-tools to
> handle this
> use case as well. That would allow us to
> re-use the kernel's merge_config.sh
> script (with a minor dependency change) and
> save some duplicated code. It
> also gets you the advantage that you can
> consolidate configuration fragments
> outside of any build system, which isn't as
> critical here, but something
> that
> is used quite a bit during kernel testing.
> Bruce,
>
> Where is the merge_config.sh script today? Would
> you propose moving it to the scripts dir and have
> the busybox recipe call it?
>
>
> It's part of the mainline kernel, hence why grabbing the > guts out of it reproducing
> it here isn't the best idea, we'll have a need to keep them > in sync. In fact, I have
> 2 or 3 pending patches for it in the kern-tools repository > that I need to get upstream
> (as an example).
>
>
> I'd propose either creating a separate recipe for it (i.e. > like kconfig-frontends) or I could
> keep it in kern-tools (badly named, but we can work on > that ;) and maintain / coordinate
> changes to it.
>
>
> I just don't want to see the effort happen twice, we are > busy enough!
>
>
> What would be your timing on making such a change,
> ie hold this patch until your get it merge or merge
> this and then fix it when you merge your changes?

> I could feasibly get it done in the next few weeks, the > changes aren't bug, I just
> have to avoid regressions on either side (kernel or busy > box).

> That being said, the interface to the SRC_URI is the same > for the two, so if we are
> ok with me arriving and removing the in-recipe support, I > guess I can't object too
> much :) The only risk is that if anyone starts using this > first support immediately,
> I do risk regressing their use case, where if it never goes > in, that won't happen.

> Cheers,
> Bruce

Hi Bruce,

I just tried to reuse the kernel's merge_config.sh script, and it turned out well.
The patch is in attachment.

Is it enough for now?

Yep, this is enough for now. It re-uses the significant part of the infrastructure, which
is the important part. Once it is in tree, I can refine the dependency and some other
minor modifications.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Feel free to add my Signed-off-by: to the patch as well.

This patch triggers a failure on the autobuilder:

Hmmm. I didn't realize this had been picked up yet, I was waiting for a repost with the Sign-offs. I assume this is master under test ? I can pick up the patch from there and send an updated patch, since Chen Qi won't be around to look into this for a few days.

It was master under test, it won't make master until it works :)

I don't mind who sends me the working version.

Cheers,

Richard

#11 lore raw
Quoted 95 lines · Richard Purdie
Quoted 94 lines · Bruce Ashfield
Quoted 91 lines · Richard Purdie
Quoted 81 lines · Bruce Ashfield

On Tue, Feb 5, 2013 at 1:42 AM, ChenQi <[email protected]> wrote:
On 02/02/2013 03:08 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 1:56 PM, Saul Wold
> <[email protected]> wrote:
> On 02/01/2013 06:18 AM, Bruce Ashfield wrote:
> On Fri, Feb 1, 2013 at 4:00 AM,
> <[email protected]
> <mailto:[email protected]>> wrote:
> <mailto:[email protected]>>
> Both the implementation and the use case
> are similar to yocto kernel's
> configuration fragments.
> I can fairly easily tweak the configuration
> parts of the kern-tools to
> handle this
> use case as well. That would allow us to
> re-use the kernel's merge_config.sh
> script (with a minor dependency change) and
> save some duplicated code. It
> also gets you the advantage that you can
> consolidate configuration fragments
> outside of any build system, which isn't as
> critical here, but something
> that
> is used quite a bit during kernel testing.
> Bruce,
>
> Where is the merge_config.sh script today? Would
> you propose moving it to the scripts dir and have
> the busybox recipe call it?
>
>
> It's part of the mainline kernel, hence why grabbing the > guts out of it reproducing
> it here isn't the best idea, we'll have a need to keep them > in sync. In fact, I have
> 2 or 3 pending patches for it in the kern-tools repository > that I need to get upstream
> (as an example).
>
>
> I'd propose either creating a separate recipe for it (i.e. > like kconfig-frontends) or I could
> keep it in kern-tools (badly named, but we can work on > that ;) and maintain / coordinate
> changes to it.
>
>
> I just don't want to see the effort happen twice, we are > busy enough!
>
>
> What would be your timing on making such a change,
> ie hold this patch until your get it merge or merge
> this and then fix it when you merge your changes?

> I could feasibly get it done in the next few weeks, the > changes aren't bug, I just
> have to avoid regressions on either side (kernel or busy > box).

> That being said, the interface to the SRC_URI is the same > for the two, so if we are
> ok with me arriving and removing the in-recipe support, I > guess I can't object too
> much :) The only risk is that if anyone starts using this > first support immediately,
> I do risk regressing their use case, where if it never goes > in, that won't happen.

> Cheers,
> Bruce

Hi Bruce,

I just tried to reuse the kernel's merge_config.sh script, and it turned out well.
The patch is in attachment.

Is it enough for now?

Quoted 7 lines

Yep, this is enough for now. It re-uses the significant part of the infrastructure, which
is the important part. Once it is in tree, I can refine the dependency and some other
minor modifications.

Feel free to add my Signed-off-by: to the patch as well.

This patch triggers a failure on the autobuilder:

Quoted 8 lines
Quoted 4 lines

Hmmm. I didn't realize this had been picked up yet, I was waiting for a repost with the Sign-offs. I assume this is master under test ? I can pick up the patch from there and send an updated patch, since Chen Qi won't be around to look into this for a few days.

It was master under test, it won't make master until it works :)

I don't mind who sends me the working version.

Attached is the fixed up patch with DEPENDS, the existing one had a typo in:

do_config[depends] = "kern-tools-native:do_populate_sysroot"

I've gone ahead and replaced it with a DEPENDS and tested the failure case here.

This is a complete patch replacement, let me know if you'd prefer something incremental.

Cheers,

Bruce

Quoted 7 lines

Cheers,

Richard

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

From 1dc48ba9872afc12d822c3c399b4bd4af042d07c Mon Sep 17 00:00:00 2001
From: Chen Qi <[email protected]>
Date: Tue, 5 Feb 2013 14:36:40 +0800
Subject: [PATCH] busybox: add config fragments

Add config fragments to busybox.

The implementation makes use of merge_config.sh script in kern-tools-native. The use case is similar to the yocto kernel's configuration fragments.

We also add kern-tools-native to busybox's DEPENDS variable to ensure that merge_config.sh is available when required.

[YOCTO #3379]

---
 meta/recipes-core/busybox/busybox.inc |   13 +++++++++++++
 1 file changed, 13 insertions(+)
meta/recipes-core/busybox/busybox.inc +13 -0
index 972e7d0..b656a92 100644
@@ -37,6 +37,8 @@ RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
 
 inherit cml1 update-rc.d
 
+DEPENDS = "kern-tools-native"
+
 # internal helper
 def busybox_cfg(feature, features, tokens, cnf, rem):
 	if type(tokens) == type(""):
@@ -112,8 +114,19 @@ do_prepare_config () {
 	fi
 }
 
+# returns all the elements from the src uri that are .cfg files
+def find_cfgs(d):
+    sources=src_patches(d, True)
+    sources_list=[]
+    for s in sources:
+        if s.endswith('.cfg'):
+            sources_list.append(s)
+
+    return sources_list
+
 do_configure () {
 	do_prepare_config
+	merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
 	cml1_do_configure
 }
 
Signature · 1 line
1.7.10.4
#12 lore raw
Quoted 10 lines · Bruce Ashfield

Attached is the fixed up patch with DEPENDS, the existing one had a typo in:

do_config[depends] = "kern-tools-native:do_populate_sysroot"

I've gone ahead and replaced it with a DEPENDS and tested the failure case here.

This is a complete patch replacement, let me know if you'd prefer something incremental.

DEPENDS should be towards the start of the file and/or use =+ in case something in one of the classes also sets DEPENDS. I tweaked and merged it since I don't really want to review it again ;-).

Cheers,

Richard

#13 lore raw
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Bruce Ashfield

Attached is the fixed up patch with DEPENDS, the existing one had a typo in:

do_config[depends] = "kern-tools-native:do_populate_sysroot"

I've gone ahead and replaced it with a DEPENDS and tested the failure case here.

Quoted 6 lines
Quoted 2 lines

This is a complete patch replacement, let me know if you'd prefer something incremental.

DEPENDS should be towards the start of the file and/or use =+ in case something in one of the classes also sets DEPENDS. I tweaked and merged it since I don't really want to review it again ;-).

Sounds good, thanks for the += addition, as for the location, I just put it right
over the spot of the old dependency, since it wasn't going out of my way to clean parts not related to the immediate fix :)

Cheers,

Bruce

Quoted 5 lines

Cheers,

Richard

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"