aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2022-07-04 18:22:18 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2022-12-04 16:07:34 +0100
commited785589ea9a11d526a01067b79af4fe1b5dd5b7 (patch)
tree80d91312f3fc3d66b1d4b2d2d1efbbfc8558e861
parent1e764ea7df11e1d51e60336f420ca73480b8c055 (diff)
downloadupstream-ed785589ea9a11d526a01067b79af4fe1b5dd5b7.tar.gz
upstream-ed785589ea9a11d526a01067b79af4fe1b5dd5b7.tar.bz2
upstream-ed785589ea9a11d526a01067b79af4fe1b5dd5b7.zip
scripts: ext-toolchain: add option to overwrite config
It can be useful to overwrite an already generated config. Option are simply added at the end of the config and make defconfig will overwrite the relevant option with the new one. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit f4dd18ca39c42a324e34633c8ee553717531bc3b)
-rwxr-xr-xscripts/ext-toolchain.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh
index b52f170b32..c9ceb150c1 100755
--- a/scripts/ext-toolchain.sh
+++ b/scripts/ext-toolchain.sh
@@ -50,6 +50,7 @@ BIN_SPECS="
gdbserver: gdbserver
"
+OVERWRITE_CONFIG=""
test_c() {
cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null
@@ -320,9 +321,13 @@ print_config() {
fi
# bail out if there is a .config already
- if [ -f "${0%/scripts/*}/.config" ]; then
- echo "There already is a .config file, refusing to overwrite!" >&2
- return 1
+ if [ -f "$config" ]; then
+ if [ "$OVERWRITE_CONFIG" == "" ]; then
+ echo "There already is a .config file, refusing to overwrite!" >&2
+ return 1
+ else
+ echo "There already is a .config file, trying to overwrite!"
+ fi
fi
case "$mktarget" in */*)
@@ -330,8 +335,11 @@ print_config() {
mktarget="${mktarget%/*}"
;; esac
+ if [ ! -f "$config" ]; then
+ touch "$config"
+ fi
- echo "CONFIG_TARGET_${mktarget}=y" > "$config"
+ echo "CONFIG_TARGET_${mktarget}=y" >> "$config"
if [ -n "$mksubtarget" ]; then
echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config"
@@ -532,6 +540,10 @@ while [ -n "$1" ]; do
exit $?
;;
+ --overwrite-config)
+ OVERWRITE_CONFIG=y
+ ;;
+
--config)
if probe_cc; then
print_config "$1"
@@ -573,6 +585,8 @@ while [ -n "$1" ]; do
echo -e " is used to specify C flags to be passed to the " >&2
echo -e " cross compiler when performing tests." >&2
echo -e " This parameter may be repeated multiple times." >&2
+ echo -e " Use --overwrite-config before --config to overwrite" >&2
+ echo -e " an already present config with the required changes.">&2
exit 1
;;