Skip to content

Commit

Permalink
add sample script to build 3rd r8125 driver
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencetg committed Nov 14, 2024
1 parent beb42bd commit 113dd3f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ jobs:
./build.sh uboot
./build.sh kernel
## If you want to compile a driver from source, here is an example
# case ${{ matrix.CPU }} in
# rk3568)
# ../scripts/3rd/add_r8125.sh
# ;;
# esac
- name: Build sd image
id: build_sd_image
run: |
Expand Down
28 changes: 28 additions & 0 deletions scripts/3rd/add_r8125.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -eu
top_path=$(pwd)

# prepare toolchain and get the kernel version
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin/:$PATH
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
}

# build kernel driver
git clone https://github.com/zeroday0619/r8125 -b main
pushd r8125/src
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C ${top_path}/kernel M=$(pwd)
aarch64-linux-gnu-strip --strip-unneeded r8125.ko
cp r8125.ko ${modules_dir}/
popd

# prepare rootfs overlay
tmp_dir="${top_path}/r8125-files/etc/modules.d/"
mkdir ${tmp_dir} -p
echo "r8125" > ${tmp_dir}/10-r8125
echo "FRIENDLYWRT_FILES+=(r8125-files)" >> .current_config.mk

0 comments on commit 113dd3f

Please sign in to comment.