RT-Thread / userapps

user applications for rt-smart
GNU General Public License v2.0
26 stars 30 forks source link

RT-smart + bsp/qemu-virt64-riscv 无法和 userapps 制作的 rootfs 启动 (TEST 4) #64

Open unicornx opened 5 days ago

unicornx commented 5 days ago

参考 https://github.com/RT-Thread/rt-thread/issues/9623#issuecomment-2472465702 上的 TEST 4. 请问目前 userapps 主线上做出来的 rootfs 和 prebuild 的 rt-smart 是不是不匹配?

构建命令 history,供参考:

cd userapps
source ./env.sh 
cd apps
xmake f -a riscv64gc
xmake -j$(nproc)
xmake smart-rootfs
xmake smart-image -f fat

另外,应用 #60 后依然不行,控制台输出进入死循环:

 \ | /
- RT -     Thread Smart Operating System
 / | \     5.2.0 build Nov 13 2024 10:15:45
 2006 - 2024 Copyright by RT-Thread team
lwIP-2.0.3 initialized!
[I/sal.skt] Socket Abstraction Layer initialize success.
[I/utest] utest is initialize success.
[I/utest] total utest testcase num: (0)
[I/drivers.serial] Using /dev/ttyS0 as default console
file system initialization done!
Hello RISC-V
msh />[E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
[E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
can't run '/etc/init.d/rcS': No such file or directory

Please press Enter to activate this console. [E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
[E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
can't open /dev/vc/4: No such file or directory
[E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
[E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
can't open /dev/vc/3: No such file or directory
[E/sal.skt] not find network interface device by protocol family(1).
[E/sal.skt] SAL socket protocol family input failed, return error -3.
can't open /dev/vc/4: No such file or directory
......
unicornx commented 5 days ago

挂载 fat.img 后发现文件系统做的有问题,缺少 etc。而同样 rootfs 制作的 ext4.img 挂载后确是好的。

u@u:~/ws/duo$ sudo mount ./userapps/apps/build/fat.img ./temp
[sudo] password for u: 
u@u:~/ws/duo$ ls temp
bin  dev  lib  mnt  proc  root  run  sbin  services  tc  usr  var
u@u:~/ws/duo$ ls temp/
bin  dev  lib  mnt  proc  root  run  sbin  services  tc  usr  var
u@u:~/ws/duo$ ls temp -l
total 28
drwxr-xr-x 2 root root 6144  1月  1  1980 bin
drwxr-xr-x 3 root root 2048  1月  1  1980 dev
drwxr-xr-x 2 root root 2048  1月  1  1980 lib
drwxr-xr-x 2 root root 2048  1月  1  1980 mnt
drwxr-xr-x 2 root root 2048  1月  1  1980 proc
drwxr-xr-x 2 root root 2048  1月  1  1980 root
drwxr-xr-x 2 root root 2048  1月  1  1980 run
drwxr-xr-x 2 root root 2048  1月  1  1980 sbin
drwxr-xr-x 2 root root 2048  1月  1  1980 services
drwxr-xr-x 2 root root 2048  1月  1  1980 tc
drwxr-xr-x 3 root root 2048  1月  1  1980 usr
drwxr-xr-x 3 root root 2048  1月  1  1980 var
u@u:~/ws/duo$ sudo umount ./temp 
u@u:~/ws/duo$ sudo mount ./userapps/apps/build/ext4.img ./temp
u@u:~/ws/duo$ ls ./temp -l
total 60
drwxrwxr-x 2 root root 4096 11月 13 17:30 bin
drwxrwxr-x 3 root root 4096 11月 13 17:30 dev
drwxrwxr-x 2 root root 4096 11月 13 17:30 etc
drwxrwxr-x 2 root root 4096 11月 13 17:30 lib
drwx------ 2 root root 4096  1月  1  1970 lost+found
drwxrwxr-x 2 root root 4096 11月 13 17:30 mnt
drwxrwxr-x 2 root root 4096 11月 13 17:30 proc
drwxrwxr-x 2 root root 4096 11月 13 17:30 root
drwxrwxr-x 2 root root 4096 11月 13 17:30 run
drwxrwxr-x 2 root root 4096 11月 13 17:30 sbin
drwxrwxr-x 2 root root 4096 11月 13 17:30 services
drwxrwxr-x 2 root root 4096 11月 13 17:30 tc
drwxrwxr-x 2 root root 4096 11月 13 17:30 tmp
drwxrwxr-x 4 root root 4096 11月 13 17:30 usr
drwxrwxr-x 2 root root 4096 11月 13 17:30 var
unicornx commented 5 days ago

目前定位是默认 image 空间不够导致文件 cp 失败

xmake smart-image -f fat -s 500M 后可以解决该问题。

附件是 xmake smart-image -f fat -v 的 log,其中 “res = 7” 说明镜像空间不够,所以后面的文件都拷不进去了 u2_2024-11-13_18_37_23.log

fat 格式会将所有符号链接全部展开成文件,导致 image 文件体积变大。

unicornx commented 5 days ago

同样先不关闭,和 #63 类似,等 #60 merge 后统一测试 pass 再关闭。