|
1 | 1 | #!/bin/sh |
2 | 2 |
|
3 | 3 | ONEWIFI_DIR=$(pwd) |
4 | | -HOSTAP_DIR="$(pwd)/../rdk-wifi-libhostap/source" |
| 4 | +OPENWRT_ROOT="$(pwd)/../../.." |
| 5 | +HOSTAP_DIR="$(pwd)/../rdk-wifi-libhostap" |
| 6 | +HOSTAP_SRC_DIR="$HOSTAP_DIR/source" |
| 7 | +HOSTAP_PATCH_LIST="$ONEWIFI_DIR/build/openwrt/hostap_patch_list.txt" |
| 8 | +HOSTAP_PATCH_DIR_META_CMF_BPI="$HOSTAP_DIR/meta-cmf-bananapi/meta-rdk-mtk-bpir4/recipes-ccsp/rdk-wifi-libhostap/files/2.11/kernel_6_6" |
| 9 | +HOSTAP_PATCH_DIR_META_FILOGIC="$HOSTAP_DIR/meta-filogic/recipes-wifi/hostapd/files/kernel6-6-patches" |
| 10 | +HOSTAP_PATCH_FLAG="$HOSTAP_DIR/.hostap_patched" |
| 11 | +RDK_WIFI_HAL_DIR="$(pwd)/../rdk-wifi-hal" |
| 12 | +KERNEL_PATCH_DIR="$RDK_WIFI_HAL_DIR/platform/banana-pi/kernel-patches_6.6/openwrt" |
5 | 13 | UPSTREAM_HOSTAP_URL="https://git.w1.fi/hostap.git" |
6 | | -SRCREV_2_10="9d07b9447e76059a2ddef2a879c57d0934634188" |
| 14 | +SRCREV_2_11="4b8ac10cb77c3d4dbf7ccefbe697dc0578da374c" |
| 15 | +META_CMF_BPI_URL="https://github.com/rdkcentral/meta-cmf-bananapi.git" |
| 16 | +META_FILOGIC_URL="https://git01.mediatek.com/filogic/rdk-b/meta-filogic" |
| 17 | +SRCREV_META_FILOGIC="c67a32a7c8876b328a8d1eeaca213e860d85b3ce" |
| 18 | + |
| 19 | +# Apply network optimizations for reliable git clone |
| 20 | +export GIT_HTTP_LOW_SPEED_LIMIT=0 |
| 21 | +export GIT_HTTP_LOW_SPEED_TIME=999999 |
7 | 22 |
|
8 | 23 | #git clone other wifi related components |
9 | 24 | cd .. |
10 | 25 | git clone https://github.com/rdkcentral/rdk-wifi-hal.git rdk-wifi-hal |
11 | 26 | git clone https://github.com/rdkcentral/rdkb-halif-wifi.git halinterface |
12 | 27 | git clone https://github.com/xmidt-org/trower-base64.git trower-base64 |
13 | | - |
14 | 28 | cd $ONEWIFI_DIR |
15 | 29 | mkdir -p install/bin |
16 | 30 | mkdir -p install/lib |
17 | 31 |
|
18 | 32 |
|
19 | 33 | #Check if the HOSTAP_DIR already present before creating |
20 | 34 | if [ -d "$HOSTAP_DIR" ]; then |
21 | | - echo "Hostap directory $HOSTAP_DIR already exists." |
| 35 | + echo "Hostap directory $HOSTAP_DIR already exists." |
22 | 36 | else |
23 | 37 | mkdir -p $HOSTAP_DIR |
24 | 38 | fi |
25 | 39 |
|
26 | | -#clone the upstream hostap in HOSTAP_DIR as hostap-x.xx |
27 | | -#and move to the relevant commit |
28 | | -cd $HOSTAP_DIR |
29 | | -echo "Cloning hostap in $HOSTAP_DIR" |
30 | | -git clone $UPSTREAM_HOSTAP_URL hostap-2.10 |
31 | | -cd hostap-2.10 |
32 | | -git reset --hard $SRCREV_2_10 |
33 | | - |
34 | | -#clone the hostap-patches and apply |
35 | | -git clone https://github.com/rdkcentral/hostap-patches.git hostap-patches |
36 | | - |
37 | | -#Apply the patch |
38 | | -patch_filenames="hostap-patches/0001-OneWifi-related-hostap-patch-for-2.10-based-hostap.patch \ |
39 | | - hostap-patches/0002-radius_failover_2.10.patch \ |
40 | | - hostap-patches/0003-mbssid_support_2.10.patch \ |
41 | | - hostap-patches/wpa3_compatibility_hostap_2_10.patch \ |
42 | | - hostap-patches/0005-RDKB-58414-Dynamically-update-NAS_2_10.patch \ |
43 | | - hostap-patches/0006-RDKB-59523-connectivity-via-supplicant.patch \ |
44 | | - hostap-patches/mdu_radius_psk_auth_2_10.patch" |
45 | | -echo "Applying patches ..." |
46 | | -git am $patch_filenames |
47 | | - |
48 | | -#Delete the hostap-patches directory after applying |
49 | | -rm -rf hostap-patches |
| 40 | +#Check if the HOSTAP_SRC_DIR already present before creating |
| 41 | +if [ -d "$HOSTAP_SRC_DIR" ]; then |
| 42 | + echo "Hostap source directory $HOSTAP_SRC_DIR already exists." |
| 43 | +else |
| 44 | + mkdir -p "$HOSTAP_SRC_DIR" |
| 45 | + #clone the upstream hostap in HOSTAP_DIR as hostap-x.xx |
| 46 | + #and move to the relevant commit |
| 47 | + cd $HOSTAP_SRC_DIR |
| 48 | + echo "Cloning hostap in $HOSTAP_SRC_DIR" |
| 49 | + git clone $UPSTREAM_HOSTAP_URL hostap-2.11 |
| 50 | + cd hostap-2.11 |
| 51 | + git reset --hard $SRCREV_2_11 |
| 52 | + cd $HOSTAP_DIR |
| 53 | +fi |
| 54 | + |
| 55 | +if [ -f "$HOSTAP_PATCH_FLAG" ]; then |
| 56 | + echo "Hostap patches are already applied. Retry after deleting $HOSTAP_DIR" |
| 57 | +else |
| 58 | + #Clone meta-cmf-bananapi, meta-filogic and apply hostap patches |
| 59 | + [ ! -d "meta-cmf-bananapi" ] && git clone "$META_CMF_BPI_URL" meta-cmf-bananapi |
| 60 | + |
| 61 | + if [ ! -d "meta-filogic" ]; then |
| 62 | + mkdir -p meta-filogic && cd meta-filogic |
| 63 | + git init |
| 64 | + git remote add origin "$META_FILOGIC_URL" |
| 65 | + #Increased HTTP post buffer to 1GB to prevent "RPC failed" or "Broken pipe" errors. |
| 66 | + git config http.postBuffer 1048576000 |
| 67 | + git fetch --depth 1 origin "$SRCREV_META_FILOGIC" |
| 68 | + git reset --hard FETCH_HEAD |
| 69 | + cd "$HOSTAP_DIR" |
| 70 | + fi |
| 71 | + |
| 72 | + echo "Applying hostap patches ..." |
| 73 | + |
| 74 | + if [ ! -f "$HOSTAP_PATCH_LIST" ]; then |
| 75 | + echo "$HOSTAP_PATCH_LIST not found!" |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | + |
| 79 | + while IFS= read -r line || [ -n "$line" ]; do |
| 80 | + |
| 81 | + [ -z "$line" ] && continue |
| 82 | + line=$(echo "$line" | sed 's/\\$//' | xargs) |
| 83 | + raw_patch_file=$(echo "$line" | cut -d';' -f1) |
| 84 | + eval patch_file="$raw_patch_file" |
| 85 | + |
| 86 | + patch_dir=$(echo "$line" | grep -o 'patchdir=[^;]*' | cut -d'=' -f2) |
| 87 | + |
| 88 | + echo "Applying patch: $patch_file" |
| 89 | + |
| 90 | + if [ -n "$patch_dir" ]; then |
| 91 | + patch --forward -p1 -d "$patch_dir" < "$patch_file" |
| 92 | + else |
| 93 | + patch --forward -p1 < "$patch_file" |
| 94 | + fi |
| 95 | + |
| 96 | + if [ $? -ne 0 ]; then |
| 97 | + echo "Patch failed: $patch_file" |
| 98 | + exit 1 |
| 99 | + fi |
| 100 | + |
| 101 | + done < "$HOSTAP_PATCH_LIST" |
| 102 | + touch "$HOSTAP_PATCH_FLAG" |
| 103 | + echo "All patches applied successfully." |
| 104 | +fi |
| 105 | + |
| 106 | +#Delete the meta-cmf-bananapi and meta-filogic directories after applying patches |
| 107 | +rm -rf meta-cmf-bananapi |
| 108 | +rm -rf meta-filogic |
50 | 109 |
|
51 | 110 | #return back to initial directory |
52 | 111 | cd $ONEWIFI_DIR |
0 commit comments