Skip to content

Commit

Permalink
add a example for adding wifi driver to friendlywrt
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencetg committed Jun 2, 2023
1 parent 2cf3e2a commit 8baa8d1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ jobs:
- name: Compile uboot and kernel
run: |
cd project
./build.sh kernel
./build.sh uboot
./build.sh kernel
source ../scripts/wifi/add_rtl8852be.sh
- name: Build sd image
id: build_sd_image
Expand Down
39 changes: 39 additions & 0 deletions scripts/wifi/add_rtl8852be.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -eu

pushd kernel
kernel_ver=`make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 kernelrelease`
popd
modules_dir=$(readlink -f ./out/output_*_kmodules/lib/modules/${kernel_ver})
[ -d ${modules_dir} ] || {
echo "please build kernel first."
exit 1
}
firmware_dir="$(pwd)/rtl8852be/lib/firmware/rtw89"
config_dir="$(pwd)/rtl8852be/etc/modules.d/"
mkdir ${firmware_dir} ${config_dir} -p

# download firmware
wget http://lwfinger.com/download/rtw8852b_fw-1.bin -O ${firmware_dir}/rtw8852b_fw-1.bin
wget http://lwfinger.com/download/rtw8852b_fw.bin -O ${firmware_dir}/rtw8852b_fw.bin
wget http://lwfinger.com/download/rtw8851b_fw.bin -O ${firmware_dir}/rtw8851b_fw.bin
wget http://lwfinger.com/download/rtw8852a_fw.bin -O ${firmware_dir}/rtw8852a_fw.bin
wget http://lwfinger.com/download/rtw8852c_fw.bin -O ${firmware_dir}/rtw8852c_fw.bin
wget https://github.com/armbian/firmware/blob/master/rtl8852bu_fw -O ${firmware_dir}/rtl8852bu_fw.bin

# build wifi driver
git clone https://github.com/lwfinger/rtw89.git -b main
(cd rtw89 && {
git reset 38b8a48d04b8440266db6ea730e9b9cf84463981 --hard
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64:$PATH
make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 -C ../kernel M=$(pwd)
cp *.ko ${modules_dir}/ -afv
})

# load module on boot
echo "rtw_8852be" > ${config_dir}/11-rtw89

# add files to rootfs
if ! grep -q rtl8852be .current_config.mk; then
echo "FRIENDLYWRT_FILES+=(rtl8852be)" >> .current_config.mk
fi

0 comments on commit 8baa8d1

Please sign in to comment.