From abdb610f56e6ff7bc54e8ad29637bde718951d91 Mon Sep 17 00:00:00 2001 From: Jiao Xianjun Date: Wed, 20 Oct 2021 22:50:30 +0200 Subject: [PATCH] Scripts are adapted for SW HW decouple To avoid openwifi-hw github submodule in openwifi. More flexible now. --- .gitmodules | 3 -- README.md | 29 ++++++++-------- driver/make_all.sh | 10 +++--- driver/side_ch/make_driver.sh | 10 +++--- driver/xilinx_dma/make_xilinx_dma.sh | 10 +++--- kernel_boot/build_boot_bin.sh | 13 +++---- user_space/boot_bin_gen.sh | 18 ++++++++-- user_space/boot_bin_gen_zynqmp.sh | 20 ++++++++--- user_space/build_wpa_supplicant_wo11b.sh | 10 +++--- user_space/get_fpga.sh | 32 ----------------- user_space/post_config.sh | 11 +++++- user_space/prepare_kernel.sh | 23 +++++++------ user_space/sdcard_boot_update.sh | 4 +-- user_space/update_sdcard.sh | 44 +++++++++++++++++------- 14 files changed, 128 insertions(+), 109 deletions(-) delete mode 100755 user_space/get_fpga.sh diff --git a/.gitmodules b/.gitmodules index 0d6fc15..42cab05 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "adi-linux-64"] path = adi-linux-64 url = https://github.com/analogdevicesinc/linux.git -[submodule "openwifi-hw"] - path = openwifi-hw - url = https://github.com/open-sdr/openwifi-hw.git diff --git a/README.md b/README.md index 644b94d..98e2b84 100644 --- a/README.md +++ b/README.md @@ -126,20 +126,19 @@ Since the pre-built SD card image might not have the latest bug-fixes/updates, i - Setup environment variables (use absolute path): ``` export XILINX_DIR=your_Xilinx_directory - export OPENWIFI_DIR=your_openwifi_directory + export OPENWIFI_HW_DIR=your_openwifi-hw_directory export BOARD_NAME=your_board_name ``` -- Get the latest FPGA bitstream from openwifi-hw, generate BOOT.BIN and transfer it on board via ssh channel: +- Pick the FPGA bitstream from openwifi-hw, and generate BOOT.BIN and transfer it on board via ssh channel: ``` - $OPENWIFI_DIR/user_space/get_fpga.sh $OPENWIFI_DIR - For Zynq 7000: - $OPENWIFI_DIR/user_space/boot_bin_gen.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME + + cd openwifi/user_space; ./boot_bin_gen.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME For Zynq MPSoC (like zcu102 board): - $OPENWIFI_DIR/user_space/boot_bin_gen_zynqmp.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME + cd openwifi/user_space; ./boot_bin_gen_zynqmp.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME - scp $OPENWIFI_DIR/kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN root@192.168.10.122: + cd openwifi/kernel_boot/boards/$BOARD_NAME/output_boot_bin; scp ./BOOT.BIN root@192.168.10.122: ``` - On board: Put the BOOT.BIN into the BOOT partition. ``` @@ -154,18 +153,18 @@ Since the pre-built SD card image might not have the latest bug-fixes/updates, i Since the pre-built SD card image might not have the latest bug-fixes/updates, it is recommended to update the driver on board. - Prepare Analog Devices Linux kernel source code (only need to run once): ``` - $OPENWIFI_DIR/user_space/prepare_kernel.sh $OPENWIFI_DIR $XILINX_DIR ARCH_BIT + cd openwifi/user_space; ./prepare_kernel.sh $XILINX_DIR ARCH_BIT build (For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64) ``` **Note**: In Ubuntu, gcc-10 might have issue ('yylloc' error), so use gcc-9 if you encounter error. - Compile the latest openwifi driver ``` - $OPENWIFI_DIR/driver/make_all.sh $OPENWIFI_DIR $XILINX_DIR ARCH_BIT + cd openwifi/driver; ./make_all.sh $XILINX_DIR ARCH_BIT (For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64) ``` - Copy the driver files to the board via ssh channel ``` - scp `find $OPENWIFI_DIR/driver/ -name \*.ko` root@192.168.10.122:openwifi/ + cd openwifi/driver; scp `find ./ -name \*.ko` root@192.168.10.122:openwifi/ ``` Now you can use **wgd.sh** on board to load the new openwifi driver. **Note**: If you have symbol or version error while loadng the driver, it could be because the kernel in the SD card image is too old. In this case, you need to follow [[Build openwifi Linux img from scratch](#Build-openwifi-Linux-img-from-scratch)] to generate your new SD card image. @@ -173,7 +172,7 @@ Since the pre-built SD card image might not have the latest bug-fixes/updates, i ## Update sdrctl - Copy the sdrctl source files to the board via ssh channel ``` - scp `find $OPENWIFI_DIR/user_space/sdrctl_src/ -name \*` root@192.168.10.122:openwifi/sdrctl_src/ + cd openwifi/user_space/sdrctl_src; scp `find ./ -name \*` root@192.168.10.122:openwifi/sdrctl_src/ ``` - Compile the sdrctl **on board**: ``` @@ -182,7 +181,7 @@ Since the pre-built SD card image might not have the latest bug-fixes/updates, i ## Easy Access and etc - FPGA and driver on board update scripts - - Setup [ftp server](https://help.ubuntu.com/lts/serverguide/ftp-server.html) on PC, allow anonymous and change ftp root directory to $OPENWIFI_DIR. + - Setup [ftp server](https://help.ubuntu.com/lts/serverguide/ftp-server.html) on PC, allow anonymous and change ftp root directory to the openwifi directory. - On board: ``` ./sdcard_boot_update.sh $BOARD_NAME @@ -200,12 +199,12 @@ Since the pre-built SD card image might not have the latest bug-fixes/updates, i ``` export SDCARD_DIR=sdcard_mount_point export XILINX_DIR=your_Xilinx_directory - export OPENWIFI_DIR=your_openwifi_directory + export OPENWIFI_HW_DIR=your_openwifi-hw_directory export BOARD_NAME=your_board_name ``` - Run script to update SD card: ``` - $OPENWIFI_DIR/user_space/update_sdcard.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME $SDCARD_DIR + cd openwifi/user_space; ./update_sdcard.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME $SDCARD_DIR ``` - Config your board to SD card boot mode (check the board manual). Insert the SD card to the board. Power on. - Login to the board from your PC (PC Ethernet should have IP 192.168.10.1) with one time password **analog**. @@ -238,7 +237,7 @@ For hostapd program, 802.11b rates can be suppressed using configuration command On the other hand, the wpa_supplicant program on the client side (commercial Wi-Fi dongle/board) cannot suppress 802.11b rates out of the box in 2.4GHz band, so there will be an issue when connecting openwifi (OFDM only). A patched wpa_supplicant should be used at the client side. ``` sudo apt-get install libssl1.0-dev -$OPENWIFI_DIR/user_space/build_wpa_supplicant_wo11b.sh $OPENWIFI_DIR +cd openwifi/user_space; ./build_wpa_supplicant_wo11b.sh ``` ## Porting guide diff --git a/driver/make_all.sh b/driver/make_all.sh index e56df50..949daff 100755 --- a/driver/make_all.sh +++ b/driver/make_all.sh @@ -4,14 +4,14 @@ # SPDX-FileCopyrightText: 2019 UGent # SPDX-License-Identifier: AGPL-3.0-or-later -if [ "$#" -ne 3 ]; then - echo "You must enter exactly 3 arguments: \$OPENWIFI_DIR \$XILINX_DIR ARCH_BIT(32 or 64)" +if [ "$#" -ne 2 ]; then + echo "You must enter exactly 2 arguments: \$XILINX_DIR ARCH_BIT(32 or 64)" exit 1 fi -OPENWIFI_DIR=$1 -XILINX_DIR=$2 -ARCH_OPTION=$3 +OPENWIFI_DIR=$(pwd)/../ +XILINX_DIR=$1 +ARCH_OPTION=$2 if [ -f "$OPENWIFI_DIR/LICENSE" ]; then echo "\$OPENWIFI_DIR is found!" diff --git a/driver/side_ch/make_driver.sh b/driver/side_ch/make_driver.sh index e629a16..77a1d7a 100755 --- a/driver/side_ch/make_driver.sh +++ b/driver/side_ch/make_driver.sh @@ -4,14 +4,14 @@ # SPDX-FileCopyrightText: 2019 UGent # SPDX-License-Identifier: AGPL-3.0-or-later -if [ "$#" -ne 3 ]; then - echo "You must enter exactly 3 arguments: \$OPENWIFI_DIR \$XILINX_DIR ARCH_BIT(32 or 64)" +if [ "$#" -ne 2 ]; then + echo "You must enter exactly 2 arguments: \$XILINX_DIR ARCH_BIT(32 or 64)" exit 1 fi -OPENWIFI_DIR=$1 -XILINX_DIR=$2 -ARCH_OPTION=$3 +OPENWIFI_DIR=$(pwd)/../../ +XILINX_DIR=$1 +ARCH_OPTION=$2 if [ -f "$OPENWIFI_DIR/LICENSE" ]; then echo "\$OPENWIFI_DIR is found!" diff --git a/driver/xilinx_dma/make_xilinx_dma.sh b/driver/xilinx_dma/make_xilinx_dma.sh index 541255a..22f19ed 100755 --- a/driver/xilinx_dma/make_xilinx_dma.sh +++ b/driver/xilinx_dma/make_xilinx_dma.sh @@ -4,15 +4,15 @@ # SPDX-FileCopyrightText: 2019 UGent # SPDX-License-Identifier: AGPL-3.0-or-later -if [ "$#" -ne 3 ]; then - echo "You must enter exactly 3 arguments: \$OPENWIFI_DIR \$XILINX_DIR \$ARCH(32 or 64)" +if [ "$#" -ne 2 ]; then + echo "You must enter exactly 2 arguments: \$XILINX_DIR \$ARCH(32 or 64)" exit 1 fi WORKDIR=$PWD -OPENWIFI_DIR=$1 -XILINX_DIR=$2 -ARCH_OPTION=$3 +OPENWIFI_DIR=$(pwd)/../../ +XILINX_DIR=$1 +ARCH_OPTION=$2 set -x diff --git a/kernel_boot/build_boot_bin.sh b/kernel_boot/build_boot_bin.sh index 822882a..b25826a 100755 --- a/kernel_boot/build_boot_bin.sh +++ b/kernel_boot/build_boot_bin.sh @@ -5,12 +5,14 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # https://wiki.analog.com/resources/eval/user-guides/ad-fmcomms2-ebz/software/linux/zynq_2014r2 -if [ "$#" -ne 1 ]; then - echo "You must enter the \$BOARD_NAME as argument" - echo "Like: antsdr adrv9364z7020 adrv9361z7035 zc706_fmcs2 zed_fmcs2 zc702_fmcs2 zcu102_fmcs2 zcu102_9371" +if [ "$#" -ne 2 ]; then + echo "You must enter the \$OPENWIFI_HW_DIR \$BOARD_NAME as argument" + echo "BOARD_NAME Like: antsdr adrv9364z7020 adrv9361z7035 zc706_fmcs2 zed_fmcs2 zc702_fmcs2 zcu102_fmcs2 zcu102_9371" exit 1 fi -BOARD_NAME=$1 + +OPENWIFI_HW_DIR=$1 +BOARD_NAME=$2 if [ "$BOARD_NAME" != "antsdr" ] && [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ] && [ "$BOARD_NAME" != "zcu102_fmcs2" ] && [ "$BOARD_NAME" != "zcu102_9371" ]; then echo "\$BOARD_NAME is not correct. Please check!" @@ -19,10 +21,9 @@ else echo "\$BOARD_NAME is found!" fi - set -ex -HDF_FILE=../openwifi-hw/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/system.hdf +HDF_FILE=$OPENWIFI_HW_DIR/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/system.hdf UBOOT_FILE=./boards/$BOARD_NAME/u-boot.elf BUILD_DIR=./boards/$BOARD_NAME/build_boot_bin OUTPUT_DIR=./boards/$BOARD_NAME/output_boot_bin diff --git a/user_space/boot_bin_gen.sh b/user_space/boot_bin_gen.sh index 0a0ffbc..a566329 100755 --- a/user_space/boot_bin_gen.sh +++ b/user_space/boot_bin_gen.sh @@ -5,14 +5,19 @@ # SPDX-License-Identifier: AGPL-3.0-or-later if [ "$#" -ne 3 ]; then - echo "You must enter exactly 3 arguments: \$OPENWIFI_DIR \$XILINX_DIR \$BOARD_NAME" + echo "You must enter exactly 3 arguments: \$OPENWIFI_HW_DIR \$XILINX_DIR \$BOARD_NAME" exit 1 fi -OPENWIFI_DIR=$1 +OPENWIFI_HW_DIR=$1 XILINX_DIR=$2 BOARD_NAME=$3 +OPENWIFI_DIR=$(pwd)/../ + +echo OPENWIFI_DIR $OPENWIFI_DIR +echo OPENWIFI_HW_DIR $OPENWIFI_HW_DIR + if [ -f "$OPENWIFI_DIR/LICENSE" ]; then echo "\$OPENWIFI_DIR is found!" else @@ -34,6 +39,13 @@ else echo "\$BOARD_NAME is found!" fi +if [ -d "$OPENWIFI_HW_DIR/boards/$BOARD_NAME" ]; then + echo "\$OPENWIFI_HW_DIR is found!" +else + echo "\$OPENWIFI_HW_DIR is not correct. Please check!" + exit 1 +fi + home_dir=$(pwd) set -ex @@ -43,6 +55,6 @@ source $XILINX_DIR/SDK/2018.3/settings64.sh cd $OPENWIFI_DIR/kernel_boot -./build_boot_bin.sh $BOARD_NAME +./build_boot_bin.sh $OPENWIFI_HW_DIR $BOARD_NAME cd $home_dir diff --git a/user_space/boot_bin_gen_zynqmp.sh b/user_space/boot_bin_gen_zynqmp.sh index 6675ac9..673bdc5 100755 --- a/user_space/boot_bin_gen_zynqmp.sh +++ b/user_space/boot_bin_gen_zynqmp.sh @@ -5,14 +5,19 @@ # SPDX-License-Identifier: AGPL-3.0-or-later if [ "$#" -ne 3 ]; then - echo "You must enter exactly 3 arguments: \$OPENWIFI_DIR \$XILINX_DIR \$BOARD_NAME" + echo "You must enter exactly 3 arguments: \$OPENWIFI_HW_DIR \$XILINX_DIR \$BOARD_NAME" exit 1 fi -OPENWIFI_DIR=$1 +OPENWIFI_HW_DIR=$1 XILINX_DIR=$2 BOARD_NAME=$3 +OPENWIFI_DIR=$(pwd)/../ + +echo OPENWIFI_DIR $OPENWIFI_DIR +echo OPENWIFI_HW_DIR $OPENWIFI_HW_DIR + if [ -f "$OPENWIFI_DIR/LICENSE" ]; then echo "\$OPENWIFI_DIR is found!" else @@ -34,6 +39,13 @@ else echo "\$BOARD_NAME is found!" fi +if [ -d "$OPENWIFI_HW_DIR/boards/$BOARD_NAME" ]; then + echo "\$OPENWIFI_HW_DIR is found!" +else + echo "\$OPENWIFI_HW_DIR is not correct. Please check!" + exit 1 +fi + home_dir=$(pwd) set -ex @@ -43,8 +55,8 @@ source $XILINX_DIR/SDK/2018.3/settings64.sh cd $OPENWIFI_DIR/kernel_boot -./build_zynqmp_boot_bin.sh ../openwifi-hw/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/system.hdf boards/$BOARD_NAME/u-boot-zcu.elf boards/$BOARD_NAME/bl31.elf -# ./build_zynqmp_boot_bin.sh ../openwifi-hw/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/system.hdf boards/$BOARD_NAME/u-boot-zcu.elf download +./build_zynqmp_boot_bin.sh $OPENWIFI_HW_DIR/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/system.hdf boards/$BOARD_NAME/u-boot-zcu.elf boards/$BOARD_NAME/bl31.elf + rm -rf build_boot_bin rm -rf boards/$BOARD_NAME/output_boot_bin mv output_boot_bin boards/$BOARD_NAME/ diff --git a/user_space/build_wpa_supplicant_wo11b.sh b/user_space/build_wpa_supplicant_wo11b.sh index c2a849a..da6acea 100755 --- a/user_space/build_wpa_supplicant_wo11b.sh +++ b/user_space/build_wpa_supplicant_wo11b.sh @@ -4,12 +4,12 @@ # SPDX-FileCopyrightText: 2019 UGent # SPDX-License-Identifier: AGPL-3.0-or-later -if [ "$#" -ne 1 ]; then - echo "You must enter exactly 1 arguments: \$OPENWIFI_DIR" - exit 1 -fi +# if [ "$#" -ne 1 ]; then +# echo "You must enter exactly 1 arguments: \$OPENWIFI_DIR" +# exit 1 +# fi -OPENWIFI_DIR=$1 +OPENWIFI_DIR=$(pwd)/../ set -x diff --git a/user_space/get_fpga.sh b/user_space/get_fpga.sh deleted file mode 100755 index 0e38991..0000000 --- a/user_space/get_fpga.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Author: Xianjun Jiao -# SPDX-FileCopyrightText: 2019 UGent -# SPDX-License-Identifier: AGPL-3.0-or-later - -if [ "$#" -ne 1 ]; then - echo "You must enter the \$OPENWIFI_DIR (the openwifi root directory) as argument" - exit 1 -fi -OPENWIFI_DIR=$1 - - -if [ -f "$OPENWIFI_DIR/LICENSE" ]; then - echo "\$OPENWIFI_DIR is found!" -else - echo "\$OPENWIFI_DIR is not correct. Please check!" - exit 1 -fi - -home_dir=$(pwd) - -set -ex - -cd $OPENWIFI_DIR/ -git submodule init openwifi-hw -git submodule update openwifi-hw -cd openwifi-hw -git checkout master -git pull - -cd $home_dir diff --git a/user_space/post_config.sh b/user_space/post_config.sh index 8020d72..0212827 100755 --- a/user_space/post_config.sh +++ b/user_space/post_config.sh @@ -53,5 +53,14 @@ sudo apt-get -y install webfs sudo apt-get -y install iperf sudo apt-get -y install libpcap-dev -# change the password to openwifi +# change the root password to openwifi +cat /etc/passwd +sed -i 's/root:x:0:0:root:\/root:\/bin\/bash/root::0:0:root:\/root:\/bin\/bash/' /etc/passwd +sync +sleep 1 +cat /etc/passwd echo -e "openwifi\nopenwifi" | passwd +sync +sleep 1 +cat /etc/passwd + diff --git a/user_space/prepare_kernel.sh b/user_space/prepare_kernel.sh index d0a595e..da460d7 100755 --- a/user_space/prepare_kernel.sh +++ b/user_space/prepare_kernel.sh @@ -5,14 +5,14 @@ # SPDX-FileCopyrightText: 2019 UGent # SPDX-License-Identifier: AGPL-3.0-or-later -if [ "$#" -lt 3 ]; then - echo "You must enter at least 3 arguments: \$OPENWIFI_DIR \$XILINX_DIR ARCH_BIT(32 or 64)" +if [ "$#" -lt 2 ]; then + echo "You must enter at least 2 arguments: \$XILINX_DIR ARCH_BIT(32 or 64)" exit 1 fi -OPENWIFI_DIR=$1 -XILINX_DIR=$2 -ARCH_OPTION=$3 +OPENWIFI_DIR=$(pwd)/../ +XILINX_DIR=$1 +ARCH_OPTION=$2 if [ -f "$OPENWIFI_DIR/LICENSE" ]; then echo "\$OPENWIFI_DIR is found!" @@ -59,7 +59,8 @@ git submodule update $LINUX_KERNEL_SRC_DIR_NAME cd $OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME git checkout 2019_R1 git pull origin 2019_R1 -# git reset --hard 4fea7c5 +git reset --hard +# git reset --hard 4e81f0927cfb2fada92fc762dbd65d002848405a cp $LINUX_KERNEL_CONFIG_FILE ./.config cp $OPENWIFI_DIR/driver/ad9361/ad9361.c $OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME/drivers/iio/adc/ad9361.c -rf @@ -69,13 +70,13 @@ export CROSS_COMPILE=$CROSS_COMPILE_NAME make oldconfig && make prepare && make modules_prepare -if [ "$#" -gt 3 ]; then - if [ -f "$OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME/arch/$ARCH_NAME/boot/$IMAGE_TYPE" ]; then - echo "Kernel found! Skip the time costly Linux kernel compiling." - else +if [ "$#" -gt 2 ]; then + # if [ -f "$OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME/arch/$ARCH_NAME/boot/$IMAGE_TYPE" ]; then + # echo "Kernel found! Skip the time costly Linux kernel compiling." + # else make -j12 $IMAGE_TYPE UIMAGE_LOADADDR=0x8000 make modules - fi + # fi fi cd $home_dir diff --git a/user_space/sdcard_boot_update.sh b/user_space/sdcard_boot_update.sh index 663157a..bcd19f0 100755 --- a/user_space/sdcard_boot_update.sh +++ b/user_space/sdcard_boot_update.sh @@ -6,12 +6,12 @@ if [ "$#" -ne 1 ]; then echo "You must enter the \$BOARD_NAME as argument" - echo "Like: adrv9364z7020 adrv9361z7035 zc706_fmcs2 zed_fmcs2 zc702_fmcs2 zcu102_fmcs2 zcu102_9371" + echo "Like: antsdr adrv9364z7020 adrv9361z7035 zc706_fmcs2 zed_fmcs2 zc702_fmcs2 zcu102_fmcs2 zcu102_9371" exit 1 fi BOARD_NAME=$1 -if [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ] && [ "$BOARD_NAME" != "zcu102_fmcs2" ] && [ "$BOARD_NAME" != "zcu102_9371" ]; then +if [ "$BOARD_NAME" != "antsdr" ] && [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ] && [ "$BOARD_NAME" != "zcu102_fmcs2" ] && [ "$BOARD_NAME" != "zcu102_9371" ]; then echo "\$BOARD_NAME is not correct. Please check!" exit 1 else diff --git a/user_space/update_sdcard.sh b/user_space/update_sdcard.sh index c0124b2..c2649bd 100755 --- a/user_space/update_sdcard.sh +++ b/user_space/update_sdcard.sh @@ -7,15 +7,20 @@ if [ "$#" -ne 4 ]; then echo "You have input $# arguments." - echo "You must enter exactly 4 arguments: \$OPENWIFI_DIR \$XILINX_DIR \$BOARD_NAME \$SDCARD_DIR" + echo "You must enter exactly 4 arguments: \$OPENWIFI_HW_DIR \$XILINX_DIR \$BOARD_NAME \$SDCARD_DIR" exit 1 fi -OPENWIFI_DIR=$1 +OPENWIFI_HW_DIR=$1 XILINX_DIR=$2 BOARD_NAME=$3 SDCARD_DIR=$4 +OPENWIFI_DIR=$(pwd)/../ + +echo OPENWIFI_DIR $OPENWIFI_DIR +echo OPENWIFI_HW_DIR $OPENWIFI_HW_DIR + if [ -f "$OPENWIFI_DIR/LICENSE" ]; then echo "\$OPENWIFI_DIR is found!" else @@ -37,6 +42,13 @@ else echo "\$BOARD_NAME is found!" fi +if [ -d "$OPENWIFI_HW_DIR/boards/$BOARD_NAME" ]; then + echo "\$OPENWIFI_HW_DIR is found!" +else + echo "\$OPENWIFI_HW_DIR is not correct. Please check!" + exit 1 +fi + # detect SD card mounting status if [ -d "$SDCARD_DIR/BOOT/" ]; then echo "$SDCARD_DIR/BOOT/" @@ -74,13 +86,11 @@ LINUX_KERNEL_SRC_DIR_NAME32=adi-linux LINUX_KERNEL_SRC_DIR_NAME64=adi-linux-64 cd $OPENWIFI_DIR/user_space/ -./prepare_kernel.sh $OPENWIFI_DIR $XILINX_DIR 32 build +./prepare_kernel.sh $XILINX_DIR 32 build sudo true -./prepare_kernel.sh $OPENWIFI_DIR $XILINX_DIR 64 build +./prepare_kernel.sh $XILINX_DIR 64 build sudo true -$OPENWIFI_DIR/user_space/get_fpga.sh $OPENWIFI_DIR - BOARD_NAME_ALL="antsdr zc706_fmcs2 zed_fmcs2 zc702_fmcs2 adrv9361z7035 adrv9364z7020 zcu102_fmcs2 zcu102_9371" # BOARD_NAME_ALL="zcu102_fmcs2" # BOARD_NAME_ALL="adrv9361z7035" @@ -89,11 +99,11 @@ do if [ "$BOARD_NAME_TMP" == "zcu102_fmcs2" ] || [ "$BOARD_NAME_TMP" == "zcu102_9371" ]; then dtb_filename_tmp="system.dtb" dts_filename_tmp="system.dts" - $OPENWIFI_DIR/user_space/boot_bin_gen_zynqmp.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME_TMP + ./boot_bin_gen_zynqmp.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME_TMP else dtb_filename_tmp="devicetree.dtb" dts_filename_tmp="devicetree.dts" - $OPENWIFI_DIR/user_space/boot_bin_gen.sh $OPENWIFI_DIR $XILINX_DIR $BOARD_NAME_TMP + ./boot_bin_gen.sh $OPENWIFI_HW_DIR $XILINX_DIR $BOARD_NAME_TMP fi echo $dtb_filename_tmp echo $dts_filename_tmp @@ -129,15 +139,25 @@ sudo cp $OPENWIFI_DIR/user_space/* $SDCARD_DIR/rootfs/root/openwifi/ -rf sudo wget -P $SDCARD_DIR/rootfs/root/openwifi/webserver/ https://users.ugent.be/~xjiao/openwifi-low-aac.mp4 # build openwifi driver -$OPENWIFI_DIR/driver/make_all.sh $OPENWIFI_DIR $XILINX_DIR 32 -$OPENWIFI_DIR/driver/side_ch/make_driver.sh $OPENWIFI_DIR $XILINX_DIR 32 +saved_dir=$(pwd) +cd $OPENWIFI_DIR/driver +./make_all.sh $XILINX_DIR 32 +cd $OPENWIFI_DIR/driver/side_ch +./make_driver.sh $XILINX_DIR 32 +cd $saved_dir + # Copy files to SD card rootfs partition sudo mkdir $SDCARD_DIR/rootfs/root/openwifi/drv32 sudo find $OPENWIFI_DIR/driver -name \*.ko -exec cp {} $SDCARD_DIR/rootfs/root/openwifi/drv32 \; # build openwifi driver -$OPENWIFI_DIR/driver/make_all.sh $OPENWIFI_DIR $XILINX_DIR 64 -$OPENWIFI_DIR/driver/side_ch/make_driver.sh $OPENWIFI_DIR $XILINX_DIR 64 +saved_dir=$(pwd) +cd $OPENWIFI_DIR/driver +./make_all.sh $XILINX_DIR 64 +cd $OPENWIFI_DIR/driver/side_ch +./make_driver.sh $XILINX_DIR 64 +cd $saved_dir + # Copy files to SD card rootfs partition sudo mkdir $SDCARD_DIR/rootfs/root/openwifi/drv64 sudo find $OPENWIFI_DIR/driver -name \*.ko -exec cp {} $SDCARD_DIR/rootfs/root/openwifi/drv64 \;