|
| 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 |
0 commit comments