Skip to content

Commit 40bdd3b

Browse files
committed
fix: Properly set heirarchy for searching device configs
Signed-off-by: Saalim Quadri <danascape@gmail.com>
1 parent 4db6ac0 commit 40bdd3b

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/build.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
. "$SW_SRC_DIR"/src/sw_functions.sh --source-only
1010

1111
# Check if the kernel config already exists for a particular device.
12-
# Search order: 1) SW_CONFIG_DIR 2) Current directory 3) ./configs/
12+
# Search order: 1) Current directory 2) SW_CONFIG_DIR 3) ./configs/
1313
check_kernel()
1414
{
1515
local device="$1"
1616
local config_file="sworkflow.${device}.config"
1717
local found_config=""
18+
SWORKFLOW_CONFIG=""
1819

1920
if [[ -z "$device" ]]; then
2021
log_error "error: Device name is empty!"
@@ -23,26 +24,26 @@ check_kernel()
2324

2425
log_info "sworkflow: Checking if kernel config exists for $device"
2526

27+
if [[ -f "$(pwd)/$config_file" ]]; then
28+
found_config="$(pwd)/$config_file"
2629
# Search in SW_CONFIG_DIR (system or user config directory)
27-
if [[ -n "$SW_CONFIG_DIR" && -f "$SW_CONFIG_DIR/$config_file" ]]; then
30+
elif [[ -n "$SW_CONFIG_DIR" && -f "$SW_CONFIG_DIR/$config_file" ]]; then
2831
found_config="$SW_CONFIG_DIR/$config_file"
29-
# Search in current working directory
30-
elif [[ -f "$(pwd)/$config_file" ]]; then
31-
found_config="$(pwd)/$config_file"
3232
# Search in ./configs/ subdirectory
3333
elif [[ -f "$(pwd)/configs/$config_file" ]]; then
3434
found_config="$(pwd)/configs/$config_file"
3535
fi
3636

3737
if [[ -n "$found_config" ]]; then
38+
SWORKFLOW_CONFIG="$found_config"
3839
log_info "sworkflow: Including $found_config"
3940
# shellcheck source=/dev/null
4041
. "$found_config"
4142
else
4243
log_error "error: No config file found for device: $device"
4344
log_error "error: Searched in:"
44-
log_error " - $SW_CONFIG_DIR/"
4545
log_error " - $(pwd)/"
46+
log_error " - $SW_CONFIG_DIR/"
4647
log_error " - $(pwd)/configs/"
4748
exit 125
4849
fi
@@ -189,6 +190,7 @@ displayDeviceInfo()
189190
log_info "HOST_OS_EXTRA=$HOST_OS_EXTRA"
190191
log_info "HOST_PATH=$PATH"
191192
log_info "OUT_DIR=$OUT_DIR"
193+
log_info "SWORKFLOW_CONFIG=$SWORKFLOW_CONFIG"
192194
if [[ -n "$board_platform" ]]; then
193195
log_info "BOARD_PLATFORM=$board_platform"
194196
fi

0 commit comments

Comments
 (0)