Skip to content

Commit 1af8438

Browse files
authored
Merge pull request #40 from xqyjlj/tools-dev
update tools
2 parents df57a50 + 24622fd commit 1af8438

7 files changed

Lines changed: 47 additions & 18 deletions

File tree

.gitattributes

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
*.xmind binary
1212
*.bmp binary
1313
*.exe binary
14-
fatdisk-x86 binary
15-
udb binary
1614
*.lzma binary
1715
*.zip binary
1816
*.Z binary
@@ -21,11 +19,15 @@ udb binary
2119
*.mo binary
2220
*.pb binary
2321
*.tga binary
24-
xfel binary
25-
make_ext4fs* binary
2622
*.deb binary
2723
*.bin binary
2824
*.img binary
2925

26+
cromfs-tool-* binary
27+
xfel binary
28+
make_ext4fs-* binary
29+
fatdisk-* binary
30+
udb binary
31+
3032
# These should also not be modified by git.
3133
*.svg -text

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
4040

4141
3. **安装 qemu**
4242

43-
userapps 已提供 qemu 7.1.0 的安装包,位于目录 tools/qemu/qemu_7.1.0-2022111713_amd64.deb
43+
userapps 已提供 qemu 7.1.0 的安装包,请自行下载 https://download_redirect.rt-thread.org/download/rt-smart/native/tools/qemu/qemu_7.1.0-2022111713_amd64.deb
4444

4545
```shell
4646
sudo apt-get install -y libglib2.0-dev libpixman-1-dev
47-
sudo dpkg -i ./qemu_7.1.0-2022111713_amd64.deb
47+
curl -L https://download_redirect.rt-thread.org/download/rt-smart/native/tools/qemu/qemu_7.1.0-2022111713_amd64.deb -o ./qemu.deb
48+
sudo dpkg -i ./qemu.deb
4849
```
4950

5051
如若想安装最新版本,请自行下载 qemu 源码进行编译安装
@@ -93,11 +94,11 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
9394

9495
在 qemu 中 输入 `ctrl+a` 抬起后,再输入 `x` 即可退出 qemu
9596

96-
## prebuilt的版本
97+
## prebuilt 的版本
9798

98-
会在每天凌晨生成aarch64/riscv64 for qemu的prebuilt版本,包括内核和rootfs文件系统
99+
会在每天凌晨生成 aarch64/riscv64 for qemu 的 prebuilt 版本,包括内核和 rootfs 文件系统
99100

100-
* [aarch64](http://117.143.63.254:9012/www/rt-smart/prebuilt/qemu-virt64-aarch64_latest.tar.gz)
101-
* [riscv64](http://117.143.63.254:9012/www/rt-smart/prebuilt/qemu-virt64-riscv_latest.tar.gz)
101+
- [aarch64](http://117.143.63.254:9012/www/rt-smart/prebuilt/qemu-virt64-aarch64_latest.tar.gz)
102+
- [riscv64](http://117.143.63.254:9012/www/rt-smart/prebuilt/qemu-virt64-riscv_latest.tar.gz)
102103

103-
可以使用qemu来运行起来
104+
可以使用 qemu 来运行起来

tools/cromfs/cromfs-tool-x86

721 KB
Binary file not shown.

tools/cromfs/cromfs-tool.exe

77 KB
Binary file not shown.
-22.8 MB
Binary file not shown.

tools/scripts/tasks.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ do
3232
options = {
3333
{"f", "format", "kv", "ext4", "image format",
3434
" - ext4",
35-
" - fat"},
35+
" - fat",
36+
" - cromfs"},
3637
{"s", "size", "kv", "256M", "image size"},
3738
{"o", "output", "kv", nil, "output image dir"},
3839
{"r", "rootfs", "kv", nil, "rootfs dir"},

tools/scripts/tasks/smart-image/on_run.lua

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
--
1313
-- Copyright (C) 2023-2023 RT-Thread Development Team
1414
--
15-
-- @author xqyjlj
15+
-- @author xqyjlj
1616
-- @file on_run.lua
1717
--
1818
-- Change Logs:
@@ -50,17 +50,40 @@ function make_fat(size, output, rootfs)
5050
local fatdisk_exec
5151
local fatdisk_dir = path.absolute("../../../fatdisk", os.scriptdir())
5252

53-
if not os.host() == "linux" then
53+
if os.host() == "windows" then
54+
fatdisk_exec = path.join(fatdisk_dir, "fatdisk.exe")
55+
elseif os.host() == "linux" then
56+
if os.is_arch("x86_64", "x86", "x64") then
57+
fatdisk_exec = path.join(fatdisk_dir, "fatdisk-x86")
58+
else
59+
os.raise("not support arch '%s'", os.arch())
60+
end
61+
else
5462
os.raise("not support host '%s'", os.host())
5563
end
5664

57-
if os.arch() == "x86_64" then
58-
fatdisk_exec = path.join(fatdisk_dir, "fatdisk-x86")
65+
os.vrunv(fatdisk_exec, {"--disk_size=" .. size, "--output=" .. output, "--input=" .. rootfs})
66+
end
67+
68+
function make_cromfs(output, rootfs)
69+
local target
70+
local rootfs_dir
71+
local cromfs_exec
72+
local cromfs_dir = path.absolute("../../../cromfs", os.scriptdir())
73+
74+
if os.host() == "windows" then
75+
cromfs_exec = path.join(cromfs_dir, "cromfs-tool.exe")
76+
elseif os.host() == "linux" then
77+
if os.is_arch("x86_64", "x86", "x64") then
78+
cromfs_exec = path.join(cromfs_dir, "cromfs-tool-x86")
79+
else
80+
os.raise("not support arch '%s'", os.arch())
81+
end
5982
else
60-
os.raise("not support arch '%s'", os.arch())
83+
os.raise("not support host '%s'", os.host())
6184
end
6285

63-
os.vrunv(fatdisk_exec, {"--disk_size=" .. size, "--output=" .. output, "--input=" .. rootfs})
86+
os.vrunv(cromfs_exec, {rootfs, output})
6487
end
6588

6689
function main()
@@ -93,6 +116,8 @@ function main()
93116
make_ext4(size, output, rootfs)
94117
elseif format == "fat" then
95118
make_fat(size, output, rootfs)
119+
elseif format == "cromfs" then
120+
make_cromfs(output, rootfs)
96121
else
97122
os.raise("unsupport format '%s'", format)
98123
end

0 commit comments

Comments
 (0)