Skip to content

Commit ea7b892

Browse files
committed
REVYOS: ci: add cross/native build
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
1 parent fce8455 commit ea7b892

2 files changed

Lines changed: 158 additions & 0 deletions

File tree

.github/workflows/kernel-build.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: upstream-cross-kernel
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-kernel:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- name: cross
15+
rvtoolchain: 2026.01.01
16+
board: revyos
17+
18+
runs-on: ubuntu-24.04
19+
env:
20+
mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${{ matrix.rvtoolchain }}
21+
mainline_toolchain_file_name: riscv64-glibc-ubuntu-24.04-gcc.tar.xz
22+
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0'
23+
ARCH: riscv
24+
KBUILD_BUILD_USER: riscv
25+
KBUILD_BUILD_HOST: riscv-builder
26+
KDEB_COMPRESS: xz
27+
board: ${{ matrix.board }}
28+
CROSS_COMPILE: riscv64-unknown-linux-gnu-
29+
DEB_BUILD_PROFILES: pkg.linux-upstream.nokernelheaders
30+
TZ: Asia/Shanghai
31+
32+
steps:
33+
- name: Update Apt Cache
34+
run: sudo apt update
35+
36+
- name: Free Disk Space
37+
uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
38+
with:
39+
remove_android: true
40+
remove_dotnet: true
41+
remove_haskell: true
42+
remove_tool_cache: true
43+
remove_swap: true
44+
remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
45+
remove_packages_one_command: true
46+
remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
47+
rm_cmd: "rm" # Use 'rmz' for faster deletion (default: 'rm')
48+
rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
49+
testing: false
50+
51+
- name: Checkout
52+
uses: actions/checkout@v6
53+
with:
54+
path: kernel
55+
56+
- name: Install software
57+
run: |
58+
sudo apt install -y gdisk dosfstools g++-riscv64-linux-gnu build-essential \
59+
libncurses-dev gawk flex bison openssl libssl-dev tree \
60+
dkms libelf-dev libudev-dev libpci-dev libiberty-dev libdw-dev autoconf \
61+
device-tree-compiler xz-utils devscripts ccache debhelper bc gcc-riscv64-linux-gnu \
62+
rustc rust-src bindgen rustfmt rust-clippy
63+
64+
- name: Compile Kernel && Install
65+
run: |
66+
mkdir -p output
67+
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name}
68+
tar -xvf ${mainline_toolchain_file_name} -C /opt
69+
export PATH="/opt/riscv/bin:$PATH"
70+
${CROSS_COMPILE}gcc -v
71+
pushd kernel
72+
export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)"
73+
export RUST_LIB_SRC=/usr/src/rustc-$(rustc --version | cut -d' ' -f2)/library
74+
make debian_defconfig
75+
76+
make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}"
77+
sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/output
78+
79+
# record commit-id
80+
git rev-parse HEAD > kernel-commitid
81+
sudo cp -v kernel-commitid ${GITHUB_WORKSPACE}/output
82+
popd
83+
84+
- name: 'Upload Artifact'
85+
uses: actions/upload-artifact@v7
86+
with:
87+
name: kernel-${{ matrix.name }}-${{ matrix.rvtoolchain }}-${{ matrix.board }}
88+
path: output/*
89+
retention-days: 30

.github/workflows/native-build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: upstream-native-kernel
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0'
10+
ARCH: riscv
11+
KBUILD_BUILD_USER: builder
12+
KBUILD_BUILD_HOST: revyos-riscv-builder
13+
KDEB_COMPRESS: xz
14+
KDEB_CHANGELOG_DIST: unstable
15+
TZ: Asia/Shanghai
16+
17+
jobs:
18+
kernel:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- name: native
24+
cross: riscv64-linux-gnu-
25+
machine: [ self-hosted, Linux, riscv64 ]
26+
run_image: ghcr.io/revyos/revyos-kernel-builder:debian-trixie-2025.12.16
27+
board: revyos
28+
compiler: riscv64-linux-gnu-gcc-14
29+
30+
runs-on: ${{ matrix.machine }}
31+
container:
32+
image: ${{ matrix.run_image }}
33+
env:
34+
CROSS_COMPILE: ${{ matrix.cross }}
35+
board: ${{ matrix.board }}
36+
compiler: ${{ matrix.compiler }}
37+
38+
steps:
39+
- name: Checkout kernel
40+
uses: actions/checkout@v6
41+
with:
42+
path: 'kernel'
43+
44+
- name: Compile Kernel && Install
45+
run: |
46+
mkdir -p output
47+
${CROSS_COMPILE}gcc -v
48+
49+
pushd kernel
50+
export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)"
51+
export RUST_LIB_SRC=/usr/src/rustc-$(rustc --version | cut -d' ' -f2)/library
52+
make CC="${compiler}" debian_defconfig
53+
54+
make CC="${compiler}" -j$(nproc) bindeb-pkg LOCALVERSION="-${board}"
55+
56+
# Copy deb
57+
sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/output
58+
59+
# record commit-id
60+
git rev-parse HEAD > kernel-commitid
61+
sudo cp -v kernel-commitid ${GITHUB_WORKSPACE}/output
62+
popd
63+
64+
- name: 'Upload Artifact'
65+
uses: actions/upload-artifact@v7
66+
with:
67+
name: kernel-${{ matrix.name }}-${{ matrix.board }}
68+
path: output/*
69+
retention-days: 30

0 commit comments

Comments
 (0)