Bug 3379 - Add config fragment support to busybox
Summary: Add config fragment support to busybox
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.4
Hardware: All Multiple
: Low enhancement
Target Milestone: 1.4 M5
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2012-11-02 09:29 UTC by Paul Eggleton
Modified: 2013-03-01 06:29 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2012-11-02 09:29:16 UTC
We've discussed a few times the possibility of adding config fragments to busybox for more easily enabling blocks of functionality (as we can with the kernel). Here's one reference:

http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/016217.html
Comment 1 Chen Qi 2012-11-05 10:46:06 UTC
Is it something like adding a menuconfig support for it?
Comment 2 Paul Eggleton 2012-12-04 15:23:39 UTC
Not really, no - this is about adding config fragments like we have for the linux-yocto kernel recipe so you can e.g. enable a number of options by adding a file containing just those options to SRC_URI (and not the whole defconfig).
Comment 3 Chen Qi 2013-01-24 02:36:36 UTC
Change Milestone to 1.4M5
Comment 4 Chen Qi 2013-02-01 09:11:43 UTC
Both the implementation and the use case are very similar to yocto kernel's config fragments.
Comment 5 Darren Hart 2013-02-01 16:11:01 UTC
Chen Qi,

This should involve copying the mergeconfig script from the upstream Linux kernel into busybox and using config fragments identical in format to those in the linux-yocto kernel to assemble a final config. Additional tooling may be desired around that, but for now we should be keeping it simple and sticking to mergeconfig.

mergeconfig is now used by the yocto kernel tools as well.
Comment 6 Chen Qi 2013-02-05 06:44:39 UTC
Hi Darren,

Thank you for reminding me of this.
I just implemented a short patch using this method.

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 972e7d0..6ed5e09 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -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
 }
 
Is it enough?

Thanks,
Chen Qi
Comment 7 Darren Hart 2013-02-05 18:30:52 UTC
I would rather see merge_config.sh patched into busybox than make busybox depend on kern-tools-native. It is a VERY simple shell script (which I wrote a lot of) so the dependency is overkill. 

This is a good start, but ultimately we need to add the fragments for all the nasty configure logic in the existing recipe as well.

Did you perform any testing here?
Comment 8 Chen Qi 2013-02-18 06:07:49 UTC
merged into poky/master: 56dc1720caa48344238d352c7b6e9b0f0d41aa54

http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=bbcd8b344598850ea2c8d3ad375c519713581fde
Comment 9 Yi Zhao 2013-03-01 06:29:35 UTC
Verified with master branch: 0bedc0b80d9b46cbbf4a2c5e120a6aa52cbc7c2e

Steps:
1. Add a new cal.cfg file to meta/recipes-core/busybox/busybox-1.20.2/
$ cat cal.cfg 
CONFIG_CAL=y

2. Run "bitbake busybox"
Check the build/tmp/work/armv5te-poky-linux-gnueabi/busybox/1.20.2-r5/busybox-1.20.2/.config file.
The CONFIG_CAL should be set to y.

3. Run "bitbake core-image-minimal"
Boot up the image, the cal command should be exist.
root@qemuarm:~# which cal
/usr/bin/cal
root@qemuarm:~# ls -l /usr/bin/cal 
lrwxrwxrwx    1 root     root            12 Mar  1 06:17 /usr/bin/cal -> /bin/busybox
root@qemuarm:~#