Skip to content

Commit 45f6998

Browse files
fix: local.conf is overwritten on script invocation
Users expect local.conf to remain unchanged after it is created, as this file is intended for their own custom modifications. To support this behavior, the configuration generated from the kas configuration files can be written to auto.conf instead of local.conf. Signed-off-by: Abin Joseph <abinjose@qti.qualcomm.com>
1 parent b2810a5 commit 45f6998

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

setup-environment

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ for key, value in env_vars.items():
110110

111111
cleanup() {
112112
[ -f .config.yaml ] && rm .config.yaml
113-
unset MACHINE DISTRO KERNEL CONFIG_FILES SKIP_SETUP
113+
[ -d "$KAS_BUILD_DIR" ] && rm -r "$KAS_BUILD_DIR"
114+
unset MACHINE DISTRO KERNEL CONFIG_FILES SKIP_SETUP KAS_BUILD_DIR
114115
}
115116

116117
init_env() {
@@ -130,6 +131,16 @@ init_env() {
130131
CONFIG_FILES="$CONFIG_FILES:$KERNEL"
131132
fi
132133

134+
# Temporary build directory should be in the same path
135+
# to ensure bblayers.conf relative referencing is consistent
136+
KAS_BUILD_DIR="$(mktemp -d -p "$PWD")" || \
137+
{
138+
cleanup
139+
echo "ERROR: Failure while setting up temporary directory"
140+
return 1
141+
}
142+
export KAS_BUILD_DIR
143+
133144
# invoking kas shell should auto-generate BitBake configuration
134145
# based on the kas local_conf_header
135146
echo "INFO: Setting up bitbake configuration."
@@ -167,6 +178,18 @@ init_env() {
167178
return 1
168179
}
169180

181+
mkdir -p build/conf
182+
# local.conf should be reserved for user specific changes.
183+
# Use auto.conf for auto-generated configuration.
184+
cp "$KAS_BUILD_DIR/conf/local.conf" build/conf/auto.conf
185+
cp "$KAS_BUILD_DIR/conf/bblayers.conf" build/conf/bblayers.conf
186+
187+
# The local.conf file auto‑generated by oe-init-build-env overrides the
188+
# MACHINE parameter defined in auto.conf. Create an empty local.conf to
189+
# prevent it from being auto-generated. An existing local.conf should
190+
# remain unchanged.
191+
touch build/conf/local.conf
192+
170193
echo "INFO: Cleaning up temporary contents."
171194
cleanup
172195

0 commit comments

Comments
 (0)