Skip to content

Commit

Permalink
Merge pull request #120 from syswonder/dev
Browse files Browse the repository at this point in the history
Merge dev into main
  • Loading branch information
caodg authored Jun 6, 2024
2 parents 1a47719 + f841b85 commit c54f363
Show file tree
Hide file tree
Showing 50 changed files with 1,201 additions and 123 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ jobs:
crate: cargo-binutils
version: latest
use-tool-cache: true
# musl toolchain is also needed in non-musl apps
# because we need to build opensbi under riscv64
- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}

- name: Build display/basic_painting
run: make ARCH=${{ matrix.arch }} A=apps/display/basic_painting
- name: Build display/draw_map
run: make ARCH=${{ matrix.arch }} A=apps/display/draw_map
- name: Build fs/shell
run: make ARCH=${{ matrix.arch }} A=apps/fs/shell

- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}
- name: Build c/helloworld
run: make ARCH=${{ matrix.arch }} A=apps/c/helloworld
- name: Build c/memtest
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "patches/opensbi"]
path = patches/opensbi
url = https://github.com/Sssssaltyfish/opensbi.git
34 changes: 24 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
"crates/driver_net",
"crates/driver_pci",
"crates/driver_virtio",
"crates/dtb",
"crates/dtb",
"crates/flatten_objects",
"crates/lazy_init",
"crates/linked_list",
Expand All @@ -42,6 +42,7 @@ members = [
"modules/ruxconfig",
"modules/ruxdisplay",
"modules/ruxdriver",
"modules/ruxfdtable",
"modules/ruxfs",
"modules/ruxhal",
"modules/ruxruntime",
Expand All @@ -67,3 +68,6 @@ lto = true
[profile.reldebug]
inherits = "release"
debug = true

[patch.crates-io]
sbi-spec = { git = "https://github.com/Sssssaltyfish/rustsbi.git", rev = "a25d448d3d770c6db493a472e3e78d949b63f523", optional = true }
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,19 @@ LD_SCRIPT := $(CURDIR)/modules/ruxhal/linker_$(PLATFORM_NAME).lds
OUT_ELF := $(OUT_DIR)/$(APP_NAME)_$(PLATFORM_NAME).elf
OUT_BIN := $(OUT_DIR)/$(APP_NAME)_$(PLATFORM_NAME).bin

PREBUILD := $(CURDIR)/scripts/prebuild/$(ARCH).mk

all: build

# prebuild option to be overriden in `$(PREBUILD)`
define run_prebuild
endef

# prebuild makefile might override some variables by their own
# so it must be placed before the rest of the makefiles
ifneq ($(wildcard $(PREBUILD)),)
include $(PREBUILD)
endif
include scripts/make/utils.mk
include scripts/make/build.mk
include scripts/make/qemu.mk
Expand All @@ -178,6 +189,16 @@ else ifeq ($(PLATFORM_NAME), aarch64-bsta1000b)
include scripts/make/bsta1000b-fada.mk
endif

_force: ;

# prebuild scripts must track their dependencies by themselves
prebuild: _force
$(call run_prebuild)

$(OUT_DIR): prebuild

$(OUT_BIN): prebuild

build: $(OUT_DIR) $(OUT_BIN)

disasm:
Expand Down Expand Up @@ -248,4 +269,5 @@ clean_musl:
rm -rf ulib/ruxmusl/build_*
rm -rf ulib/ruxmusl/install

.PHONY: all build disasm run justrun debug clippy fmt fmt_c test test_no_fail_fast clean clean_c clean_musl doc disk_image debug_no_attach
.PHONY: all build disasm run justrun debug clippy fmt fmt_c test test_no_fail_fast clean clean_c\
clean_musl doc disk_image debug_no_attach prebuild _force
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# RuxOS

[![CI](https://github.com/syswonder/ruxos/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/syswonder/ruxos/actions/workflows/build.yml)
[![CI](https://github.com/syswonder/ruxos/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/syswonder/ruxos/actions/workflows/test.yml)

An experimental modular operating system (or unikernel) written in Rust.
<p align="center">
<img src="doc/figures/ruxos-logo0.svg" alt="RuxOS-logo" width="500"><br>
A unikernel operating system written in Rust.<br/>
<a href="https://github.com/syswonder/ruxos/actions/workflows/build.yml"><img src="https://github.com/syswonder/ruxos/actions/workflows/build.yml/badge.svg?branch=main" alt="Build CI" style="max-width: 100%;"></a>
<a href="https://github.com/syswonder/ruxos/actions/workflows/test.yml"><img src="https://github.com/syswonder/ruxos/actions/workflows/test.yml/badge.svg?branch=main" alt="Test CI" style="max-width: 100%;"></a>
<br/>
</p>

RuxOS was inspired by [Unikraft](https://github.com/unikraft/unikraft) and [ArceOS](https://github.com/rcore-os/arceos)

Expand Down Expand Up @@ -34,16 +37,16 @@ Example applications can be found in the [apps/](apps/) directory. All applicati
* [ruxconfig](modules/ruxconfig/): Platform constants and kernel parameters, such as physical memory base, kernel load addresses, stack size, etc.
* [axlog](modules/axlog/): Multi-level formatted logging.

The currently supported applications (Rust), as well as their dependent modules and features, are shown in the following table:
The currently supported applications and programming languages, as well as their dependent modules and features, are shown in the following table:

### Rust
### Rust applications

| App | Extra modules | Enabled features | Description |
|-|-|-|-|
| [display](apps/display/) | axalloc, ruxdisplay | alloc, paging, display | Graphic/GUI test |
| [shell](apps/fs/shell/) | axalloc, ruxdriver, ruxfs | alloc, paging, fs | A simple shell that responds to filesystem operations |

### C
### C applications

| App | Enabled features | Description |
|-|-|-|
Expand All @@ -60,13 +63,24 @@ The currently supported applications (Rust), as well as their dependent modules
| [pipe](apps/c/pthread/pipe/) | alloc, paging, multitask, pipe | A test for pipe API |
| [sleep](apps/c/pthread/sleep/) | alloc, paging, multitask, irq | Thread sleeping test |
| [tsd](apps/c/pthread/tsd/) | alloc, paging, multitask, irq | A test for pthread-key related API |
| [dl](apps/c/dl/) | paging, alloc, irq, musl, multitask, fs, pipe, poll, rtc, signal, virtio-9p | An example for dynamically loading apps |
| [libc-bench](apps/c/libc-bench/) | alloc, multitask, fs, musl | A standard libc test for musl libc integration |
| [iperf](apps/c/iperf/) | alloc, paging, net, fs, blkfs, select, fp_simd | A network performance test tool |
| [redis](apps/c/redis/) | alloc, paging, fp_simd, irq, multitask, fs, blkfs, net, pipe, epoll, poll, virtio-9p, rtc | A Redis server on Ruxos |
| [sqlite3](apps/c/sqlite3/) | alloc, paging, fs, fp_simd, blkfs | A simple test for Sqlite3 API |
| [iperf](https://github.com/syswonder/rux-iperf) | alloc, paging, net, fs, blkfs, select, fp_simd | A network performance test tool |
| [redis](https://github.com/syswonder/rux-redis) | alloc, paging, fp_simd, irq, multitask, fs, blkfs, net, pipe, epoll, poll, virtio-9p, rtc | Redis server on Ruxos |
| [cpp](apps/c/cpp/) | alloc, paging, irq, multitask, fs, random-hw | C++ benchmark |
| [dl](apps/c/dl/) | paging, alloc, irq, musl, multitask, fs, pipe, poll, rtc, signal, virtio-9p | An example for dynamically loading apps |
| [nginx](https://github.com/syswonder/rux-nginx) | alloc, paging, fp_simd, irq, multitask, fs, blkfs, net, pipe, epoll, poll, select, rtc, signal | Run Nginx as web server |
| [wamr](https://github.com/syswonder/rux-wamr) | alloc, paging, fp_simd, irq, multitask, fs, virtio-9p, signal, smp | Wasm runtime |

### Programming languages

| Language | Description |
|- | - |
| C | Run C apps by RuxOS ruxlibc or standard musl libc supported by ruxmusl. Evaluated by libc-bench. |
| C++ | Run C++ apps by c++ static library provided by musl libc. Passed c++ benchmark. Evaluated by c++ benchmark. |
| [Perl](https://github.com/syswonder/rux-perl) | Run Perl standard library by musl libc. Evaluated by Perl benchmark. |
| [Python](https://github.com/syswonder/rux-python3) | Run Python apps by dynamically loading Python modules. Evaluated by Python benchmark. |
| Rust | Run Rust standard library by modifying Rust std source. Evaluated by Rust tests. |

## Build & Run

Expand Down Expand Up @@ -197,6 +211,10 @@ make PLATFORM=aarch64-raspi4 A=apps/fs/shell FEATURES=driver-bcm2835-sdhci
make PLATFORM=x86_64-pc-oslab A=apps/c/redis FEATURES=driver-ixgbe,driver-ramdisk SMP=4
```

## RuxGo

A convient tool to run RuxOS applications by concise command. See [RuxGo-Book](https://ruxgo.syswonder.org/) for more information.

## Design

![](doc/figures/ruxos.svg)
1 change: 1 addition & 0 deletions api/ruxos_posix_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ruxconfig = { path = "../../modules/ruxconfig" }
axlog = { path = "../../modules/axlog" }
ruxhal = { path = "../../modules/ruxhal" }
axsync = { path = "../../modules/axsync" }
ruxfdtable = { path = "../../modules/ruxfdtable" }
ruxfutex = { path = "../../modules/ruxfutex", optional = true }
axalloc = { path = "../../modules/axalloc", optional = true }
ruxtask = { path = "../../modules/ruxtask", optional = true }
Expand Down
Loading

0 comments on commit c54f363

Please sign in to comment.