Skip to content

Commit f5dfa98

Browse files
author
Shota Aoki
authored
Update build check CI to follow the Raspberry Pi official cross compile procedure (#86)
1 parent 2240c72 commit f5dfa98

File tree

12 files changed

+43
-31206
lines changed

12 files changed

+43
-31206
lines changed

.github/workflows/driver-cross-build.yml

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,56 +20,63 @@ jobs:
2020
lint:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424

25-
- uses: actions/setup-python@v4
25+
- uses: actions/setup-python@v5
2626
with:
2727
python-version: '3.x'
2828

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

46-
- name: Install cross-build settings
47-
id: gcc
48-
env:
49-
GCC_VER: ${{ matrix.env.GCC_VER }}
50-
SRC_DIR: ${{ github.workspace }}
51-
run: |
52-
source ./.test/step0.sh
53-
prepare_cross_compiler
54-
echo "path=${CROSS_COMPILE_PATH}" >> $GITHUB_OUTPUT
45+
runs-on: ubuntu-${{ matrix.env.HOST }}
5546

56-
- name: Install kernel headers
57-
env:
58-
RPI_LINUX_VER: ${{ matrix.env.RPI_LINUX_VER }}
59-
CONFIG_FILE: ${{ matrix.env.CONFIG_FILE }}
60-
RPI_LINUX_COMMIT_HASH: ${{ matrix.env.RPI_LINUX_COMMIT_HASH }}
61-
GCC_VER: ${{ matrix.env.GCC_VER }}
62-
CROSS_COMPILE_PATH: ${{ steps.gcc.outputs.path }}
63-
SRC_DIR: ${{ github.workspace }}
64-
run: |
65-
source ./.test/step1.sh
66-
install_kernel_headers
47+
steps:
48+
- name: Checkout source code
49+
uses: actions/checkout@v4
6750

68-
- name: Build kernel module
69-
env:
70-
CROSS_COMPILE_PATH: ${{ steps.gcc.outputs.path }}
71-
SRC_DIR: ${{ github.workspace }}
72-
run: |
73-
source ./.test/step2.sh
74-
build_kernel_module
51+
- name: Set up cross-compilation toolchain
52+
run: |
53+
sudo apt update
54+
sudo apt install -y bc bison flex libssl-dev make libc6-dev libncurses5-dev
55+
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
56+
sudo apt install -y crossbuild-essential-armhf
57+
else
58+
sudo apt install -y crossbuild-essential-arm64
59+
fi
60+
61+
- name: Clone Raspberry Pi Linux Kernel
62+
run: |
63+
git clone --branch ${{ matrix.env.KERNEL_VER }} --depth=1 https://github.com/raspberrypi/linux
64+
cd linux
65+
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
66+
KERNEL=kernel7l
67+
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
68+
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_prepare
69+
else
70+
KERNEL=kernel8
71+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig
72+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_prepare
73+
fi
7574
75+
- name: Build the kernel module
76+
run: |
77+
cd linux
78+
if [ "${{ matrix.env.OS_BIT }}" == "armhf" ]; then
79+
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- M=$GITHUB_WORKSPACE/src/drivers V=1 modules
80+
else
81+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- M=$GITHUB_WORKSPACE/src/drivers V=1 modules
82+
fi

.test/Makefile.crosscompile

Lines changed: 0 additions & 17 deletions
This file was deleted.

.test/README.md

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)