Contents |
Developing software for AVR32 Linux is often an iterating process. The program is compiled on a workstation, transfered to the target and executed.
This can be tedious if an SD memory card is used for the transfer. A more lean approach is to setup a NFS server holding the AVR32 Linux file system. This NFS server can be the development workstation and in this way the executable is directly available both on development and target system.
If developing on Linux kernel drivers or other files that need to reside on the root file system, the NFS server must be capable of storing and exporting the Linux device files correctly. Currently no known Windows NFS server is capable of this. A Linux system is therefore required. This may be a virtual machine (e.g. using VMware) or a native system.
If, however, only user space programs are developed, AVR32 Linux may boot as normal (from on-board flash or SD-card) and the NFS server mounted at an arbitrary point. In this case any NFS server should do.
In the following a fully featured NFS server running on Linux is assumed and the complete AVR32 Linux file system is exported as NFS. The Linux distribution is Ubuntu-server.
# sudo su - # apt-get install nfs-kernel-server # mkdir /nfs # pico /etc/exports
add this line
/nfs 10.0.0.0/255.0.0.0(rw,sync,no_root_squash)
save and exit (Ctrl-X), finally type
# /etc/init.d/nfs-kernel-server restart
to reload the nfs daemon.
Note that you may have to adjust the ipaddress/ipmask above to match your network.
The U-Boot boot loader can retrieve the AVR32 Linux kernel over the network with the TFTP protocol.
# sudo su - # apt-get install tftpd-hpa # mkdir -p /nfs/tftp # pico /etc/default/tftp-hpa
Change RUN_DAEMON to 'yes' and the path to /nfs/tftp
RUN_DAEMON="yes" OPTIONS="-l -s /nfs/tftp"
Finally start the tftp server
# /etc/init.d/tftpd-hpa start
Das U-Boot and AVR32 Linux can use manually configured ip addresses. However, many will find it more convenient to use dynamic ip assignment: DHCP.
DHCP is usually enabled if you are connecting the AVR32 device to an existing network. However, many IT-departments will deny hooking up non approved hardware (and especially development kits) to the business network. In such case you'll probably setup a small LAN or a direct link between the NFS server and AVR32 device. You will need to configure the network interface on the server for static IP address.
Note that in the following it is assumed that the AVR32 device is connected to the primary ethernet port (eth0) on the server.
# pico /etc/network/interfaces
You will probably find a line like 'iface eth0 inet dhcp'
change this to:
iface eth0 inet static address 10.0.0.1 netmask 255.255.255.0
Restart network interfaces with
# ifdown eth0 # ifup eth0
WARNING do not install a DHCP server on your workstation if it is part of the business network as it will cause conflict with corporate DHCP servers.
# apt-get install dhcp3-server # pico /etc/dhcp3/dhcpd.conf
Append the following section at the end:
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.20 10.0.0.200;
option routers 10.0.0.1;
option broadcast-address 10.0.0.255;
Save and exit
# pico /etc/default/dhcp3-server
Add 'eth0' to the interface (or eth1 if AVR32 device is connected to a secondary ethernet port)
INTERFACES="eth0"
Restart dhcp server
# /etc/init.d/dhcp3-server restart
It is assumed below that the NFS and TFTP server is the same machine and that this has IP address 10.0.0.1. The AVR32 devices receives a dynamic IP address from a DHCP server
UBoot> set serverip 10.0.0.1 UBoot> set tfpserver 10.0.0.1 UBoot> set bootcmd 'set bootfile uImage;dhcp;bootm' UBoot> set bootargs 'root=/dev/nfs ip=dhcp nfsroot=10.0.0.1:/nfs console=ttyS0' UBoot> saveenv UBoot> boot
It is assumed below that the NFS and TFTP server is the same machine and that this has IP address 10.0.0.1. The AVR32 device uses a static ip address 10.0.0.10
UBoot> set serverip 10.0.0.1 UBoot> set tfpserver 10.0.0.1 UBoot> set bootcmd 'set ipaddr 10.0.0.10;tftp 0x10200000 uImage;bootm' UBoot> askenv bootargs >root=/dev/nfs nfsroot=10.0.0.1:/nfs ip=10.0.0.10::10.0.0.1:::eth0:off console=ttyS0 UBoot> saveenv UBoot> boot
(we use askenv for the bootargs because it is too long for the U-Boot command line interpreter)
For the ngw100, use these commands instead:
UBoot> setenv serverip 10.0.0.1 UBoot> setenv tftpip 10.0.0.1 UBoot> setenv bootcmd 'set ipaddr 10.0.0.10;tftp 0x10200000 uImage;bootm' UBoot> askenv bootargs >root=/dev/nfs nfsroot=10.0.0.1:/nfs ip=10.0.0.10::10.0.0.1:::eth0:off console=ttyS0 UBoot> saveenv UBoot> boot
When the NFS server is fully functional the /nfs folder will contain the file system for the AVR32 device and where you'll need to place the target application. If the NFS server is not your favorite MS Windows workstation, you are probably a little uncomfortable working your code in Linux.
Generally there is two ways to accomplish this: Teach Windows to speak NFS or teach Linux to speak Windows' file sharing (Samba).
Microsoft's services for UNIX (SFU) provides a NFS client and is free to download. Use the Services for UNIX Administration, User Name Mapping, and map your user name to UNIX 'root'.
Minimal passwd and group files are:
passwd: root:x:0:0:root:/root:/bin/bash group: root:x:0:
Please note that NFS is not secure in a hostile (ie public) network environment!
An alternative is to setup Samba, a windows file server for Linux which will let you mount the /nfs folder as a network drive in windows.
# sudo su - # apt-get install samba # pico /etc/samba/smb.conf
Append the following section at the end
[avr32nfs] comment = Target file system path = /nfs guest ok = yes browseable = yes writable = yes create mask = 0777 directory mask = 0777 admin users = avr force group = root force user = root
Add a samba user 'avr'
# smbpasswd avr
Restart samba server
# /etc/init.d/samba restart
Please note that this setup is usually not recomended for Samba from a security point of view. Nevertheless, it is the easiest way to create files in the NFS folder with correct permissions. Do not use the admin users, force group, force user or guest ok in a hostile (i.e. public) network environment