From 9edffaa1a7079c81a006882e9b52e67e4b3cf4ff Mon Sep 17 00:00:00 2001 From: BeichenY1 Date: Wed, 17 Apr 2024 15:26:22 +0800 Subject: [PATCH] Update README.md and add the loader_app template --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 44 +++++----------------- apps/loader_app/README.md | 15 ++++++++ apps/loader_app/config_linux.toml | 22 +++++++++++ doc/ruxgo_book/src/guide/builder_module.md | 3 +- doc/ruxgo_book/src/installation.md | 2 +- doc/ruxgo_book/src/introduction.md | 4 +- doc/ruxgo_book/src/run_apps.md | 9 +++-- 9 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 apps/loader_app/README.md create mode 100644 apps/loader_app/config_linux.toml diff --git a/Cargo.lock b/Cargo.lock index 048adb8..0bb3538 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1007,7 +1007,7 @@ dependencies = [ [[package]] name = "ruxgo" -version = "0.9.4" +version = "0.9.5" dependencies = [ "bytes", "clap", diff --git a/Cargo.toml b/Cargo.toml index 3617ff2..961eaac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ruxgo" -version = "0.9.4" +version = "0.9.5" edition = "2021" authors = ["Zewei Yang "] description = "A Cargo-like build tool for building C and C++ applications" diff --git a/README.md b/README.md index 7c17e89..94abdcc 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,37 @@ # Ruxgo -Ruxgo is a Cargo-like build tool for building C and C++ applications that relies solely on a Toml file. +Ruxgo is a Cargo-like build tool for building C/C++ applications that relies solely on a Toml file. -**To start using Ruxgo**, learn more at [The Ruxgo Book](https://ruxgo.syswonder.org/). +It is also a companion command-line tool for RuxOS and has the explicit aim of making it easy to build and manage your C/C++ applications. -🚧 Working In Progress. +**To start using Ruxgo**, learn more at [The Ruxgo Book](https://ruxgo.syswonder.org/). ## Installation -To build the `ruxgo` executable from source, you will first need to install Rust and Cargo. Follow the instructions on the [Rust installation page](https://www.rust-lang.org/tools/install). Ruxgo currently requires at least Rust version 1.74. - -Once you have installed Rust, the following command can be used to build and install Ruxgo: +Ruxgo currently requires at least Rust version 1.75. You can install it with Cargo: ```sh cargo install ruxgo ``` -The version published to [crates.io](https://crates.io/) will ever so slightly be behind the version hosted on GitHub. If you need the latest version you can build the git version of ruxgo yourself. - -```sh -cargo install --git https://github.com/syswonder/ruxgo.git ruxgo -``` - ## Usage -Write a `config_linux.toml` for linux and `config_win32.toml` for windows in the project directory. - -You can then build the project with: -```console -ruxgo -b -``` - -Once built, you can execute the project via: -```console -ruxgo -r -``` - -For help: -```console -ruxgo --help -``` - -You can also configure the log level with the environment variable `"RUXGO_LOG_LEVEL"`, the default log level is "Info". +Ruxgo supports building self-developed applications to run on linux or windows platforms, and also supports assembling and building Unikernel-based RuxOS and running applications on it. You just need to Write a `config_linux.toml` for linux or `config_win32.toml` for windows in the project directory. -## Ruxgo-apps +The `ruxgo/apps/` directory places all the Toml files that have been tested, you can switch to either directory and follow the instructions to build the application. -The `ruxgo/apps/` directory places all the Toml files that have been tested, you can switch to either directory and follow the instructions to build the application. Currently, there are two ways to build an app: +- If you are developing your own application and want to build and run it, you can refer to the template to write a Toml file, then put it in your project directory, and use ruxgo to build and run it. -- If building locally, you'll need to download the apps source code and then use ruxgo to build and run it. +- If you want to build an already supported app on ruxos, you need to copy `config_.toml` from `ruxgo/apps//ruxos` into `ruxos/apps/c/`, then refer to the instructions and use ruxgo to build and run it. -- If you want to build on ruxos, you need to copy `config_.toml` from `ruxgo/apps//ruxos` into `ruxos/apps/c/`, then download the apps source code and use ruxgo to build and run it. +- If you have your own app executable and want to run it on RuxOS, you can refer to the template under `ruxgo/apps/loader_app` and configure your own, then use ruxgo to build and run it. **Note:** Refer to the README.md in each app directory for details. The following applications are already supported: * [x] [redis](apps/redis) * [x] [sqlite3](apps/sqlite3) * [x] [iperf](apps/iperf) +* [x] [loader_app](apps/loader_app) * [x] helloworld * [x] memtest * [x] httpclient diff --git a/apps/loader_app/README.md b/apps/loader_app/README.md new file mode 100644 index 0000000..fe9a0c5 --- /dev/null +++ b/apps/loader_app/README.md @@ -0,0 +1,15 @@ +# Load your app executable to run on RuxOS + +Inside this is a configuration template for loading your app executable, you just need to fill in your app path in the app field in [build]. + +To load and run your app executable, you first need to create your app directory under **`ruxos/apps/c/`**, then put your custom toml files into it, and then build and run with the following commands: + +```bash +# Build and Run +ruxgo -b +ruxgo -r +``` + +**Note**: + +The app executable needs to be compiled by musl. \ No newline at end of file diff --git a/apps/loader_app/config_linux.toml b/apps/loader_app/config_linux.toml new file mode 100644 index 0000000..4774574 --- /dev/null +++ b/apps/loader_app/config_linux.toml @@ -0,0 +1,22 @@ +[build] +compiler = "gcc" +# fill in your app path +app = "/your_app_path" + +[os] +name = "ruxos" +services = ["alloc","fp_simd","irq","multitask","fs","net","pipe","epoll","poll","rtc","virtio-9p"] +ulib = "ruxmusl" + +[os.platform] +name = "aarch64-qemu-virt" +smp = "1" +log = "info" + +[os.platform.qemu] +memory = "256M" +net = "y" +v9p = "y" +v9p_path = "./rootfs" +# your app parameter config +args = "" diff --git a/doc/ruxgo_book/src/guide/builder_module.md b/doc/ruxgo_book/src/guide/builder_module.md index b97aadb..e8c6834 100644 --- a/doc/ruxgo_book/src/guide/builder_module.md +++ b/doc/ruxgo_book/src/guide/builder_module.md @@ -2,4 +2,5 @@ **[build]** 模块描述了编译器的类型。它包含 `compiler`。 -- `compiler`: 指定编译器类型,例如: "gcc"。 \ No newline at end of file +- `compiler`: 指定编译器类型,例如: "gcc"。 +- `app`: 指定 app 可执行文件的路径。 \ No newline at end of file diff --git a/doc/ruxgo_book/src/installation.md b/doc/ruxgo_book/src/installation.md index 855d2c6..92f4317 100644 --- a/doc/ruxgo_book/src/installation.md +++ b/doc/ruxgo_book/src/installation.md @@ -1,6 +1,6 @@ # Ruxgo 安装 -要安装`ruxgo`可执行文件,您首先需要安装 Rust 和 Cargo。按照[Rust安装页面](https://www.rust-lang.org/tools/install)上的说明操作。Ruxgo 目前至少需要 Rust 1.74 版本。 +要安装`ruxgo`可执行文件,您首先需要安装 Rust 和 Cargo。按照[Rust安装页面](https://www.rust-lang.org/tools/install)上的说明操作。Ruxgo 目前至少需要 Rust 1.75 版本。 一旦您安装了 Rust,就可以使用以下命令来构建和安装 Ruxgo: diff --git a/doc/ruxgo_book/src/introduction.md b/doc/ruxgo_book/src/introduction.md index 5f17759..6d4a717 100644 --- a/doc/ruxgo_book/src/introduction.md +++ b/doc/ruxgo_book/src/introduction.md @@ -1,3 +1,5 @@ # 简介 -[Ruxgo](https://github.com/syswonder/ruxgo) 是一个类似 Cargo 的构建工具,用于构建 C 和 C++ 应用程序。与传统的 Make 构建工具不同,Ruxgo 的构建过程仅依赖一个 Toml 文件,其摒弃了繁杂的语法和规则限制,使得编译过程回归到更为简洁的状态。如果你对 Makefile 感到疲倦,Ruxgo 绝对值得你尝试,它能让你的构建过程变得更加轻松和高效。 \ No newline at end of file +[Ruxgo](https://github.com/syswonder/ruxgo) 是一个类似 Cargo 的构建工具, 专用于构建 C/C++ 应用程序, 它只依赖于一个 Toml 文件。 + +它也是 [RuxOS](https://github.com/syswonder/ruxos) 的一个配套命令行工具, 其目标是简化 RuxOS 及其上 C/C++ 应用程序的组装构建和管理。 \ No newline at end of file diff --git a/doc/ruxgo_book/src/run_apps.md b/doc/ruxgo_book/src/run_apps.md index 5b0fad4..5e5afe9 100644 --- a/doc/ruxgo_book/src/run_apps.md +++ b/doc/ruxgo_book/src/run_apps.md @@ -1,16 +1,19 @@ # 运行不同的app -在`ruxgo/apps/`目录下放置了所有经过测试的 Toml 文件。目前,有两种方法构建应用程序: +在`ruxgo/apps/`目录下放置了所有经过测试的 Toml 文件。 -- 如果在本地构建,你只需要在`ruxgo/apps//local`目录下下载 app 的源代码,然后使用 ruxgo 构建并运行它。 +- 如果你正在开发自己的应用程序并希望构建和运行它,你可以参考模板写一个 Toml 文件,然后把它放在你的项目目录下,即可使用 ruxgo 来构建和运行它。 -- 如果在 RuxOS 上构建,你需要将`config_linux.toml`从`ruxgo/apps//ruxos`复制到`ruxos/apps/c/`,然后下载 app 的源代码并使用 ruxgo 来构建并运行它。 +- 如果你想在 RuxOS 上构建一个已经支持的应用程序,你需要将`config_linux.toml`从`ruxgo/apps//ruxos`复制到`ruxos/apps/c/`,然后参考说明使用 ruxgo 构建并运行它。 + +- 如果你有自己的应用程序可执行文件,并希望在 RuxOS 上运行它,你可以参考`ruxgo/apps/loader_app`下的模板并配置你自己的 Toml 文件,然后使用 ruxgo 来构建和运行它。 **注:** 有关详细信息,请参阅每个 app 目录下的 README.md。以下应用程序已获支持: * [x] [redis](https://github.com/syswonder/ruxgo/tree/master/apps/redis) * [x] [sqlite3](https://github.com/syswonder/ruxgo/tree/master/apps/sqlite3) * [x] [iperf](https://github.com/syswonder/ruxgo/tree/master/apps/iperf) +* [x] [loader_app](https://github.com/syswonder/ruxgo/tree/master/apps/loader_app) * [x] helloworld * [x] memtest * [x] httpclient