Write opts to .config

This commit is contained in:
2023-01-27 16:46:45 -05:00
parent eaae9e8e9c
commit 37771a7b81

View File

@@ -603,7 +603,7 @@ fromSource() {
declare src_url="https://github.com/openwrt/openwrt.git" declare src_url="https://github.com/openwrt/openwrt.git"
declare pkg kopt declare pkg kopt
declare -a make_opts declare -a make_opts config_opts
declare -g SEED_FILE="$GITWORKTREEDIR/.config" declare -g SEED_FILE="$GITWORKTREEDIR/.config"
echo "Building from source is under development" echo "Building from source is under development"
@@ -637,26 +637,30 @@ fromSource() {
# Add custom packages # Add custom packages
for pkg in ${P_ARR[packages]:+}; do for pkg in ${P_ARR[packages]:+}; do
if [[ $pkg == -* ]]; then if [[ $pkg == -* ]]; then
make_opts+=("CONFIG_PACKAGE_${pkg#-}=n") # remove package config_opts+=("CONFIG_PACKAGE_${pkg#-}=n") # remove package
else else
make_opts+=("CONFIG_PACKAGE_$pkg=y") # add package config_opts+=("CONFIG_PACKAGE_$pkg=y") # add package
fi fi
done done
# Add kopts from profile # Add kopts from profile
for kopt in ${P_ARR[kopts]:+}; do for kopt in ${P_ARR[kopts]:+}; do
make_opts+=("$kopt") config_opts+=("$kopt")
done done
# Only compile this target # Only compile this target
sed -i '/CONFIG_TARGET_DEVICE_/d' "$SEED_FILE" sed -i '/CONFIG_TARGET_DEVICE_/d' "$SEED_FILE"
make_opts+=("CONFIG_TARGET_MULTI_PROFILE=n") config_opts+=("CONFIG_TARGET_MULTI_PROFILE=n")
make_opts+=("CONFIG_TARGET_ALL_PROFILES=n") config_opts+=("CONFIG_TARGET_ALL_PROFILES=n")
make_opts+=("CONFIG_SDK=n") config_opts+=("CONFIG_SDK=n")
make_opts+=("CONFIG_SDK_LLVM_BPF=n") config_opts+=("CONFIG_SDK_LLVM_BPF=n")
make_opts+=("CONFIG_TARGET_DEVICE_${P_ARR[target]//\//_}_DEVICE_${P_ARR[profile]}=y") config_opts+=("CONFIG_TARGET_DEVICE_${P_ARR[target]//\//_}_DEVICE_${P_ARR[profile]}=y")
make_opts+=("CONFIG_BINARY_FOLDER=\"$THIS_BINDIR\"") config_opts+=("CONFIG_BINARY_FOLDER=\"$THIS_BINDIR\"")
(( DEBUG )) && make_opts+=("V=s")
# Write options to config seed file
for opt in "${config_opts[@]}"; do
echo "$opt" >> "$SEED_FILE"
done
# normalize .config and remove dupes # normalize .config and remove dupes
make defconfig make defconfig
@@ -665,9 +669,10 @@ fromSource() {
[[ -d "$GITSRCDIR/staging_dir/host/llvm-bpf/bin" ]] || mkdir -p "$GITSRCDIR/staging_dir/host/llvm-bpf/bin" [[ -d "$GITSRCDIR/staging_dir/host/llvm-bpf/bin" ]] || mkdir -p "$GITSRCDIR/staging_dir/host/llvm-bpf/bin"
ln -fs "$(which clang)" "$GITSRCDIR/staging_dir/host/llvm-bpf/bin/clang" ln -fs "$(which clang)" "$GITSRCDIR/staging_dir/host/llvm-bpf/bin/clang"
make download && (( DEBUG )) && make_opts+=("V=s")
debug "make -j$(nproc) world" && make "${make_opts[@]}" download &&
make -j"$(nproc)" world debug "make ${make_opts[*]} -j$(nproc) world" &&
make "${make_opts[@]}" -j"$(nproc)" world
popd &>/dev/null || return 1 popd &>/dev/null || return 1
exit # TODO exit here for fromSource() testing exit # TODO exit here for fromSource() testing