Loading...
 

Use network in U-Boot

There are 4 Ethernet interfaces available on MACCHIATObin, one of them is 1GbE port with RJ45 inteface, two of them are 10GbE via RJ45 or SFP interfaces, and the last one is 2.5GbE via SFP interface.

 Note

The 10G copper connectors are only available on the Double Shot version of MACCHIATObin; they are not mounted on the Single Shot MACCHIATObin board.


To use the Ethernet interfaces on MACCHIATObin, you need to understand the name and index of each of the port. In the U-Boot environment, they are named as egiga0 through egiga3. Please see the picture below for the mapping of the Ethernet ports in U-Boot.

Ethernet Port   Uboot  

Starting from the armada-17.06 release, the U-Boot version is upgraded from 2015.01 to 2017.03 which brought changes to naming of network interfaces. Starting from 2017.03, each egiga# interface has changed to mvpp2-#. Furthermore, each mvpp2-# interface is mapped to a eth# alias.

 Note

For example, the 1G Ethernet port is no longer egiga2 but mvpp2-4 which is mapped to eth2 alias.


The example below shows the instructions on how to enable and use the network in the U-Boot through the 1GbE port eth2.

First, power up the MACCHIATObin and connect an Ethernet cable to the 1GbE port, i.e. the eth2 port (egiga2 on the picture above). Press the enter key to abort the auto boot process.

Hit any key to stop autoboot:  0
Marvell>>


Check if the U-Boot is picking up the 1GbE port you try to enable, the example below shows the U-Boot is using mvp2-0 (eth0) instead.

Marvell>> print ethact
ethact=mvp2-0
Marvell>> print ethprime
ethprime=eth0


Update both the environment variables ethact and ethprime to eth2 and save the changed variables. This way U-Boot will use this port by default even after the power cycle.

Marvell>> setenv ethact eth2
Marvell>> setenv ethprime eth2
Marvell>> save


Check the network connection by doing the dhcp command in the U-Boot. If the output message shows the dhcp acquires the IP address, that means the network is working. If you don't have the DHCP server in your network environment, you may skip this step.

Marvell>> dhcp
BOOTP broadcast 1
DHCP client bound to address 10.82.40.176 (16 ms)
[Truncated output]


Setup the environment variable ipaddr to the address you have just acquired, and ping a host to confirm the network connection. If you don't have the dhcp server to perform the dhcp command in U-Boot, you may skip the dhcp process and directly assign the ipaddr and confirm the network connection by ping a known host. Please be noted the ipaddr can also be saved to avoid the setup of this variable every time you boot up the MACCHIATObin.

 Note

Adjust the parameters below to suit your setup.
Marvell>> setenv ipaddr 10.82.40.176
Marvell>> save
Marvell>> ping 10.82.40.225
Using mvpp2-4 device
host 10.82.40.225 is alive


Now you have a working Ethernet in the U-Boot. We can go to the next step to boot the kernel from the network and mount a nfs file system as the root file system to MACCHIATObin. Assuming you already have your server setup with tftp service and nfs service available(Note*), you can setup the environment variable serverip with your server IP address, and load the kernel image and dtb file from your tftp server. 

Marvell>> setenv serverip 10.82.40.225
Marvell>> tftp 0x2000000 mcbin/Image
Using mvpp2-4 device
TFTP from server 10.82.40.225; our IP address is 10.82.40.176
Filename 'mcbin/Image'.
Load address: 0x2000000
Loading: #################################################################
[Truncated output]
         ###########
         3.5 MiB/s
done
Bytes transferred = 14472704 (dcd600 hex)
Marvell>> tftp 0x1800000 mcbin/armada-8040-mcbin.dtb
Using egiga2 device
[Truncated output]
Bytes transferred = 33736 (83c8 hex)


Next step you need to setup the bootargs variable to pass the correct command line string to Linux kernel.

Marvell>> setenv bootargs $console root=/dev/nfs rw nfsroot=$serverip:/data/nfs/mcbin ip=dhcp


Here you are re-utilizing the preset variables such as console and serverip in the U-Boot. Confirm your bootarg with print command.

Marvell>> pri bootargs
bootargs=console=ttyS0,115200 root=/dev/nfs rw nfsroot=10.82.40.225:/data/nfs/mcbin ip=dhcp


Once you have the bootargs setup correctly. You can boot the kernel with booti command:

Marvell>> booti 0x2000000 - 0x1800000


The booti command will start the Linux kernel and when the kernel boot process completes, it will lead you to the root file system login prompt. In the example of the Buildroot file system, login with root account to start the Buildroot prompt.

Welcome to Buildroot
buildroot login: root
#


 Note

Make sure that the option no_root_squash is enabled in the /etc/exports for the directory exported to the MACCHIATObin for root file system. See the example below:

 

/data/nfs  *(rw,sync,no_root_squash,no_subtree_check)