Skip to content

Add kernel module build files #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,24 @@ jobs:
sudo apt-get update
sudo apt-get install --yes --no-install-recommends libguestfs-tools qemu-user-static binfmt-support
curl -LO https://raw.githubusercontent.com/ev3dev/brickstrap/master/src/brickstrap.sh
- name: build sling and sinter
- name: Build sling and sinter
run: ./build_sling.sh
- name: build qrcode generator
- name: Build QR code generator
run: ./build_qrcode.sh
- name: build nus login program
- name: Build prompt for NUS_STU login
run: ./build_prompt.sh
- name: build uuidtob62
- name: Build uuidtob62 CLI tool
run: ./build_uuidtob62.sh
- name: check the outputs
- name: Build RTL8821CU Wi-Fi driver
run: ./build_driver.sh
- name: Check the outputs
run: |
file build-ev3/sling build-ev3/sinter_host file build-ev3/executables/show_qrcode build-ev3/executables/nus_login build-ev3/executables/uuidtob62
file build-ev3/sling build-ev3/sinter_host \
file build-ev3/executables/show_qrcode build-ev3/executables/nus_login build-ev3/executables/uuidtob62 \
file image/rtl8821cu-driver/8821cu.ko image/rtl8821cu-driver/8821cu.conf
- name: make vmlinuz readable
run: sudo chmod 755 /boot/vmlinuz*
- name: build image
- name: Build EV3-Source image
run: ./build_image.sh
- uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'workflow_dispatch' }}
Expand Down
18 changes: 18 additions & 0 deletions build_driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euxo pipefail
SCRIPT_DIR="$(dirname "$(realpath -s "${BASH_SOURCE[0]}")")"
IMAGE_NAME="sourceacademy/rtl8821cu"
OUTPUT_DIR="image/rtl8821cu-driver"

cd rtl8821cu-driver
docker build -t "$IMAGE_NAME" .

cd "$SCRIPT_DIR"
mkdir -p "$OUTPUT_DIR"
cd "$OUTPUT_DIR"
docker run --rm -w /root/work/rtl8821cu/ "$IMAGE_NAME" cat 8821cu.ko > 8821cu.ko
docker run --rm -w /root/work/rtl8821cu/ "$IMAGE_NAME" cat 8821cu.conf > 8821cu.conf

# Clean up
docker rmi "$IMAGE_NAME"
4 changes: 2 additions & 2 deletions image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM ev3dev/ev3dev-stretch-ev3-base
COPY executables/uuidtob62 sling sinter_host /usr/local/bin/

# Copy WiFi drivers
COPY rtl8812cu-driver/8821cu.conf /etc/modprobe.d/
COPY rtl8812cu-driver/8821cu.ko /lib/modules/4.14.117-ev3dev-2.3.5-ev3/drivers/net/wireless/
COPY rtl8821cu-driver/8821cu.conf /etc/modprobe.d/
COPY rtl8821cu-driver/8821cu.ko /lib/modules/4.14.117-ev3dev-2.3.5-ev3/drivers/net/wireless/

# Copy configurations and run setup
COPY bootstrap.sh start-sling.sh sling.service panel.service show-secret.sh show-qr.sh /usr/local/bin/
Expand Down
159 changes: 0 additions & 159 deletions image/rtl8812cu-driver/8821cu.conf

This file was deleted.

Binary file removed image/rtl8812cu-driver/8821cu.ko
Binary file not shown.
3 changes: 3 additions & 0 deletions rtl8821cu-driver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM --platform=amd64 ubuntu:20.04
COPY setup.sh /root
RUN ["bash", "-c", "chmod 755 /root/setup.sh && exec /root/setup.sh"]
50 changes: 50 additions & 0 deletions rtl8821cu-driver/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/bash
set -euxo pipefail

GNU_PATH="/usr/lib/x86_64-linux-gnu"
WORKDIR="$HOME/work"

# Install dependencies
apt-get update
apt-get install -y software-properties-common
apt-add-repository ppa:ev3dev/tools
apt-get install -y wget git build-essential ncurses-dev fakeroot bc u-boot-tools lzop flex bison libssl-dev gcc-arm-linux-gnueabihf

wget https://releases.linaro.org/components/toolchain/binaries/6.4-2018.05/arm-linux-gnueabihf/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
tar xf gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
mv gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf "$GNU_PATH/gcc-linaro-arm-linux-gnueabihf-6.4"

# Fix error due to deprecated git:// protocol on GitHub
git config --global url."https://".insteadOf git://

# Create working directory
mkdir -p $WORKDIR
cd $WORKDIR

# Clone environment
git clone --depth 1 --recursive --branch ev3dev-stretch https://github.com/ev3dev/ev3dev-buildscripts.git
git clone --depth 1 --recursive --branch ev3dev-stretch https://github.com/ev3dev/ev3-kernel.git

# Update submodule
cd ev3-kernel/drivers/lego
git pull origin ev3dev-stretch
cd $WORKDIR

# Build the EV3 kernel
cd ev3dev-buildscripts
echo "export EV3DEV_MAKE_ARGS=-j$(nproc)" > local-env
./build-kernel
cd $WORKDIR

# Download Wi-Fi driver
git clone --depth 1 https://gitee.com/coolflyreg163/rtl8821cu.git
cd rtl8821cu

# Compile Wi-Fi driver
BIN_PATH="$GNU_PATH/gcc-linaro-arm-linux-gnueabihf-6.4/bin"
make ARCH=arm KVER=4.14 \
KSRC="$WORKDIR/ev3dev-buildscripts/build-area/linux-ev3dev-ev3-obj" \
CC="$BIN_PATH/arm-linux-gnueabihf-gcc" \
LD="$BIN_PATH/arm-linux-gnueabihf-ld"