说明
整理流程很像 linux, 先 load 内核,再加载 rootfs
配置
以 qemu-virt64-aarch64 为例
用户态
工具链需要通过编译用户态程序才能导出,有点奇怪
1 | git clone --depth 1 https://github.com/RT-Thread/userapps.git |
下载工具链
1 | xmake config --arch=aarch64 -y |
导出 toolchain 需要先编译
每次修改完应用程序,都需要 xmake 一下
1 | xmake |
toolchain 在 apps/build/packages 下
sdk 在apps/build/sdk 下
1 | xmake smart-rootfs --export=all |
生成 rootfs,执行以后,在 apps/build/ 下
如果需要把 zig 编译的程序放进去,可以放在这个里面, 实际测试,运行会崩溃
1 | xmake smart-rootfs |
生成磁盘镜像
1 | xmake smart-image -f ext4 |
内核
toolchain 在 userapps/apps/build/packages 里面,复制出来
1 | export RTT_CC="gcc" |
编译内核
1 | git clone --depth 1 https://github.com/RT-Thread/rt-thread |
1 | RT-Thread Kernel ---> |
1 | source ~/.env/env.sh |
运行
1 | cp ext4.img ../../../rt-thread/bsp/qemu-virt64-aarch64/ |
修改 qemu.sh 里面的 sd.bin 为 ext4.img
参考这里最后生成 prebuilt 的部分里面的 run.sh