Skip to content

Commit

Permalink
add en support
Browse files Browse the repository at this point in the history
  • Loading branch information
coolyjg committed Dec 27, 2023
1 parent 1b00cec commit 0beda4f
Show file tree
Hide file tree
Showing 24 changed files with 646 additions and 4 deletions.
3 changes: 3 additions & 0 deletions translations/en/Contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Contributors

21 changes: 21 additions & 0 deletions translations/en/Introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Welcome to RuxOS!

This project is the manual for RuxOS, targeting both application developers and kernel developers. It covers the following aspects:

* Overview of RuxOS

* Running applications on RuxOS

* Overall design of RuxOS

The RuxOS manual is still a work in progress.

# What is RuxOS?

RuxOS is a lightweight library operating system compatible with Linux applications. It primarily follows the design principles of [unikernels](https://en.wikipedia.org/wiki/Unikernel) and is maintained by the [syswonder Community](https://www.syswonder.org/#/).

Given the prevalent edge computing scenarios where the number of applications is often limited and relatively fixed, RuxOS simplifies the operating system design to support a single application. It encapsulates kernel functionality as a library, providing it to applications in the form of system calls, allowing applications to run directly in kernel mode.

This library-based operating system enhances application performance significantly. Security concerns are mainly addressed by the underlying Type 1 hypervisor ([hvisor](https://github.com/syswonder/hvisor)). Library-based operating systems require robust tool support to facilitate the generation of runnable binary images based on a single application, such as [unikraft](https://unikraft.org/).

RuxOS is still in the development stage and has already achieved support for several mainstream applications.
57 changes: 55 additions & 2 deletions translations/en/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
# RuxOS Book structure
# RuxOS Book Structure

[Introduction](./Introduction.md)

# About RuxOS

- [RuxOS overview](./chap01/Overview.md)
- [RuxOS Overview](./chap01/Overview.md)

# RuxOS User Manual

- [Running Existing Applications](./chap02/arguments.md)

- [Compilation Arguments Explanation](./chap02/arguments.md)

- [Existing Applications](./chap02/apps/root.md)

- [Hello World!](./chap02/apps/helloworld.md)

- [Iperf3](./chap02/apps/iperf.md)

- [Sqlite](./chap02/apps/sqlite.md)

- [Redis](./chap02/apps/redis.md)

- [Nginx](./chap02/apps/nginx.md)

- [Customizing Applications](./chap03/your_app.md)

- [Building with ruxgo](./chap04/ruxgo.md)

- [Multiplatform Support](./chap05/multiplatforms.md)

- [Raspi4](./chap05/Raspi4.md)

# Overall Architecture

- [Design Overview](./chap06/design_overview.md)

- [Low-Level Libraries](./chap06/crates/crates.md)

- [Modules](./chap06/modules/modules.md)

- [9pfs](./chap06/modules/9pfs.md)

- [User Libraries](./chap07/ulib/ulib.md)

- [ruxos-posix-api](./chap07/ulib/ruxos-posix-api.md)

- [ruxlibc](./chap07/ulib/ruxlibc.md)

- [ruxmusl](./chap07/ulib/ruxmusl.md)

# Future Work

- [TODO]()

---
[Contributors](./Contributors.md)
4 changes: 2 additions & 2 deletions translations/en/chap01/Overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# RuxOS Overview
# Overview of RuxOS

In this Chapter, RuxOS book will give you a brief introduction about RuxOS.
This chapter provides a brief introduction to RuxOS.
47 changes: 47 additions & 0 deletions translations/en/chap02/apps/helloworld.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Hello World!

RuxOS, with the assistance of the make tool, provides users with a comprehensive and convenient way to run applications.

For example, consider the simplest hello world application with the following source code in C:

```C
#include <stdio.h>

int main()
{
printf("Hello, %c app!\n", 'C');
return 0;
}
```

To run the application, use the following command:

```shell
make A=apps/c/helloworld run
```

Parameter explanation:

* `A`: This parameter points to the directory of the application to be executed.

By running the above command, a simple C application is successfully launched. An example of the possible output is as follows:

```
8888888b. .d88888b. .d8888b.
888 Y88b d88P" "Y88b d88P Y88b
888 888 888 888 Y88b.
888 d88P 888 888 888 888 888 888 "Y888b.
8888888P" 888 888 `Y8bd8P' 888 888 "Y88b.
888 T88b 888 888 X88K 888 888 "888
888 T88b Y88b 888 .d8""8b. Y88b. .d88P Y88b d88P
888 T88b "Y88888 888 888 "Y88888P" "Y8888P"
arch = x86_64
platform = x86_64-qemu-q35
target = x86_64-unknown-none
smp = 1
build_mode = release
log_level = error
Hello, C app!
```
57 changes: 57 additions & 0 deletions translations/en/chap02/apps/iperf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Iperf3

[iPerf3](https://github.com/esnet/iperf) is a tool used to test real-time bandwidth performance in networks.

## Build and Run

Launch the iPerf3 server on RuxOS using the following command:

```bash
# in ruxos root directory
make A=apps/c/iperf BLK=y NET=y ARCH=<arch> run
```

## Benchmark Testing

Open another terminal and run the iPerf3 client:

* RuxOS-iperf3 as the receiver:

```bash
# TCP
iperf3 -c 127.0.0.1 -p 5555
# UDP
iperf3 -uc 127.0.0.1 -p 5555 -b <sender_bitrate> -l <buffer_len>
```

Users need to set the `<sender_bitrate>` parameter to avoid sending packets too quickly when using UDP.

* RuxOS-iperf3 as the sender:

```bash
# TCP
iperf3 -c 127.0.0.1 -p 5555 -R
# UDP
iperf3 -uc 127.0.0.1 -p 5555 -b 0 -l <buffer_len> -R
```

By default, `<buffer_len>` is 128KB for TCP and 8KB for UDP. Increasing the buffer length may improve performance. Users can change this length by setting the parameter after `-l`.

Note that when using UDP, if `<buffer_len>` exceeds `1472` (total packet length exceeds the maximum transmission unit MTU of the network card), packets need to be fragmented. This requires enabling the `fragmentation` feature of [smoltcp](https://github.com/smoltcp-rs/smoltcp):

```toml
# in ruxos/modules/axnet/Cargo.toml
[dependencies.smoltcp]
git = "https://github.com/rcore-os/smoltcp.git"
rev = "2ade274"
default-features = false
features = [
"alloc", "log", # no std
"medium-ethernet",
"proto-ipv4",
"socket-raw", "socket-icmp", "socket-udp", "socket-tcp", "socket-dns",
# "fragmentation-buffer-size-65536", "proto-ipv4-fragmentation",
# "reassembly-buffer-size-65536", "reassembly-buffer-count-32",
# "assembler-max-segment-count-32",
]
```
1 change: 1 addition & 0 deletions translations/en/chap02/apps/nginx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Nginx
89 changes: 89 additions & 0 deletions translations/en/chap02/apps/redis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Redis

RuxOS supports running the [Redis](https://github.com/redis/redis) server on Qemu.

## Create File System Image

Run the following command in the RuxOS root directory:

```shell
make disk_img
```

This command generates a file system (FATFS) image `disk.img` in the root directory to be passed to Qemu.

## Run Redis-Server

Run the following command to start the Redis server on port 5555:

```shell
make A=apps/c/redis/ LOG=error NET=y BLK=y ARCH=aarch64 SMP=4 ARGS="./redis-server,--bind,0.0.0.0,--port,5555,--save,\"\",--appendonly,no,--protected-mode,no,--ignore-warnings,ARM64-COW-BUG" run
```

Parameter explanation:

* `A`: This parameter points to the directory of the Redis application.

* `LOG`: `LOG` represents the log level, where lower log levels mean more detailed output. Options include: `error`, `warn`, `info`, `debug`, `trace`.

* `NET`: This parameter enables qemu's virtio-net.

* `BLK`: This parameter enables qemu's virtio-blk.

* `ARCH`: `ARCH` indicates the architecture RuxOS is running on, with options including: `x86_64`, `aarch64`, `riscv64`.

* `SMP`: `SMP` enables RuxOS's multi-core feature, followed by the number of cores to be launched.

* `ARGS`: `ARGS` provides the necessary parameters for running redis-server. Here, it specifies running redis-server on 0.0.0.0:5555 in qemu, and not persisting data periodically.

By running the above command, the Redis server starts on port 5555.

## How to Connect and Test

It is recommended to use [Redis tools](https://redis.io/resources/tools/) to connect to the Redis server:

```shell
sudo apt install redis-tools
```

### redis-cli

Run:

```shell
redis-cli -p 5555
```

Then, you can execute all Redis client commands, similar to running on operating systems like Linux.

### redis-benchmark

Use the Redis benchmark tool for testing:

```shell
redis-benchmark -p 5555
```

For more detailed benchmark parameters, refer to [Redis Benchmark](https://redis.io/docs/management/optimization/benchmarks/).

## Use Musl libc

By default, RuxOS's redis-server uses its custom C application ruxlibc.

To leverage the integrated standard musl libc provided by RuxOS, add `MUSL=y` to the run command.

## Use 9pfs

By default, RuxOS passes parameters to the application through the `ARGS` parameter in the command line, which may not be ideal. Now RuxOS has successfully integrated 9pfs for sharing file directories between the host and qemu, enabling the application to pass parameters through its own configuration file.

Run the following command:

```shell
make A=apps/c/redis/ LOG=error NET=y V9P=y BLK=y V9P_PATH=apps/c/redis ARCH=aarch64 SMP=4 ARGS="./redis-server,/v9fs/redis.conf" run
```

Parameter explanation:

* `V9P`: Use `V9P=y` to enable qemu's virtio-9p backend.

* `V9P_PATH`: `V9P_PATH` points to the directory on the host for sharing, containing the Redis configuration file.
1 change: 1 addition & 0 deletions translations/en/chap02/apps/root.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Existing Applications
1 change: 1 addition & 0 deletions translations/en/chap02/apps/sqlite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Sqlite
62 changes: 62 additions & 0 deletions translations/en/chap02/arguments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

# Compilation Parameter Explanation

RuxOS provides a set of compilation parameters that may seem intricate but offer flexibility and clarity for building and running various types of applications.

**General Options:**

| Option | Description |
| --- | --- |
| ARCH | Target architecture: x86_64, riscv64, aarch64. Default is x86_64. |
| PLATFORM | Target platform defined in the `platforms` directory. This parameter can be user-defined or generated based on the `ARCH` parameter, containing platform-specific parameter definitions. |
| SMP | Number of CPU cores. If greater than 1, it enables multi-core features. Default is 1. |
| MODE | Mode related to `cargo build`, default is release. |
| LOG | Log level: warn, error, info, debug, trace. Default is warn. |
| V | Verbose level: (empty), 1, 2 |
| ARGS | Command line arguments, comma-separated, no spaces, can be empty. Used to pass specific parameters to applications, i.e., `argc`, `argv`. |
| ENVS | Environment variable parameters, comma-separated, no spaces, can be empty. |

**Application Options:**

| Option | Description |
| --- | --- |
| A/APP | Path to the application directory. Supports relative and absolute paths. Default points to `apps/c/helloworld.` |
| FEATURES | Features of RuxOS modules. Used to enable additional features desired by the user without needing to appear in the specific application's `features.txt` file. |
| APP_FEATURES | Additional features for Rust applications. |

**Qemu Options:**

| Option | Description |
|---|---|
| BLK | Enable qemu virtio-blk backend. Set if the application requires persistent data or passing configuration files through the file system. |
| NET | Enable qemu virtio-net backend. Set if the application requires network usage. |
| GRAPHIC | Enable qemu virtio-gpu backend for graphical output. |
| BUS | Select device bus type: mmio, pci. |
| DISK_IMG | Path to the file system disk image. Default is `disk.img` in the root directory. |
| ACCEL | Enable x86 KVM hardware acceleration. |
| QEMU_LOG | Enable qemu logs, default output to `qemu.log` file, containing executed assembly code. |
| NET_DUMP | Network packet capture, output to `netdump.pcap` file in the root directory. |
| NET_DEV | Qemu network device type: user, tap. |

**9P Options:**

| Option | Description |
|---|---|
| V9P_PATH | File directory on the host for sharing. Default is the root directory. |
| NET_9P_ADDR| Address and port for 9p netdev. Default is `127.0.0.1:564`. |
| ANAME_9P | Path for 9pfs. |
| PROTOCOL_9P | 9p protocol type. |

**Network Options**, default port is 5555:

| Option | Description |
|---|---|
| IP | RuxOS IPv4 address (qemu user netdev, default is 10.0.2.15). |
| GW | Gateway IPv4 address (qemu user netdev, default is 10.0.2.2). |

**Libc Options:**

| Option | Description |
|---|---|
| MUSL | Use musl libc for compilation and linking. By default, RuxOS uses `ruxlibc`. Users can enable musl libc by setting `MUSL=y`. |

8 changes: 8 additions & 0 deletions translations/en/chap02/getstarted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Running Existing Applications

This chapter will cover:

* Explanation of RuxOS compilation parameters

* How to use RuxOS to run existing applications
3 changes: 3 additions & 0 deletions translations/en/chap03/your_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Custom Applications

This section will cover how to run your custom applications on RuxOS.
7 changes: 7 additions & 0 deletions translations/en/chap04/ruxgo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Building with ruxgo

This section will cover:

* What is ruxgo

* How to use ruxgo to run existing applications on ruxgo
1 change: 1 addition & 0 deletions translations/en/chap05/Raspi4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Raspi4
3 changes: 3 additions & 0 deletions translations/en/chap05/multiplatforms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Multi-Platform Support

This section will cover how to run RuxOS on real hardware, not limited to qemu.
3 changes: 3 additions & 0 deletions translations/en/chap06/crates/crates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Low-Level Libraries

This section will introduce the important crates within RuxOS.
3 changes: 3 additions & 0 deletions translations/en/chap06/design_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Design Overview

This section will introduce design architecture, diagrams, and other related content.
Loading

0 comments on commit 0beda4f

Please sign in to comment.