# rCore-user [![Build Status](https://travis-ci.org/rcore-os/rcore-user.svg?branch=master)](https://travis-ci.org/rcore-os/rcore-user) * [rCore-user](#rcore-user) * [Build](#build) * [Support matrix](#support-matrix) * [How to run real world programs](#how-to-run-real-world-programs) * [How to use Redis](#how-to-use-redis) * [How to use nginx](#how-to-use-nginx) * [How to use gcc](#how-to-use-gcc) User programs for [rCore OS](https://github.com/rcore-os/rCore). Now it has 4 parts: * `ucore`: C-lang, from the original [ucore_os_lab](https://github.com/chyyuu/ucore_os_plus) * `biscuit`: C/C++, from [Biscuit](https://github.com/mit-pdos/biscuit), based on a `musl` instead of original `litc`. * `rust`: Simple no_std Rust programs. * `nginx`, `redis`, `busybox`, `alpine`, `gcc`: Real world applications. ## Build To build biscuit programs, install musl toolchain first: ```bash # 1. to download prebuilt binaries in Linux, visit [musl.cc](https://musl.cc) # 2. to build musl toolchains from source: # 2.1 for macOS musl toolchain for x86_64(,aarch64) $ brew install FileSottile/musl-cross/musl-cross {--with-aarch64} # 2.2 for ubuntu 16.04, we should build gcc-musl for newest musl-1.1.21, please see build-gcc-musl.md for instructions # 2.3 for riscv musl toolchain, please install [musl-riscv-toolchain](https://github.com/jiegec/musl-riscv-toolchain), however, this one might not be able to build redis on rv64 for lack of libatomic ``` Then, build userspace programs for rCore: ```bash $ make {ucore,biscuit,rust,nginx,redis,all} arch={x86_64,aarch64,riscv32,riscv64,mipsel} $ make alpine arch={x86_64,aarch64} # if you want to use alpine rootfs $ make test arch={x86_64} # test alpine real apps, e.g. python, gcc, rust, go, lua, etc.(need rootfs with these real apps) $ make sfsimg arch={x86_64,aarch64,riscv32,riscv64,mipsel} ``` A rootfs is created at `build/$(arch)` and converted to `qcow2`. ## Support matrix | | x86_64 | aarch64 | riscv32 | riscv64 | mipsel | | ------------------ | ------ | ------- | ------- | ------- | ------ | | ucore | ✅ | ✅ | ✅ | ✅ | ❗ | | rust | ✅ | ✅ | ✅ | ✅ | ✅ | | biscuit | ✅ | ✅ | ✅ | ✅ | ✅ | | nginx (linux only) | ✅ | ✅ | ❗ | ✅ | ❗ | | redis (linux only) | ✅ | ✅ | ✅ | ✅ | ✅ | | busybox | ✅ | ✅ | ✅ | ✅ | ✅ | | alpine rootfs | ✅ | ✅ | ❌ | ❌ | ❌ | | iperf3 | ✅ | ❌ | ❌ | ❌ | ❌ | | test | ✅ | ❌ | ❌ | ❌ | ❌ | Note: ❗ means workarounds are used so that they may not work properly. ❌ means failure in compiling or not existed on such platform. ## How to run real world programs ### How to use Redis If redis is dynamically linked to musl (default if you use commands above), you might need to copy `ld-musl-$(arch).so.1` to rootfs `/lib` by yourself .Alpine rootfs includes one as well. After building redis, you should be able to run redis-server in rCore. Then, start `redis-server` in rCore: ```bash /> redis-server redis.conf ``` Then you should be able to connect to it using `redis-cli` over the network: ```bash $ redis-cli -h 10.0.0.2 get abc (nil) $ redis-cli -h 10.0.0.2 set abc def OK $ redis-cli -h 10.0.0.2 get abc "def" ``` Note: `redis-cli` in rCore is not working at the time. ### How to use nginx Nginx is statically linked to musl instead, so there is no need to copy its dynamic loader. A nginx.conf is provided in this repo and automatically copied to its destination. So, just start `nginx` directly: ```bash /> nginx ``` Then you should be able to visit it via network: ```bash $ curl http://10.0.0.2/
../ bin/ 01-Jan-1970 00:00 - biscuit/ 01-Jan-1970 00:00 - dev/ 01-Jan-1970 00:00 - etc/ 01-Jan-1970 00:00 - home/ 01-Jan-1970 00:00 - lib/ 01-Jan-1970 00:00 - media/ 01-Jan-1970 00:00 - mnt/ 01-Jan-1970 00:00 - opt/ 01-Jan-1970 00:00 - proc/ 01-Jan-1970 00:00 - root/ 01-Jan-1970 00:00 - run/ 01-Jan-1970 00:00 - rust/ 01-Jan-1970 00:00 - sbin/ 01-Jan-1970 00:00 - srv/ 01-Jan-1970 00:00 - sys/ 01-Jan-1970 00:00 - tmp/ 01-Jan-1970 00:00 - usr/ 01-Jan-1970 00:00 - var/ 01-Jan-1970 00:00 - busybox 01-Jan-1970 00:00 1141024 nginx 01-Jan-1970 00:00 741288 nginx-remote 01-Jan-1970 00:00 762440 nginx.conf 01-Jan-1970 00:00 99 redis-cli 01-Jan-1970 00:00 221256 redis-server 01-Jan-1970 00:00 1120888 redis.conf 01-Jan-1970 00:00 18