This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to enable a shared directory between the booted guest OS on Morello FVP and the host linux machine

Hi,

I want to experiment with capability enabled LLVM - but would like to have a shared directory  between the Morello FVP  and the host linux. Please could you give some more detailed instructions on this, sorry if I have missed anything obvious in the documentation. 

Thanks,

Andy

Parents
  • Hi Andy,

    Since you say you're using CheriBSD, by default cheribuild will set up the FVP to expose the guest's SSH port 22. If you look at the arguments passed to the FVP as printed out by cheribuild, you should see a pair that looks like `-C board.virtio_net.hostbridge.userNetPorts=21846=22` (that first number will likely be different for you as it's generated based on your user's id so as to avoid collisions on shared servers), meaning you can use `ssh -p 21846 root@localhost` to connect to CheriBSD. That means you can also copy files to the guest with `scp -P 21846 /path/to/source root@localhost:/path/to/dest` and from the guest with `scp -P 21846 root@localhost:/path/to/source /path/to/dest` (note the capitalisation of `-P`).

    If you update your cheribuild to the latest version in git you should now see an additional friendlier `Listening for SSH connections on localhost:21846` message printed in green (something we print for our QEMU CHERI-MIPS and CHERI-RISC-V invocations, but that did not get copied for the FVP it seems).

    You can also `kldload smbfs` and mount a shared Samba filesystem using `mount_smbfs -I 10.0.2.4 -N //10.0.2.4/share_name /mnt` (where `share_name` is whatever you've configured, and you can of course `mkdir` your own mount points, `/mnt` is just there by default if you only need one). Unlike QEMU, the FVP does not have Samba integration baked into it, but here's an example config based on what QEMU auto-generates:

    [global]
    private dir=/tmp/qemu-smb.35U1U0
    interfaces=127.0.0.1
    bind interfaces only=yes
    pid directory=/tmp/qemu-smb.35U1U0
    lock directory=/tmp/qemu-smb.35U1U0
    state directory=/tmp/qemu-smb.35U1U0
    cache directory=/tmp/qemu-smb.35U1U0
    ncalrpc dir=/tmp/qemu-smb.35U1U0/ncalrpc
    log file=/tmp/qemu-smb.35U1U0/log.smbd
    smb passwd file=/tmp/qemu-smb.35U1U0/smbpasswd
    security = user
    map to guest = Bad User
    load printers = no
    printing = bsd
    disable spoolss = yes
    case sensitive = yes
    usershare max shares = 0
    min protocol = NT1
    [my_first_share]
    path=/path/to/first/share
    read only=no
    guest ok=yes
    force user=jrtc4
    [my_second_share]
    path=/path/to/second/share
    read only=no
    guest ok=yes
    force user=jrtc4

    The /tmp/qemu-smb.35U1U0 path can be anything you like, it's just a dummy directory where you need to put the smb.conf. You can then start smbd with `smbd -l /tmp/qemu-smb.35U1U0 -s /tmp/qemu-smb.35U1U0/smb.conf` in the background or another terminal window.

Reply
  • Hi Andy,

    Since you say you're using CheriBSD, by default cheribuild will set up the FVP to expose the guest's SSH port 22. If you look at the arguments passed to the FVP as printed out by cheribuild, you should see a pair that looks like `-C board.virtio_net.hostbridge.userNetPorts=21846=22` (that first number will likely be different for you as it's generated based on your user's id so as to avoid collisions on shared servers), meaning you can use `ssh -p 21846 root@localhost` to connect to CheriBSD. That means you can also copy files to the guest with `scp -P 21846 /path/to/source root@localhost:/path/to/dest` and from the guest with `scp -P 21846 root@localhost:/path/to/source /path/to/dest` (note the capitalisation of `-P`).

    If you update your cheribuild to the latest version in git you should now see an additional friendlier `Listening for SSH connections on localhost:21846` message printed in green (something we print for our QEMU CHERI-MIPS and CHERI-RISC-V invocations, but that did not get copied for the FVP it seems).

    You can also `kldload smbfs` and mount a shared Samba filesystem using `mount_smbfs -I 10.0.2.4 -N //10.0.2.4/share_name /mnt` (where `share_name` is whatever you've configured, and you can of course `mkdir` your own mount points, `/mnt` is just there by default if you only need one). Unlike QEMU, the FVP does not have Samba integration baked into it, but here's an example config based on what QEMU auto-generates:

    [global]
    private dir=/tmp/qemu-smb.35U1U0
    interfaces=127.0.0.1
    bind interfaces only=yes
    pid directory=/tmp/qemu-smb.35U1U0
    lock directory=/tmp/qemu-smb.35U1U0
    state directory=/tmp/qemu-smb.35U1U0
    cache directory=/tmp/qemu-smb.35U1U0
    ncalrpc dir=/tmp/qemu-smb.35U1U0/ncalrpc
    log file=/tmp/qemu-smb.35U1U0/log.smbd
    smb passwd file=/tmp/qemu-smb.35U1U0/smbpasswd
    security = user
    map to guest = Bad User
    load printers = no
    printing = bsd
    disable spoolss = yes
    case sensitive = yes
    usershare max shares = 0
    min protocol = NT1
    [my_first_share]
    path=/path/to/first/share
    read only=no
    guest ok=yes
    force user=jrtc4
    [my_second_share]
    path=/path/to/second/share
    read only=no
    guest ok=yes
    force user=jrtc4

    The /tmp/qemu-smb.35U1U0 path can be anything you like, it's just a dummy directory where you need to put the smb.conf. You can then start smbd with `smbd -l /tmp/qemu-smb.35U1U0 -s /tmp/qemu-smb.35U1U0/smb.conf` in the background or another terminal window.

Children
No data