Skip to content

Commit 432df68

Browse files
committed
Add CI for Rust w/ RISC-V
Signed-off-by: Gary Guo <[email protected]>
1 parent 87447f4 commit 432df68

File tree

3 files changed

+2808
-1
lines changed

3 files changed

+2808
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
arch: [arm, arm64, ppc64le, x86_64]
13+
arch: [arm, arm64, ppc64le, x86_64, riscv64]
1414
toolchain: [gcc, clang, llvm]
1515
config: [debug, release]
1616
rustc: [2021-02-20]
@@ -92,6 +92,15 @@ jobs:
9292
echo 'QEMU_ARCH=arm' >> $GITHUB_ENV
9393
echo 'QEMU_MACHINE=virt' >> $GITHUB_ENV
9494
echo 'QEMU_CPU=cortex-a7' >> $GITHUB_ENV
95+
- if: matrix.arch == 'riscv64'
96+
run: |
97+
echo 'MAKE_ARCH=ARCH=riscv' >> $GITHUB_ENV
98+
echo 'MAKE_CROSS_COMPILE=CROSS_COMPILE=riscv64-linux-gnu-' >> $GITHUB_ENV
99+
echo 'IMAGE_PATH=arch/riscv/boot/Image' >> $GITHUB_ENV
100+
echo 'QEMU_ARCH=riscv64' >> $GITHUB_ENV
101+
echo 'QEMU_MACHINE=virt' >> $GITHUB_ENV
102+
echo 'QEMU_CPU=rv64' >> $GITHUB_ENV
103+
echo 'QEMU_ARGS=-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf' >> $GITHUB_ENV
95104
96105
- if: matrix.toolchain == 'clang'
97106
run: echo 'MAKE_TOOLCHAIN=CC=clang-11' >> $GITHUB_ENV
@@ -122,6 +131,12 @@ jobs:
122131
run: sudo apt-get install -y gcc-aarch64-linux-gnu
123132
- if: matrix.arch == 'ppc64le'
124133
run: sudo apt-get install -y gcc-powerpc64le-linux-gnu
134+
- if: matrix.arch == 'riscv64'
135+
run: sudo apt-get install -y gcc-riscv64-linux-gnu
136+
137+
# Setup OpenSBI
138+
- if: matrix.arch == 'riscv64'
139+
run: sudo apt-get install -y opensbi
125140

126141
# Setup: libelf
127142
- run: sudo apt-get install -y libelf-dev
@@ -133,6 +148,8 @@ jobs:
133148
run: sudo apt-get install -y qemu-system-arm
134149
- if: matrix.arch == 'ppc64le'
135150
run: sudo apt-get install -y qemu-system-ppc
151+
- if: matrix.arch == 'riscv64'
152+
run: sudo apt-get install -y qemu-system-misc
136153

137154
# Setup: rustc
138155
- if: matrix.install == 'rustup'
@@ -205,6 +222,7 @@ jobs:
205222

206223
- run: |
207224
qemu-system-${{ env.QEMU_ARCH }} \
225+
${{ env.QEMU_ARGS }} \
208226
-kernel ${{ env.BUILD_DIR }}${{ env.IMAGE_PATH }} \
209227
-initrd qemu-initramfs.img \
210228
-M ${{ env.QEMU_MACHINE }} \

0 commit comments

Comments
 (0)