@@ -16,17 +16,9 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
1616
1717> 此次以 qemu-virt64-aarch64 为例讲解
1818
19- 1 . ** 克隆仓库 **
19+ 1 . ** 安装 xmake **
2020
21- 将 Smart 的 userapps 仓库克隆下来:
22-
23- ``` shell
24- git clone https://github.com/RT-Thread/userapps.git
25- ```
26-
27- 2 . ** 安装 xmake**
28-
29- 请根据[ xmake 官方文档] ( https://xmake.io/#/zh-cn/guide/installation?id=ubuntu ) 进行安装
21+ 请根据 [ xmake 官方文档] ( https://xmake.io/#/zh-cn/guide/installation?id=ubuntu ) 进行安装。
3022
3123 以下为 ubuntu 安装方式
3224
@@ -36,37 +28,59 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
3628 sudo apt install xmake
3729 ```
3830
39- 3 . ** 编译**
31+ 2 . ** 克隆仓库**
32+
33+ 将 Smart 的 userapps 仓库克隆下来, 假定我们的工作路径是 ` $WS ` :
34+
35+ ``` shell
36+ cd $WS
37+ git clone https://github.com/RT-Thread/userapps.git
38+ ```
39+
40+ 3 . ** 编译用户态应用程序**
4041
41- 由于 smart 采用 xmake 编译用户态环境,因此 smart 的编译方式非常简单。
42+ 文件系统由多个应用程序组成,这些应用程序都放在 ` apps ` 目录下。 由于 smart 采用 xmake 编译用户态环境,因此 smart 的编译方式非常简单。
4243
43- 首先运行 env.sh 添加一下环境变量
44+ 首先进入 userapps 并运行 ` env.sh ` 添加一下环境变量。
4445
4546 ``` shell
46- source env.sh
47+ cd $WS /userapps
48+ source ./env.sh
4749 ```
4850
4951 进入 apps 目录进行编译
5052
5153 ``` shell
5254 cd apps
53- xmake f -a aarch64 # 配置为 aarch64平台
54- xmake -j8
55+ xmake f -a aarch64 # 配置为 aarch64平台,如果不执行该条指令进行配置,则默认为 aarch64
56+ xmake -j $( nproc )
5557 ```
5658
59+ 目前支持的平台:arm、aarch64、riscv64gc。
60+
5761 ![ image-20230531173059551] ( ./assets/image-20230531173059551.png )
5862
59- 支持的平台:arm、aarch64、riscv64gc。
6063
61- 5 . ** 镜像制作 **
64+ 4 . ** 制作文件系统 **
6265
63- 运行 ` xmake smart-rootfs ` 制作 rootfs ,运行 ` xmake smart-image ` 制作镜像
66+ 运行 ` xmake smart-rootfs ` 制作 rootfs,所谓制作文件系统,就是将上一步编译生成的用户程序按照文件系统的布局拷贝到 ` $WS/userapps/apps/build/rootfs ` 路径下。
6467
6568 ``` shell
6669 xmake smart-rootfs
70+ ```
71+
72+ 5 . ** 制作镜像**
73+
74+ 运行 ` xmake smart-image ` 制作镜像,将上一步制作的 ` $WS/userapps/apps/build/rootfs ` 目录下的文件系统打包生成特定格式的 image 文件。
75+
76+ ``` shell
6777 xmake smart-image -f ext4 # 制作 ext4 镜像
6878 ```
6979
80+ 目前支持的镜像格式包括 ext4/fat/cromfs。
81+
82+ 这里的例子会在 ` $WS/userapps/apps/build ` 路径下生成 ` ext4.img ` 文件。
83+
7084 ![ image-20230531173829621] ( ./assets/image-20230531173829621.png )
7185
7286## prebuilt 的版本
0 commit comments