Skip to content

Commit a6efc40

Browse files
authored
Merge pull request #225 from nbdd0121/rust
Add Rust support for RISC-V arch
2 parents 4e2d67e + 688902f commit a6efc40

File tree

12 files changed

+2985
-5
lines changed

12 files changed

+2985
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
# Exclude `LLVM=1` where not supported.
2626
- arch: ppc64le
2727
toolchain: llvm
28+
- arch: riscv64
29+
toolchain: llvm
2830

2931
# A few independent combinations to avoid exploding the matrix:
3032
# - The other option for `output`.
@@ -92,6 +94,15 @@ jobs:
9294
echo 'QEMU_ARCH=arm' >> $GITHUB_ENV
9395
echo 'QEMU_MACHINE=virt' >> $GITHUB_ENV
9496
echo 'QEMU_CPU=cortex-a7' >> $GITHUB_ENV
97+
- if: matrix.arch == 'riscv64'
98+
run: |
99+
echo 'MAKE_ARCH=ARCH=riscv' >> $GITHUB_ENV
100+
echo 'MAKE_CROSS_COMPILE=CROSS_COMPILE=riscv64-linux-gnu-' >> $GITHUB_ENV
101+
echo 'IMAGE_PATH=arch/riscv/boot/Image' >> $GITHUB_ENV
102+
echo 'QEMU_ARCH=riscv64' >> $GITHUB_ENV
103+
echo 'QEMU_MACHINE=virt' >> $GITHUB_ENV
104+
echo 'QEMU_CPU=rv64' >> $GITHUB_ENV
105+
echo 'QEMU_ARGS=-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf' >> $GITHUB_ENV
95106
96107
- if: matrix.toolchain == 'clang'
97108
run: echo 'MAKE_TOOLCHAIN=CC=clang-11' >> $GITHUB_ENV
@@ -122,6 +133,12 @@ jobs:
122133
run: sudo apt-get install -y gcc-aarch64-linux-gnu
123134
- if: matrix.arch == 'ppc64le'
124135
run: sudo apt-get install -y gcc-powerpc64le-linux-gnu
136+
- if: matrix.arch == 'riscv64'
137+
run: sudo apt-get install -y gcc-riscv64-linux-gnu
138+
139+
# Setup OpenSBI
140+
- if: matrix.arch == 'riscv64'
141+
run: sudo apt-get install -y opensbi
125142

126143
# Setup: libelf
127144
- run: sudo apt-get install -y libelf-dev
@@ -133,6 +150,8 @@ jobs:
133150
run: sudo apt-get install -y qemu-system-arm
134151
- if: matrix.arch == 'ppc64le'
135152
run: sudo apt-get install -y qemu-system-ppc
153+
- if: matrix.arch == 'riscv64'
154+
run: sudo apt-get install -y qemu-system-misc
136155

137156
# Setup: rustc
138157
- if: matrix.install == 'rustup'
@@ -205,6 +224,7 @@ jobs:
205224

206225
- run: |
207226
qemu-system-${{ env.QEMU_ARCH }} \
227+
${{ env.QEMU_ARGS }} \
208228
-kernel ${{ env.BUILD_DIR }}${{ env.IMAGE_PATH }} \
209229
-initrd qemu-initramfs.img \
210230
-M ${{ env.QEMU_MACHINE }} \

0 commit comments

Comments
 (0)