Network and NFS setup

Aus BECOM Systems Support
Version vom 31. Oktober 2023, 09:03 Uhr von Peter (Diskussion | Beiträge) (1 Version importiert)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Set up an NFS root file system

During development, it is very common and practical to have the target mount its root file system via NFS. Therefore, you need an NFS server installed (see here how to do it).

We have already prepared a little shell script that should do the work for you: In the btmxc repository, look for one of these files:

prepare_nfs_zImage.sh
scripts/rootfs_unpack.sh

What the script does:

  • Unpacks the .tar.bz2 image file to oe/btmxc/tmp/deploy/glibc/images/[machine]/rootfs (and deletes an old image from there!)
  • Edits the file /etc/network/interfaces from the rootfs and disables configuration of the eth0 interface
  • Copies the zImage from oe/btmxc/tmp/deploy/glibc/images/[machine]/ to /tftpboot
  • Restarts the NFS server for the changes to take effect

Simply execute this file (./prepare_nfs_zImage or scripts/rootfs_unpack.sh respectively) to prepare the root file system for NFS. The script will tell you if arguments are needed. Please note that you have to source the oeenv file beforehand, but usually, you will already have done that.

In your /tftpboot, you should have a symbolic link to the newly created rootfs directory. We explain that here.

Target network setup

Network setup is configured in the file /etc/network/interfaces in your rootfs. The default network setup for Ethernet (eth0) is set to DHCP:

auto eth0
iface eth0 inet dhcp

To set a fixed IP address, you may modify the lines above as follows:

auto eth0
iface eth0 inet static
address 192.168.0.53
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255

IMPORTANT! If you are mounting the rootfs via NFS, you MUST NOT configure eth0 at all in the configuration file, so comment the lines

#auto eth0
#iface eth0 inet dhcp

The reason is that the Linux kernel - in case of NFS - must configure the network before this file can even be read. This is done via kernel arguments (see Loading Linux: in the Redboot short reference). If the network would be configured later again, the connection to the NFS server is interrupted!