Skip to content

Commit

Permalink
Update build check CI to follow the Raspberry Pi official cross compi…
Browse files Browse the repository at this point in the history
…le procedure (#86)
  • Loading branch information
ShotaAk authored Sep 2, 2024
1 parent 2240c72 commit f5dfa98
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 31,206 deletions.
79 changes: 43 additions & 36 deletions .github/workflows/driver-cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,63 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Lint
run: |
./.test/lint.sh
build:
needs: lint
strategy:
fail-fast: false
matrix:
env:
- { RPI_LINUX_VER: rpi-5.4.y, CONFIG_FILE: config-5.4.83-v7+, RPI_LINUX_COMMIT_HASH: 76c49e6, GCC_VER: 8.3 }
- { RPI_LINUX_VER: rpi-5.10.y, CONFIG_FILE: config-5.10.11-v7+, RPI_LINUX_COMMIT_HASH: 6af8ae3, GCC_VER: 8.3 }
- { RPI_LINUX_VER: rpi-5.15.y, CONFIG_FILE: config-5.15.61-v7l+, RPI_LINUX_COMMIT_HASH: 5b775d7, GCC_VER: 10.2 }
- { RPI_LINUX_VER: rpi-5.15.y, CONFIG_FILE: config-5.15.76-v7l+, RPI_LINUX_COMMIT_HASH: 45d339389bb85588b8045dd40a00c54d01e2e711, GCC_VER: 10.2 }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- { HOST: 20.04, KERNEL_VER: rpi-5.4.y, OS_BIT: armhf } # Debian 10 (Buster)
- { HOST: 20.04, KERNEL_VER: rpi-5.10.y, OS_BIT: armhf } # Debian 11 (Bullseye)
- { HOST: 22.04, KERNEL_VER: rpi-5.15.y, OS_BIT: armhf } # Debian 11 (Bullseye)
# - { HOST: 24.04, KERNEL_VER: rpi-6.6.y, OS_BIT: armhf } # Debian 12 (Bookworm) 32-bit
# - { HOST: 24.04, KERNEL_VER: rpi-6.6.y, OS_BIT: arm64 } # Debian 12 (Bookworm) 64-bit

- name: Install cross-build settings
id: gcc
env:
GCC_VER: ${{ matrix.env.GCC_VER }}
SRC_DIR: ${{ github.workspace }}
run: |
source ./.test/step0.sh
prepare_cross_compiler
echo "path=${CROSS_COMPILE_PATH}" >> $GITHUB_OUTPUT
runs-on: ubuntu-${{ matrix.env.HOST }}

- name: Install kernel headers
env:
RPI_LINUX_VER: ${{ matrix.env.RPI_LINUX_VER }}
CONFIG_FILE: ${{ matrix.env.CONFIG_FILE }}
RPI_LINUX_COMMIT_HASH: ${{ matrix.env.RPI_LINUX_COMMIT_HASH }}
GCC_VER: ${{ matrix.env.GCC_VER }}
CROSS_COMPILE_PATH: ${{ steps.gcc.outputs.path }}
SRC_DIR: ${{ github.workspace }}
run: |
source ./.test/step1.sh
install_kernel_headers
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Build kernel module
env:
CROSS_COMPILE_PATH: ${{ steps.gcc.outputs.path }}
SRC_DIR: ${{ github.workspace }}
run: |
source ./.test/step2.sh
build_kernel_module
- name: Set up cross-compilation toolchain
run: |
sudo apt update
sudo apt install -y bc bison flex libssl-dev make libc6-dev libncurses5-dev
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
sudo apt install -y crossbuild-essential-armhf
else
sudo apt install -y crossbuild-essential-arm64
fi
- name: Clone Raspberry Pi Linux Kernel
run: |
git clone --branch ${{ matrix.env.KERNEL_VER }} --depth=1 https://github.com/raspberrypi/linux
cd linux
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
KERNEL=kernel7l
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_prepare
else
KERNEL=kernel8
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_prepare
fi
- name: Build the kernel module
run: |
cd linux
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- M=$GITHUB_WORKSPACE/src/drivers V=1 modules
else
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- M=$GITHUB_WORKSPACE/src/drivers V=1 modules
fi
17 changes: 0 additions & 17 deletions .test/Makefile.crosscompile

This file was deleted.

92 changes: 0 additions & 92 deletions .test/README.md

This file was deleted.

Loading

0 comments on commit f5dfa98

Please sign in to comment.