apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.52k stars 1.07k forks source link

cp: open failed: 2 #9185

Closed GooTal closed 1 year ago

GooTal commented 1 year ago

Hi, i built and run rv-virt:nsh64 and found that cp command is not working.

The command:

make distclean
./tools/configure.sh -l rv-virt:nsh64 && make -j12
qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 1 -bios none -kernel nuttx -nographic -s -S

Built on the branch releases/12.0

Then i mounted hostfs.

I try to copy file from hostfs, but is seems not OK: 图片

I try to copy the status file, also failed: 图片

Is this a bug? Or could you provide me some advice in case i used in a wrong way? Thanks.

acassis commented 1 year ago

@GooTal I think it is not a BUG, you are trying to copy to a read-only filesystem. You need to mount a RAMDISK or TMPFS to get a read/write FS!

GooTal commented 1 year ago

Oh thanks. i tried this and it worked.

mkrd 1024
mkfatfs /dev/ram0
mount -t vfat /dev/ram0 /tmp
mount -t hostfs -o fs=. /host
cp /host/AUTHORS /tmp
cat /tmp/AUTHORS