# Linux Kernel Module Cheat

#### 15.4.2. 9P getting started

As usual, we have already set everything up for you. On host:

    cd "$(./getvar p9_dir)"
    uname -a > host

Guest:

    cd /mnt/9p/data
    cat host
    uname -a > guest

Host:

    cat guest

The main ingredients for this are:

- `9P` settings in our kernel configs

- `9p` entry on our rootfs_overlay/etc/fstab

  Alternatively, you could also mount your own with:

      mkdir /mnt/my9p
      mount -t 9p -o trans=virtio,version=9p2000.L host0 /mnt/my9p

  where mount tag `host0` is set by the emulator (`mount_tag` flag on QEMU CLI), and can be found in the guest with: `cat /sys/bus/virtio/drivers/9pnet_virtio/virtio0/mount_tag` as documented at: https://www.kernel.org/doc/Documentation/filesystems/9p.txt.

- Launch QEMU with `-virtfs` as in your run script

  When we tried:

      security_model=mapped

  writes from guest failed due to user mismatch problems: https://serverfault.com/questions/342801/read-write-access-for-passthrough-9p-filesystems-with-libvirt-qemu

Bibliography:

- https://superuser.com/questions/628169/how-to-share-a-directory-with-the-host-without-networking-in-qemu

- https://wiki.qemu.org/Documentation/9psetup