diff options
| author | Phil Blundell <pb@pbcl.net> | 2011-06-09 16:59:21 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-14 15:29:16 +0100 |
| commit | ab1171b512dc4a450324f6f0ea08a57489009c5f (patch) | |
| tree | ed6b58de98cb3c03c93ff61cf614c9a146516194 /meta/recipes-core/busybox | |
| parent | a205c32dcb229e30c5e8eead1472593fc8bc96a6 (diff) | |
| download | poky-ab1171b512dc4a450324f6f0ea08a57489009c5f.tar.gz | |
busybox: backport distro-features handling from oe master
This is a backport from oe master of the code which adjusts the busybox
config according to DISTRO_FEATURES etc.
(From OE-Core rev: b5564c4a9cadf306b447180c433b25ec071f8ce1)
Signed-off-by: Phil Blundell <philb@gnu.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/busybox')
| -rw-r--r-- | meta/recipes-core/busybox/busybox.inc | 80 | ||||
| -rw-r--r-- | meta/recipes-core/busybox/busybox_1.18.4.bb | 2 |
2 files changed, 79 insertions, 3 deletions
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 86fbdae2a5..b697e88221 100644 --- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc | |||
| @@ -35,8 +35,85 @@ RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc" | |||
| 35 | 35 | ||
| 36 | inherit cml1 update-rc.d | 36 | inherit cml1 update-rc.d |
| 37 | 37 | ||
| 38 | # internal helper | ||
| 39 | def busybox_cfg(feature, features, tokens, cnf, rem): | ||
| 40 | if type(tokens) == type(""): | ||
| 41 | tokens = [tokens] | ||
| 42 | rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens]) | ||
| 43 | if type(features) == type([]) and feature in features: | ||
| 44 | cnf.extend([token + '=y' for token in tokens]) | ||
| 45 | else: | ||
| 46 | cnf.extend(['# ' + token + ' is not set' for token in tokens]) | ||
| 47 | |||
| 48 | # Map distro and machine features to config settings | ||
| 49 | def features_to_busybox_settings(d): | ||
| 50 | cnf, rem = ([], []) | ||
| 51 | distro_features = bb.data.getVar('DISTRO_FEATURES', d).split() | ||
| 52 | machine_features = bb.data.getVar('MACHINE_FEATURES', d).split() | ||
| 53 | busybox_cfg('ipv6', distro_features, 'CONFIG_FEATURE_IPV6', cnf, rem) | ||
| 54 | busybox_cfg('largefile', distro_features, 'CONFIG_LFS', cnf, rem) | ||
| 55 | busybox_cfg('largefile', distro_features, 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem) | ||
| 56 | busybox_cfg('nls', distro_features, 'CONFIG_LOCALE_SUPPORT', cnf, rem) | ||
| 57 | busybox_cfg('ipv4', distro_features, 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem) | ||
| 58 | busybox_cfg('ipv6', distro_features, 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem) | ||
| 59 | busybox_cfg('kernel24', machine_features, 'CONFIG_FEATURE_2_4_MODULES', cnf, rem) | ||
| 60 | return "\n".join(cnf), "\n".join(rem) | ||
| 61 | |||
| 62 | # X, Y = ${@features_to_uclibc_settings(d)} | ||
| 63 | # unfortunately doesn't seem to work with bitbake, workaround: | ||
| 64 | def features_to_busybox_conf(d): | ||
| 65 | cnf, rem = features_to_busybox_settings(d) | ||
| 66 | return cnf | ||
| 67 | def features_to_busybox_del(d): | ||
| 68 | cnf, rem = features_to_busybox_settings(d) | ||
| 69 | return rem | ||
| 70 | |||
| 71 | configmangle = '/CROSS_COMPILER_PREFIX/d; \ | ||
| 72 | /CONFIG_EXTRA_CFLAGS/d; \ | ||
| 73 | ' | ||
| 74 | OE_FEATURES := "${@features_to_busybox_conf(d)}" | ||
| 75 | OE_DEL := "${@features_to_busybox_del(d)}" | ||
| 76 | DO_IPv4 := ${@base_contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)} | ||
| 77 | DO_IPv6 := ${@base_contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)} | ||
| 78 | |||
| 79 | python () { | ||
| 80 | if "${OE_DEL}": | ||
| 81 | bb.data.setVar('configmangle_append', "${OE_DEL}" + "\n", d) | ||
| 82 | if "${OE_FEATURES}": | ||
| 83 | bb.data.setVar('configmangle_append', | ||
| 84 | "/^### DISTRO FEATURES$/a\\\n%s\n\n" % | ||
| 85 | ("\\n".join((bb.data.expand("${OE_FEATURES}", d).split("\n")))), | ||
| 86 | d) | ||
| 87 | bb.data.setVar('configmangle_append', | ||
| 88 | "/^### CROSS$/a\\\n%s\n" % | ||
| 89 | ("\\n".join(["CONFIG_CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"", | ||
| 90 | "CONFIG_EXTRA_CFLAGS=\"${CFLAGS}\"" | ||
| 91 | ]) | ||
| 92 | ), | ||
| 93 | d) | ||
| 94 | } | ||
| 95 | |||
| 96 | do_prepare_config () { | ||
| 97 | sed -e 's#@DATADIR@#${datadir}#g' \ | ||
| 98 | < ${WORKDIR}/defconfig > ${S}/.config | ||
| 99 | sed -i -e '/CONFIG_STATIC/d' .config | ||
| 100 | echo "# CONFIG_STATIC is not set" >> .config | ||
| 101 | for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \ | ||
| 102 | ${S}/.config | ||
| 103 | sed -i -e '${configmangle}' ${S}/.config | ||
| 104 | if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then | ||
| 105 | # disable networking applets | ||
| 106 | mv ${S}/.config ${S}/.config.oe-tmp | ||
| 107 | awk 'BEGIN{net=0} | ||
| 108 | /^# Networking Utilities/{net=1} | ||
| 109 | /^#$/{if(net){net=net+1}} | ||
| 110 | {if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \ | ||
| 111 | ${S}/.config.oe-tmp > ${S}/.config | ||
| 112 | fi | ||
| 113 | } | ||
| 114 | |||
| 38 | do_configure () { | 115 | do_configure () { |
| 39 | install -m 0644 ${WORKDIR}/defconfig ${S}/.config | 116 | do_prepare_config |
| 40 | cml1_do_configure | 117 | cml1_do_configure |
| 41 | } | 118 | } |
| 42 | 119 | ||
| @@ -184,4 +261,3 @@ pkg_prerm_${PN}-syslog () { | |||
| 184 | update-alternatives --remove syslog-init syslog.${PN} | 261 | update-alternatives --remove syslog-init syslog.${PN} |
| 185 | update-alternatives --remove syslog-conf syslog.conf.${PN} | 262 | update-alternatives --remove syslog-conf syslog.conf.${PN} |
| 186 | } | 263 | } |
| 187 | |||
diff --git a/meta/recipes-core/busybox/busybox_1.18.4.bb b/meta/recipes-core/busybox/busybox_1.18.4.bb index a5080d5a47..a999490fbf 100644 --- a/meta/recipes-core/busybox/busybox_1.18.4.bb +++ b/meta/recipes-core/busybox/busybox_1.18.4.bb | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | require busybox.inc | 1 | require busybox.inc |
| 2 | PR = "r2" | 2 | PR = "r3" |
| 3 | 3 | ||
| 4 | SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | 4 | SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ |
| 5 | file://udhcpscript.patch \ | 5 | file://udhcpscript.patch \ |
