|
| 1 | +name: sophgo-kernel |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + schedule: |
| 8 | + - cron: "0 2 * * *" |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-kernel: |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - name: gcc-13 |
| 17 | + board: sg2044 |
| 18 | + |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + env: |
| 21 | + xuantie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1705395627867 |
| 22 | + toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1-20240115.tar.gz |
| 23 | + mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.03.01 |
| 24 | + mainline_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.03.01-nightly.tar.gz |
| 25 | + wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0' |
| 26 | + ARCH: riscv |
| 27 | + KBUILD_BUILD_USER: riscv |
| 28 | + KBUILD_BUILD_HOST: riscv-builder |
| 29 | + KDEB_COMPRESS: xz |
| 30 | + board: ${{ matrix.board }} |
| 31 | + CROSS_COMPILE: riscv64-unknown-linux-gnu- |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Update Apt Cache |
| 35 | + run: sudo apt update |
| 36 | + |
| 37 | + - name: Free Disk Space (Ubuntu) |
| 38 | + uses: jlumbroso/free-disk-space@main |
| 39 | + with: |
| 40 | + # this might remove tools that are actually needed, |
| 41 | + # if set to "true" but frees about 6 GB |
| 42 | + tool-cache: true |
| 43 | + # all of these default to true, but feel free to set to |
| 44 | + # "false" if necessary for your workflow |
| 45 | + android: true |
| 46 | + dotnet: true |
| 47 | + haskell: true |
| 48 | + large-packages: true |
| 49 | + docker-images: true |
| 50 | + swap-storage: true |
| 51 | + |
| 52 | + - name: Checkout |
| 53 | + uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + path: kernel |
| 56 | + |
| 57 | + - name: Install software |
| 58 | + run: | |
| 59 | + sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu build-essential \ |
| 60 | + libncurses-dev gawk flex bison openssl libssl-dev tree \ |
| 61 | + dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf \ |
| 62 | + device-tree-compiler xz-utils devscripts ccache debhelper bc gcc-riscv64-linux-gnu |
| 63 | +
|
| 64 | + - name: Compile Kernel && Install |
| 65 | + run: | |
| 66 | + mkdir -p artifact |
| 67 | + if [[ ${{ matrix.name }} = "thead-gcc" ]]; then |
| 68 | + ${wget_alias} ${xuantie_toolchain}/${toolchain_file_name} |
| 69 | + tar -xvf ${toolchain_file_name} -C /opt |
| 70 | + export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.1/bin:$PATH" |
| 71 | + else |
| 72 | + ${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name} |
| 73 | + tar -xvf ${mainline_toolchain_file_name} -C /opt |
| 74 | + export PATH="/opt/riscv/bin:$PATH" |
| 75 | + fi |
| 76 | + ${CROSS_COMPILE}gcc -v |
| 77 | + pushd kernel |
| 78 | + export KDEB_PKGVERSION="$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" |
| 79 | + make revyos_defconfig |
| 80 | +
|
| 81 | + make -j$(nproc) dtbs |
| 82 | + make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}" |
| 83 | + sudo cp -v arch/riscv/boot/dts/sophgo/*.dtb ../artifact |
| 84 | + sudo cp -v ../*.deb ../artifact |
| 85 | + popd |
| 86 | +
|
| 87 | + - name: compress |
| 88 | + run: tar -zcvf sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz artifact |
| 89 | + |
| 90 | + - name: 'Upload Artifact' |
| 91 | + uses: actions/upload-artifact@v3 |
| 92 | + with: |
| 93 | + name: sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz |
| 94 | + path: sophgo-kernel-${{ matrix.name }}-${{ matrix.board }}.tar.gz |
| 95 | + retention-days: 30 |
0 commit comments