Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

NFS root

Oleksandr Andrushchenko edited this page Jan 16, 2017 · 3 revisions

NFS rootfs for dom0

This page describes how to boot Porter (or any other board) without SD card. Dom0 kernel will mount NFS share as rootfs.

Initial setup

It is advisable to configure U-boot for TFTP boot as described in TFTP boot

This manual assumes that your development PC have IP address 192.168.0.1 and your development board uses address 192.168.0.2. Please amend all instructions below to reflect your real configuration.

Setting up NFS share

You need do install NFS server:

# sudo apt install nfs-kernel-server

Ensure that it is running:

# sudo systemctl start nfs-server

Then you need to create rootfs image:

# sudo mkdir -p /srv/rcar-root

And share it over NFS:

Edit /etc/exports. You need to add following line:

/srv/rcar-root 192.168.0.2/16(rw,sync,no_root_squash,no_subtree_check,insecure,nohide) localhost(rw,sync,no_subtree_check)

localhost entry is needed if you want to check that share is working.

Update exports:

# sudo exportfs -a

Providing rootfs

We will use rootfs generated by Yocto:

# cd tmp/deploy/images/salvator-x-xen-dom0
# sudo tar -xvjf core-image-minimal-salvator-x-xen-dom0.tar.bz2 -C /srv/rcar-root

Please ensure that files in /srv/rcar-root are owned by root user.

You can use another image like core-image-weston there.

If you wish, you can test your NFS share:

# sudo mount localhost:/srv/rcar-root <mount point>

Configuring kernel to boot from NFS share

We need to provide special kernel command line parameters. Edit your device tree file (like tmp/work-shared/salvator-x-xen-dom0/kernel-source/arch/arm64/boot/dts/renesas/r8a7795-salvator-x-dom0.dts). Find chosen section and update bootargs:

xen,dom0-bootargs = "root=/dev/nfs nfsroot=192.168.0.1:/srv/rcar-root ip=192.168.0.2 console=hvc0 ignore_loglevel cma=128M rw";

Delete old .dtb file (this is important):

# tmp/work/salvator_x_xen_dom0-poky-linux/linux-renesas/4.6+gitAUTOINC+1c3c814dcd-r1/linux-salvator_x_xen_dom0-standard-build/arch/arm64/boot/dts/renesas/r8a7795-salvator-x-dom0.dtb

Rebuild kernel:

# bitbake -C compile linux-renesas

... and you are good to go! Just reboot your board. If you configured TFTP correctly, U-boot will load new device tree and kernel will boot from NFS.

You can check this with mount:

root@salvator-x-xen-dom0:~# mount
192.168.0.1:/srv/rcar-root on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=udp,timeo=11,retrans=3,sec=sys,mountaddr=192.168.0.1,mountvers=1,mountproto=udp,local_lock=all,addr=192.168.0.1)

Bonus

You don't need to run # bitbake core-image minimal every time you made changes to userspace. Just copy files from image directory of your package work dir.

For example, I have made some changes to xen toolstack:

# bitbake -C compile xen
# cd tmp/work/aarch64-poky-linux/xen/4.8.0+gitAUTOINC+3fa5d2a17c-r0/

# sudo cp image/* /srv/rcar-root -rv

One caveat. This will install more files than are in core-image-minimal. And all binaries will be unstriped. So use this only for development.

Clone this wiki locally