Skip to content

Commit 8d2da38

Browse files
author
miiyakumo
committed
config: 基本的开发环境配置
1 parent fe15038 commit 8d2da38

9 files changed

Lines changed: 116 additions & 0 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "comix-devcontainer",
3+
"build": {
4+
"dockerfile": "../Dockerfile"
5+
},
6+
"postCreateCommand": "rustup show",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
]
11+
}
12+
}
13+
}

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/*

.github/workflows/test.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Run tests
2+
3+
on: [push]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
rust_toolchain: nightly-2025-02-18
8+
9+
jobs:
10+
# build-doc:
11+
# runs-on: ubuntu-latest
12+
# steps:
13+
# - uses: actions/checkout@v3
14+
# - uses: actions-rs/toolchain@v1
15+
# with:
16+
# profile: minimal
17+
# toolchain: ${{ env.rust_toolchain }}
18+
# components: rust-src, llvm-tools-preview
19+
# target: riscv64gc-unknown-none-elf
20+
# - name: Build doc
21+
# run: cd os && cargo doc --no-deps --verbose
22+
# - name: Deploy to Github Pages
23+
# uses: peaceiris/actions-gh-pages@v3
24+
# with:
25+
# github_token: ${{ secrets.GITHUB_TOKEN }}
26+
# publish_dir: ./os/target/riscv64gc-unknown-none-elf/doc
27+
# destination_dir: ${{ github.ref_name }}
28+
29+
run-tests:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions-rs/toolchain@v1
34+
with:
35+
profile: minimal
36+
toolchain: ${{ env.rust_toolchain }}
37+
components: rust-src, llvm-tools-preview
38+
target: riscv64gc-unknown-none-elf
39+
- uses: actions-rs/install@v0.1
40+
with:
41+
crate: cargo-binutils
42+
version: latest
43+
use-tool-cache: true
44+
- name: Cache QEMU
45+
uses: actions/cache@v3
46+
with:
47+
path: qemu-7.0.0
48+
key: qemu-7.0.0-x86_64-riscv64
49+
- name: Install QEMU
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
53+
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
54+
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev \
55+
python3 python3-pip ninja-build -y
56+
if [ ! -d qemu-7.0.0 ]; then
57+
wget https://download.qemu.org/qemu-7.0.0.tar.xz
58+
tar -xf qemu-7.0.0.tar.xz
59+
cd qemu-7.0.0
60+
./configure --target-list=riscv64-softmmu
61+
make -j
62+
else
63+
cd qemu-7.0.0
64+
fi
65+
sudo make install
66+
qemu-system-riscv64 --version
67+
68+
- name: Run usertests
69+
run: cd os && make run TEST=1
70+
timeout-minutes: 10
71+

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM ubuntu:latest as build_qemu

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
DOCKER_TAG ?= comix:latest
2+
.PHONY: docker build_docker
3+
4+
docker:
5+
docker run --rm -it -v ${PWD}:/mnt -w /mnt --name comix ${DOCKER_TAG} bash
6+
7+
build_docker:
8+
docker build -t ${DOCKER_TAG} --target build .
9+
10+
fmt:
11+
cd os ; cargo fmt; cd ..
12+
13+
run:
14+
cd os && cargo run

bootloader/rustsbi-qemu.bin

31.6 KB
Binary file not shown.

os/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

os/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "os"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]

os/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}

0 commit comments

Comments
 (0)