Add 9P network filesystem support to U-Boot. It allows U-Boot to directly mount host directories in virtualization environments via virtio.
The functionality has been verified on qemu arm64 by successfully loading a Linux kernel image and an initramfs image via 9P, and booting to the Linux shell. To test with QEMU: -fsdev local,id=fsdev0,path=/path/to/host/dir,security_model=none \ -device virtio-9p-device,fsdev=fsdev0,mount_tag=rootfs U-Boot usage: => virtio scan => ls 9p rootfs / => ls 9p 0 / => ls 9p - / => load 9p rootfs $kernel_addr_r /Image => load 9p rootfs $ramdisk_addr_r /initramfs.cpio => booti $kernel_addr_r $ramdisk_addr_r:$filesize $fdtcontroladdr Changes in v2: - Introduce DM UCLASS_9P and dm_p9_ops for transport devices. - Support selecting devices by mount tag, sequence index, or default. - Integrate 9p into disk/part.c and generic VFS null_dev_desc handling. - Consistently use 9P2000.L naming across subjects, code, and Kconfig. - Add kerneldoc comments and separate filesystem header. - Add timeout handling, feature negotiation, and remove callback. - Add 9P documentation. - Add automated pytest and enable in qemu_arm64_defconfig. - Fix error checking, bounds checks, and memory leaks. Kuan-Wei Chiu (6): net: 9p: Add 9P2000.L protocol support fs: 9p: Add 9P filesystem support virtio: 9p: Add 9P transport driver doc: 9p: Add 9P filesystem documentation test: 9p: Add test for 9P filesystem MAINTAINERS: Add entry for 9PFS MAINTAINERS | 11 + configs/qemu_arm64_defconfig | 3 + disk/part.c | 16 ++ doc/usage/filesystems/9p.rst | 55 +++++ doc/usage/index.rst | 1 + drivers/virtio/Kconfig | 7 + drivers/virtio/Makefile | 1 + drivers/virtio/virtio-uclass.c | 1 + drivers/virtio/virtio_9p.c | 119 ++++++++++ fs/9p/9p.c | 185 +++++++++++++++ fs/9p/Kconfig | 8 + fs/9p/Makefile | 5 + fs/Kconfig | 2 + fs/Makefile | 1 + fs/fs.c | 25 ++ include/9p.h | 203 ++++++++++++++++ include/9pfs.h | 60 +++++ include/dm/uclass-id.h | 1 + include/fs.h | 1 + include/virtio.h | 12 +- net/9p/Kconfig | 5 + net/9p/Makefile | 5 + net/9p/client.c | 408 +++++++++++++++++++++++++++++++++ net/Kconfig | 2 + net/Makefile | 1 + test/py/tests/test_9p.py | 82 +++++++ 26 files changed, 1219 insertions(+), 1 deletion(-) create mode 100644 doc/usage/filesystems/9p.rst create mode 100644 drivers/virtio/virtio_9p.c create mode 100644 fs/9p/9p.c create mode 100644 fs/9p/Kconfig create mode 100644 fs/9p/Makefile create mode 100644 include/9p.h create mode 100644 include/9pfs.h create mode 100644 net/9p/Kconfig create mode 100644 net/9p/Makefile create mode 100644 net/9p/client.c create mode 100644 test/py/tests/test_9p.py -- 2.55.0.897.gb25b4bd76c-goog
