mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 05:09:24 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
a205c32dcb
commit
ab1171b512
@@ -35,8 +35,85 @@ RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
|
||||
|
||||
inherit cml1 update-rc.d
|
||||
|
||||
# internal helper
|
||||
def busybox_cfg(feature, features, tokens, cnf, rem):
|
||||
if type(tokens) == type(""):
|
||||
tokens = [tokens]
|
||||
rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
|
||||
if type(features) == type([]) and feature in features:
|
||||
cnf.extend([token + '=y' for token in tokens])
|
||||
else:
|
||||
cnf.extend(['# ' + token + ' is not set' for token in tokens])
|
||||
|
||||
# Map distro and machine features to config settings
|
||||
def features_to_busybox_settings(d):
|
||||
cnf, rem = ([], [])
|
||||
distro_features = bb.data.getVar('DISTRO_FEATURES', d).split()
|
||||
machine_features = bb.data.getVar('MACHINE_FEATURES', d).split()
|
||||
busybox_cfg('ipv6', distro_features, 'CONFIG_FEATURE_IPV6', cnf, rem)
|
||||
busybox_cfg('largefile', distro_features, 'CONFIG_LFS', cnf, rem)
|
||||
busybox_cfg('largefile', distro_features, 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
|
||||
busybox_cfg('nls', distro_features, 'CONFIG_LOCALE_SUPPORT', cnf, rem)
|
||||
busybox_cfg('ipv4', distro_features, 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem)
|
||||
busybox_cfg('ipv6', distro_features, 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem)
|
||||
busybox_cfg('kernel24', machine_features, 'CONFIG_FEATURE_2_4_MODULES', cnf, rem)
|
||||
return "\n".join(cnf), "\n".join(rem)
|
||||
|
||||
# X, Y = ${@features_to_uclibc_settings(d)}
|
||||
# unfortunately doesn't seem to work with bitbake, workaround:
|
||||
def features_to_busybox_conf(d):
|
||||
cnf, rem = features_to_busybox_settings(d)
|
||||
return cnf
|
||||
def features_to_busybox_del(d):
|
||||
cnf, rem = features_to_busybox_settings(d)
|
||||
return rem
|
||||
|
||||
configmangle = '/CROSS_COMPILER_PREFIX/d; \
|
||||
/CONFIG_EXTRA_CFLAGS/d; \
|
||||
'
|
||||
OE_FEATURES := "${@features_to_busybox_conf(d)}"
|
||||
OE_DEL := "${@features_to_busybox_del(d)}"
|
||||
DO_IPv4 := ${@base_contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)}
|
||||
DO_IPv6 := ${@base_contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}
|
||||
|
||||
python () {
|
||||
if "${OE_DEL}":
|
||||
bb.data.setVar('configmangle_append', "${OE_DEL}" + "\n", d)
|
||||
if "${OE_FEATURES}":
|
||||
bb.data.setVar('configmangle_append',
|
||||
"/^### DISTRO FEATURES$/a\\\n%s\n\n" %
|
||||
("\\n".join((bb.data.expand("${OE_FEATURES}", d).split("\n")))),
|
||||
d)
|
||||
bb.data.setVar('configmangle_append',
|
||||
"/^### CROSS$/a\\\n%s\n" %
|
||||
("\\n".join(["CONFIG_CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
|
||||
"CONFIG_EXTRA_CFLAGS=\"${CFLAGS}\""
|
||||
])
|
||||
),
|
||||
d)
|
||||
}
|
||||
|
||||
do_prepare_config () {
|
||||
sed -e 's#@DATADIR@#${datadir}#g' \
|
||||
< ${WORKDIR}/defconfig > ${S}/.config
|
||||
sed -i -e '/CONFIG_STATIC/d' .config
|
||||
echo "# CONFIG_STATIC is not set" >> .config
|
||||
for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \
|
||||
${S}/.config
|
||||
sed -i -e '${configmangle}' ${S}/.config
|
||||
if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then
|
||||
# disable networking applets
|
||||
mv ${S}/.config ${S}/.config.oe-tmp
|
||||
awk 'BEGIN{net=0}
|
||||
/^# Networking Utilities/{net=1}
|
||||
/^#$/{if(net){net=net+1}}
|
||||
{if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \
|
||||
${S}/.config.oe-tmp > ${S}/.config
|
||||
fi
|
||||
}
|
||||
|
||||
do_configure () {
|
||||
install -m 0644 ${WORKDIR}/defconfig ${S}/.config
|
||||
do_prepare_config
|
||||
cml1_do_configure
|
||||
}
|
||||
|
||||
@@ -184,4 +261,3 @@ pkg_prerm_${PN}-syslog () {
|
||||
update-alternatives --remove syslog-init syslog.${PN}
|
||||
update-alternatives --remove syslog-conf syslog.conf.${PN}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
require busybox.inc
|
||||
PR = "r2"
|
||||
PR = "r3"
|
||||
|
||||
SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
|
||||
file://udhcpscript.patch \
|
||||
|
||||
Reference in New Issue
Block a user