Skip to content

Commit 8c77c3d

Browse files
committed
core::busybox: make config file source more flexible
Add more options on how the config is gathered. Bring this in line with e.g. the linux kernel, where you could specify a custom package with a defconfig or a busybox defconfig or the standard defconfig. Note, the creation of debugging symbols now depends on the BASEMENT_DEBUG variable. If set, the CONFIG_DEBUG option is set automatically. Also only regenerate the .config if the source config has changed.
1 parent 92c6113 commit 8c77c3d

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

recipes/core/busybox.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ inherit: [make, install, kconfig, patch]
22

33
depends:
44
- if: "${BUSYBOX_CUSTOM_CONFIG:-}"
5-
name: core::busybox-custom-config
5+
name: "${BUSYBOX_CUSTOM_CONFIG_PKG:-core::busybox-custom-config}"
66

77
metaEnvironment:
88
PKG_VERSION: "1.37.0"
@@ -19,24 +19,43 @@ checkoutScript: |
1919
patchApplySeries $<@busybox/*.patch@>
2020
2121
buildTools: [host-toolchain, target-toolchain]
22-
buildVars: [ARCH, BUSYBOX_CUSTOM_CONFIG, CFLAGS, CROSS_COMPILE, LDFLAGS]
22+
buildVars: [BUSYBOX_CONFIG, BUSYBOX_CUSTOM_CONFIG, BUSYBOX_CUSTOM_CONFIG_PKG, BASEMENT_DEBUG,
23+
ARCH, CFLAGS, CROSS_COMPILE, LDFLAGS]
2324
buildScript: |
2425
# prevent timestamps in configuration
2526
export KCONFIG_NOTIMESTAMP=1
2627
2728
mkdir -p build install
2829
pushd build
2930
31+
# where does the config come from?
3032
if [[ ${BUSYBOX_CUSTOM_CONFIG:+true} ]] ; then
31-
cp -u "${BOB_DEP_PATHS[core::busybox-custom-config]}/${BUSYBOX_CUSTOM_CONFIG}" .config
32-
make -C $1 O=$PWD oldconfig
33+
PKG="${BUSYBOX_CUSTOM_CONFIG_PKG:-core::busybox-custom-config}"
34+
CFG="${BOB_DEP_PATHS[$PKG]}/$BUSYBOX_CUSTOM_CONFIG"
35+
elif [[ ${BUSYBOX_CONFIG:+true} ]] ; then
36+
CFG="$1/configs/${BUSYBOX_CONFIG}"
3337
else
34-
make -C $1 O=$PWD defconfig
35-
kconfigEnable CONFIG_DEBUG
36-
make -C $1 O=$PWD oldconfig
38+
CFG="defconfig"
3739
fi
38-
makeParallel
39-
make CONFIG_PREFIX=${BOB_CWD}/install install
40+
41+
# check if the defconfig exists
42+
if [[ ! -f "$CFG" ]]; then
43+
>&2 echo "Don't know how to use '$CFG' as busybox config!"
44+
false
45+
fi
46+
47+
# check if the source defconfig changed
48+
if [[ ! -f .config || .config -ot $CFG ]]; then
49+
cp -u $CFG .config
50+
# enable debug symbols if requested
51+
[[ ${BASEMENT_DEBUG:-0} != "0" ]] && kconfigEnable CONFIG_DEBUG
52+
make -C $1 O=$PWD \
53+
oldconfig
54+
fi
55+
56+
makeParallel CONFIG_PREFIX=${BOB_CWD}/install \
57+
install
58+
4059
popd #build
4160
4261
if [[ -f build/busybox_unstripped ]] ; then

0 commit comments

Comments
 (0)