ArmPlatformPkg ArmVExpressPkg Network - jljusten/tianocore GitHub Wiki

Table of Contents

Install a DHCP and TFTP servers on your machine

To ease my development I have installed a second dedicated ethernet card on my host machine (... do not forget the crossover cable if directly connected to your development board).

$ /sbin/ifconfig | grep eth
eth0      Link encap:Ethernet  HWaddr 00:24:1d:0c:1b:a8  
eth1      Link encap:Ethernet  HWaddr 00:00:5a:11:8b:35
The DHCP and TFTP servers will be attached to eth1. The following instructions are based on Ubuntu, this wikipage should not be considered as the reference documentation to install these network services. They are only there for information. Please look at your OS/Linux distribution documentation for a proper settings.

Install the DHCP server

sudo apt-get install dhcp3-server
After installing, the final messages should say that the server failed to start, it is expected as the server needs to be configured.

The files you will need to manually edit are:

- /etc/dhcp3/dhcpd.conf : DHCP properties configuration
- /etc/default/dhcp3-server : DHCP network configuration
You need to create a subnet that the DHCP server will serve addresses on. This is done through /etc/dhcp3/dhcpd.conf. A sample subnet declaration is shown below along with other configuration statements essential for success.
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.254;
        option broadcast-address 192.168.1.255;
}

Now make sure that the server will listen on the correct device by editing /etc/default/dhcp3-server so that INTERFACES is assigned "eth1":

INTERFACES="eth1"

Install the TFTP server

Get the server package

sudo apt-get install tftpd-hpa
The server should fail to start.

Get the client package for testing

sudo apt-get install tftp-hpa

Configure TFTP through /etc/default/tftpd-hpa as follows:

# /etc/default/tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="192.168.1.1:69"
TFTP_OPTIONS="--secure"

If the directory /var/lib/tftpboot doesn't exist then create it. This is where you put the files to serve such as "BOOTARM.EFI". Create a file (for the experimentation I will copy $EDK2_ROOT/ShellBinPkg/UefiShell/Arm/Shell.efi as /var/lib/tftpboot/BOOTARM.EFI) and put it in that directory. Now stop the dhcp server if it's running and add the 'filename' line inside your subnet declaration in /etc/dhcp3/dhcpd.conf:

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.254;
        option broadcast-address 192.168.1.255;
        filename "BOOTARM.EFI";
}

Note: A DHCP server will always need to provide a filename if it does not support PXE boot to allow the UEFI client to request an IP address. A UEFI client will refuse an IP address of a DHCP server that does not support neither PXE or BOOTP.

You might need to create a group and user for the TFTP service (check if the command `cat /etc/passwd | grep ftp` returns any entry):

sudo groupadd -r tftp
sudo useradd -r -d /var/lib/tftpboot -g tftp -s /sbin/nologin tftp

Configure the Ethernet card

We also need to configure the eth1 device to have a static ip address. There are a few ways to do this, either via a script or through the command line. The command to use to set a static address is:

sudo ifconfig eth1 192.168.1.1 netmask 255.255.255.0

If you want to write the configuration, edit the file /etc/network/interfaces:

auto eth1
iface eth1 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255

And finally, restart the network services by running:

sudo /etc/init.d/networking restart
sudo /etc/init.d/dhcp3-server restart
sudo service tftpd-hpa restart

Let's test of TFTP service. From your terminal:

tftp 192.168.1.1 69
tftp> get BOOTARM.EFI

Now you should see the file you put in /var/lib/tftpboot in the directory you ran tftp from.

Debugging the Ethernet Driver

To debugging the network stack add the bit DEBUG_NET (ie: 0x00004000) to gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel to enable the network specific debug information.

⚠️ **GitHub.com Fallback** ⚠️