Example applications can be found in the apps/ directory. All applications must at least depend on the following modules, while other modules are optional:
ruxruntime: Bootstrapping from the bare-metal environment, and initialization.
ruxhal: Hardware abstraction layer, provides unified APIs for cross-platform.
ruxconfig: Platform constants and kernel parameters, such as physical memory base, kernel load addresses, stack size, etc.
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
Install build dependencies
Install cargo-binutils to use rust-objcopy and rust-objdump tools:
cargo install cargo-binutils
for build&run C apps
Install libclang-dev:
sudo apt install libclang-dev
Download&Install cross-musl-based toolchains:
# download
wget https://musl.cc/aarch64-linux-musl-cross.tgz
wget https://musl.cc/riscv64-linux-musl-cross.tgz
wget https://musl.cc/x86_64-linux-musl-cross.tgz
# install
tar zxf aarch64-linux-musl-cross.tgz
tar zxf riscv64-linux-musl-cross.tgz
tar zxf x86_64-linux-musl-cross.tgz
# exec below command in bash OR add below info in ~/.bashrc
export PATH=`pwd`/x86_64-linux-musl-cross/bin:`pwd`/aarch64-linux-musl-cross/bin:`pwd`/riscv64-linux-musl-cross/bin:$PATH
Example apps
# in ruxos directory
make A=path/to/app ARCH=<arch> LOG=<log>
Where <arch> should be one of riscv64, aarch64,x86_64.
<log> should be one of off, error, warn, info, debug, trace.
path/to/app is the relative path to the example application.
More arguments and targets can be found in Makefile.
For example, to run the shell on qemu-system-aarch64:
make A=apps/fs/shell ARCH=aarch64 LOG=info run BLK=y
Note that the BLK=y argument is required to enable the block device in QEMU. These arguments (NET, GRAPHIC, etc.) only take effect at runtime not build time.
Your custom apps
Rust
Create a new rust package with no_std and no_main environment.
Add axstd dependency and features to enable to Cargo.toml:
Call library functions from axstd in your code, just like the Rust std library.
Build your application with RuxOS, by running the make command in the application directory:
# in app directory
make -C /path/to/ruxos A=$(pwd) ARCH=<arch> run
# more args: LOG=<log> SMP=<smp> NET=[y|n] ...
All arguments and targets are the same as above.
C
Create axbuild.mk and features.txt in your project:
app/
├── foo.c
├── bar.c
├── axbuild.mk # optional, if there is only one `main.c`
└── features.txt # optional, if only use default features
Add build targets to axbuild.mk, add features to enable to features.txt (see this example):
# in axbuild.mk
app-objs := foo.o bar.o
# in features.txt
alloc
paging
net
Build your application with RuxOS, by running the make command in the application directory:
# in app directory
make -C /path/to/ruxos A=$(pwd) ARCH=<arch> run
# more args: LOG=<log> SMP=<smp> NET=[y|n] ...
How to build RuxOS for specific platforms and devices
Set the PLATFORM variable when run make:
# Build helloworld for raspi4
make PLATFORM=aarch64-raspi4 A=apps/helloworld
You may also need to select the corrsponding device drivers by setting the FEATURES variable:
# Build the shell app for raspi4, and use the SD card driver
make PLATFORM=aarch64-raspi4 A=apps/fs/shell FEATURES=driver-bcm2835-sdhci
# Build Redis for the bare-metal x86_64 platform, and use the ixgbe and ramdisk driver
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 for more information.
RuxOS
A unikernel operating system written in Rust.
RuxOS was inspired by Unikraft and ArceOS
🚧 Working In Progress. See RuxOS Book for more information.
Features & TODOs
Example apps
Example applications can be found in the apps/ directory. All applications must at least depend on the following modules, while other modules are optional:
The currently supported applications and programming languages, as well as their dependent modules and features, are shown in the following table:
Rust applications
C applications
Programming languages
Build & Run
Install build dependencies
Install cargo-binutils to use
rust-objcopy
andrust-objdump
tools:for build&run C apps
Install
libclang-dev
:Download&Install
cross-musl-based toolchains
:Example apps
Where
<arch>
should be one ofriscv64
,aarch64
,x86_64
.<log>
should be one ofoff
,error
,warn
,info
,debug
,trace
.path/to/app
is the relative path to the example application.More arguments and targets can be found in Makefile.
For example, to run the shell on
qemu-system-aarch64
:Note that the
BLK=y
argument is required to enable the block device in QEMU. These arguments (NET
,GRAPHIC
, etc.) only take effect at runtime not build time.Your custom apps
Rust
Create a new rust package with
no_std
andno_main
environment.Add
axstd
dependency and features to enable toCargo.toml
:Call library functions from
axstd
in your code, just like the Rust std library.Build your application with RuxOS, by running the
make
command in the application directory:All arguments and targets are the same as above.
C
Create
axbuild.mk
andfeatures.txt
in your project:Add build targets to
axbuild.mk
, add features to enable tofeatures.txt
(see this example):Build your application with RuxOS, by running the
make
command in the application directory:How to build RuxOS for specific platforms and devices
Set the
PLATFORM
variable when runmake
:You may also need to select the corrsponding device drivers by setting the
FEATURES
variable:RuxGo
A convient tool to run RuxOS applications by concise command. See RuxGo-Book for more information.
Design