forked from sophgo/linux-riscv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Han Gao <rabenda.cn@gmail.com> Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
- Loading branch information
Showing
2 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: sophgo-kernel | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 2 * * *" | ||
|
||
jobs: | ||
build-kernel: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: gcc-13 | ||
board: sg2044 | ||
|
||
runs-on: ubuntu-22.04 | ||
env: | ||
xuantie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395627867 | ||
toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1-20240115.tar.gz | ||
mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.03.01 | ||
mainline_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.03.01-nightly.tar.gz | ||
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0' | ||
ARCH: riscv | ||
KBUILD_BUILD_USER: riscv | ||
KBUILD_BUILD_HOST: riscv-builder | ||
KDEB_COMPRESS: xz | ||
board: ${{ matrix.board }} | ||
CROSS_COMPILE: riscv64-unknown-linux-gnu- | ||
|
||
steps: | ||
- name: Update Apt Cache | ||
run: sudo apt update | ||
|
||
- name: Free Disk Space (Ubuntu) | ||
uses: jlumbroso/free-disk-space@main | ||
with: | ||
# this might remove tools that are actually needed, | ||
# if set to "true" but frees about 6 GB | ||
tool-cache: true | ||
# all of these default to true, but feel free to set to | ||
# "false" if necessary for your workflow | ||
android: true | ||
dotnet: true | ||
haskell: true | ||
large-packages: true | ||
docker-images: true | ||
swap-storage: true | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: kernel | ||
|
||
- name: Install software | ||
run: | | ||
sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu build-essential \ | ||
libncurses-dev gawk flex bison openssl libssl-dev tree \ | ||
dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf \ | ||
device-tree-compiler xz-utils devscripts ccache debhelper bc gcc-riscv64-linux-gnu | ||
- name: Compile Kernel && Install | ||
run: | | ||
mkdir -p artifact | ||
if [[ ${{ matrix.name }} = "thead-gcc" ]]; then | ||
${wget_alias} ${xuantie_toolchain}/${toolchain_file_name} | ||
tar -xvf ${toolchain_file_name} -C /opt | ||
export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1/bin:$PATH" | ||
else | ||
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name} | ||
tar -xvf ${mainline_toolchain_file_name} -C /opt | ||
export PATH="/opt/riscv/bin:$PATH" | ||
fi | ||
${CROSS_COMPILE}gcc -v | ||
pushd kernel | ||
export KDEB_PKGVERSION="$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" | ||
make revyos_defconfig | ||
make -j$(nproc) dtbs | ||
make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}" | ||
sudo cp -v arch/riscv/boot/dts/sophgo/*.dtb ../artifact | ||
sudo cp -v ../*.deb ../artifact | ||
popd | ||
- name: compress | ||
run: tar -zcvf sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz artifact | ||
|
||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz | ||
path: sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: sophgo-kernel-native | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 2 * * *" | ||
|
||
env: | ||
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0' | ||
ARCH: riscv | ||
KBUILD_BUILD_USER: builder | ||
KBUILD_BUILD_HOST: revyos-riscv-builder | ||
KDEB_COMPRESS: none | ||
KDEB_CHANGELOG_DIST: unstable | ||
|
||
jobs: | ||
kernel: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: native | ||
cross: riscv64-linux-gnu- | ||
machine: [ self-hosted, Linux, riscv64 ] | ||
run_image: ghcr.io/revyos/revyos-kernel-builder:riscv64-2024.04.19 | ||
board: sg2044 | ||
compiler: riscv64-linux-gnu-gcc-13 | ||
|
||
runs-on: ${{ matrix.machine }} | ||
container: | ||
image: ${{ matrix.run_image }} | ||
env: | ||
CROSS_COMPILE: ${{ matrix.cross }} | ||
board: ${{ matrix.board }} | ||
compiler: ${{ matrix.compiler }} | ||
|
||
steps: | ||
- name: Checkout kernel | ||
uses: actions/checkout@v4 | ||
with: | ||
path: 'kernel' | ||
|
||
- name: Compile Kernel && Install | ||
run: | | ||
mkdir -p output | ||
${CROSS_COMPILE}gcc -v | ||
pushd kernel | ||
export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" | ||
make CC="${compiler}" revyos_defconfig | ||
# FIXME: force use 32 thread | ||
make CC="${compiler}" -j64 bindeb-pkg LOCALVERSION="-${board}" | ||
make CC="${compiler}" -j64 dtbs | ||
sudo cp -v arch/riscv/boot/dts/sophgo/*.dtb ${GITHUB_WORKSPACE}/output | ||
# Copy deb | ||
sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/output | ||
# record commit-id | ||
git rev-parse HEAD > kernel-commitid | ||
sudo cp -v kernel-commitid ${GITHUB_WORKSPACE}/output | ||
popd | ||
- name: compress | ||
run: tar -zcvf sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz output | ||
|
||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz | ||
path: sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz | ||
retention-days: 30 |