aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-bsp/firmware/firmware-qcom-dragonboard845c/generate_board-2_json.sh
blob: 3a1d5324273dd273fadbdcc7cbbd69972cefc1d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
JSON="$2"

iter=0
echo "[" > "${JSON}"
for file in $1/bdwlan.*; do
    [[ $file == *.txt ]] && continue

    iter=$((iter+1))
    [ $iter -ne 1 ] && echo "  }," >> "${JSON}"

    echo "  {" >> "${JSON}"
    echo "          \"data\": \"$file\"," >> "${JSON}"
    if [[ $file == */bdwlan.bin ]]; then
        file_ext="ff"
    else
        file_ext="$(printf '%x\n' "$(basename "${file}" | sed -E 's:^.*\.b?([0-9a-f]*)$:0x\1:')")"
    fi
    echo "          \"names\": [\"bus=snoc,qmi-board-id=${file_ext}\"]" >> "${JSON}"
done

echo "  }" >> "${JSON}"
echo "]" >> "${JSON}"