|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build linux.bin |
| 11 | + runs-on: ubuntu-latest-8-cores |
| 12 | + container: debian:trixie-20250811 |
| 13 | + env: |
| 14 | + DEBIAN_FRONTEND: noninteractive |
| 15 | + steps: |
| 16 | + - name: Install build dependencies |
| 17 | + run: | |
| 18 | + apt-get update |
| 19 | + apt-get install --no-install-recommends -y \ |
| 20 | + bc \ |
| 21 | + bison \ |
| 22 | + build-essential \ |
| 23 | + ca-certificates \ |
| 24 | + flex \ |
| 25 | + gcc-riscv64-linux-gnu \ |
| 26 | + git \ |
| 27 | + python3 \ |
| 28 | + rsync |
| 29 | +
|
| 30 | + - name: Checkout Linux source code |
| 31 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 32 | + |
| 33 | + - name: Checkout OpenSBI source code |
| 34 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 35 | + with: |
| 36 | + repository: cartesi/opensbi |
| 37 | + ref: 5612514832be90d2df920eb1fe89a18c57bacbf5 # v1.3.1-ctsi-2 |
| 38 | + path: .opensbi |
| 39 | + |
| 40 | + - name: Build Linux |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD) |
| 44 | + KERNEL_TIMESTAMP=$(date --utc --date="@${SOURCE_DATE_EPOCH}" --rfc-email) |
| 45 | + LINUX_OPTS=( |
| 46 | + -j"$(nproc)" |
| 47 | + ARCH=riscv |
| 48 | + CROSS_COMPILE=riscv64-linux-gnu- |
| 49 | + KBUILD_BUILD_TIMESTAMP="${KERNEL_TIMESTAMP}" |
| 50 | + KBUILD_BUILD_USER=dapp |
| 51 | + KBUILD_BUILD_HOST=cartesi |
| 52 | + ) |
| 53 | +
|
| 54 | + make "${LINUX_OPTS[@]}" cartesi_defconfig |
| 55 | + make "${LINUX_OPTS[@]}" olddefconfig |
| 56 | + make "${LINUX_OPTS[@]}" vmlinux Image |
| 57 | +
|
| 58 | + - name: Build linux.bin |
| 59 | + run: | |
| 60 | + make -C .opensbi -j"$(nproc)" \ |
| 61 | + FW_PAYLOAD_PATH="${GITHUB_WORKSPACE}/arch/riscv/boot/Image" \ |
| 62 | + FW_PAYLOAD=y \ |
| 63 | + FW_OPTIONS=0x01 \ |
| 64 | + PLATFORM=cartesi \ |
| 65 | + CROSS_COMPILE=riscv64-linux-gnu- |
| 66 | + cp .opensbi/build/platform/cartesi/firmware/fw_payload.bin linux.bin |
| 67 | + sha512sum linux.bin > linux.bin.sha512 |
| 68 | +
|
| 69 | + - name: Upload linux.bin |
| 70 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 71 | + with: |
| 72 | + name: linux.bin |
| 73 | + path: | |
| 74 | + linux.bin |
| 75 | + linux.bin.sha512 |
| 76 | + compression-level: 0 |
| 77 | + |
| 78 | + release: |
| 79 | + name: Publish linux.bin |
| 80 | + if: startsWith(github.ref, 'refs/tags/v') |
| 81 | + needs: build |
| 82 | + runs-on: ubuntu-latest |
| 83 | + permissions: |
| 84 | + contents: write |
| 85 | + steps: |
| 86 | + - name: Download linux.bin |
| 87 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 88 | + with: |
| 89 | + name: linux.bin |
| 90 | + |
| 91 | + - name: Publish release artifacts |
| 92 | + uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 |
| 93 | + with: |
| 94 | + draft: true |
| 95 | + files: | |
| 96 | + linux.bin |
| 97 | + linux.bin.sha512 |
0 commit comments