Skip to content

Commit 6040661

Browse files
authored
Merge pull request #4 from BernardXiong/fix_xmake
Fix xmake
2 parents b34fe81 + 379c530 commit 6040661

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### RT-Thread-Smart
88

9-
RT-Thread Smart(以下简称 Smart) 是基于 RT-Thread 操作系统上的混合操作系统,简称为 rt-smart,它把应用从内核中独立出来,形成独立的用户态应用程序,并具备独立的地址空间(32 位系统上是 4G 的独立地址空间)。详细信息请见 [RT-Thread 文档中心](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-smart/introduction/rt-smart-intro/rt-smart-intro)
9+
RT-Thread Smart(以下简称 Smart) 是基于 RT-Thread 操作系统上的混合操作系统,简称为 rt-smart,它把应用从内核中独立出来,形成独立的用户态应用程序(进程模型),并具备独立的地址空间(32 位系统上是 4G 的独立地址空间)。详细信息请见 [RT-Thread 文档中心](https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-smart/introduction/rt-smart-intro/rt-smart-intro)
1010

1111
### Xmake
1212

@@ -28,12 +28,12 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
2828
sudo add-apt-repository ppa:xmake-io/xmake
2929
sudo apt update
3030
sudo apt install xmake
31-
pip install kconfiglib
31+
pip install kconfiglib scons requests tqdm psutil
3232
```
3333

3434
2. **克隆仓库**
3535

36-
Smart 的 userapps 仓库克隆下来, 假定我们的工作路径是 `$WS`
36+
smart-build 仓库克隆下来, 假定我们的工作路径是 `$WS`
3737

3838
```shell
3939
cd $WS
@@ -44,10 +44,10 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
4444

4545
文件系统由多个应用程序组成,这些应用程序都放在 `apps` 目录下。由于 smart 采用 xmake 编译用户态环境,因此 smart 的编译方式非常简单。
4646

47-
首先进入 userapps 并运行 `env.sh` 添加一下环境变量。
47+
首先进入 smart-build 并运行 `env.sh` 添加一下环境变量(注意:`source env.sh``source ./env.sh`是有区别的)
4848

4949
```shell
50-
cd $WS/userapps
50+
cd $WS/smart-build
5151
source ./env.sh
5252
```
5353

@@ -67,15 +67,15 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
6767

6868
4. **制作镜像文件**
6969

70-
运行 `xmake` 制作image镜像,所谓制作文件系统,就是将上一步编译生成的用户程序按照文件系统的布局拷贝到 `$WS/userapps/models/build/rootfs` 路径下,并根据提前写好的on_run.lua脚本打包生成特定格式的 image 文件。
70+
运行 `xmake` 制作image镜像,所谓制作文件系统,就是将上一步编译生成的用户程序按照文件系统的布局拷贝到 `$WS/smart-build/models/build/rootfs` 路径下,并根据提前写好的on_run.lua脚本打包生成特定格式的 image 文件。
7171

7272
```shell
7373
xmake
7474
```
7575

7676
目前支持的镜像格式包括 ext4/fat/cromfs。
7777

78-
这里的例子会在 `$WS/userapps/models/build` 路径下生成 `ext4.img` 文件。
78+
这里的例子会在 `$WS/smart-build/models/build` 路径下生成 `ext4.img` 文件。
7979

8080
![image-20241211512457899.png](./assets/image-20241211512457899.png)
8181

env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
export XMAKE_RCFILES=${script_dir}/tools/scripts/xmake.lua
66
export RT_XMAKE_LINK_TYPE="static"
77

8-
98
# Check whether unzip is installed.
109
if ! command -v unzip &> /dev/null; then
1110
echo "Unzip is not installed. Installing unzip"
@@ -26,6 +25,7 @@ if ! command -v unzip &> /dev/null; then
2625
fi
2726

2827
echo "Unzip has been successfully installed."
28+
echo "smart-build env ready!"
2929
else
30-
echo "Unzip is installed."
30+
echo "smart-build env ready!"
3131
fi

models/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# TARGET_FILE置空,不再生成rtconfig.h文件
2+
config TARGET_FILE
3+
string
4+
default ""
5+
16
mainmenu "Chip and Board Configuration"
27

38
#

models/xmake.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ add_requires("xmake::rt-thread", {optional = true})
2929
target("image")
3030
set_kind("phony")
3131

32+
if os.isdir("~/.env/tools/scripts") then
33+
local current_path = os.getenv("PATH")
34+
current_path = "~/.env/tools/scripts" .. ":" .. current_path
35+
add_runenvs("PATH", current_path)
36+
end
37+
3238
add_packages("apps")
3339
add_packages("rt-thread")
3440

repo/packages/r/rt-thread/bsp/qemu_virt64_aarch64.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function build(toolchainsdir)
3838
-- print("===============",config_dir,"===============")
3939
-- os.cp(config_dir,build)
4040
os.cd(build)
41-
os.exec("scons --pyconfig-silent")
41+
os.exec("scons --menuconfig")
42+
os.exec("pkgs --update")
4243
os.exec("scons")
4344
-- exit()
4445
os.execv("cp", {build .. "/rtthread.bin", build_dir})

0 commit comments

Comments
 (0)