Network settings for U-Boot on AMC1

From DSignT Support Database
Revision as of 11:13, 15 November 2017 by Claus (talk | contribs) (Created page with "== U-Boot default network environment variables == === '''''ethact''''' === Must be set to '''''cpsw''''' to enable the integrated switch. If this environment variable is clea...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1 U-Boot default network environment variables

1.1 ethact

Must be set to cpsw to enable the integrated switch. If this environment variable is cleared or set to anything else, the network will not be available.

1.2 ethaddr, eth1addr

MAC address for port 0 and port 1. During boot and if environment variable ethact is set to cpsw the chip internal MAC addresses are read and stored into these variables. If one of these variables is already set during boot, this variable will not be changed. Useful if a different MAC than the chip internal MAC address should be used (e.g a local administrated MAC starting with 02-00...).

If a Linux is booted from U-Boot, ethaddr and eth1addr are passed to Linux.

1.3 ipaddr

The local IP address used for all U-Boot Ethernet communication.

Note.png Note: Command dhcp will set this variable automatically, if a DHCP server is available and a vaild IP address was assigned.



1.4 netmask

Local subnet mask.

Note.png Note: Command dhcp will set this variable automatically, if a DHCP server is available and a vaild IP address was assigned.



1.5 gatewayip

Gateway IP address.

Note.png Note: Command dhcp will set this variable automatically, if a DHCP server is available and a vaild IP address was assigned.



1.6 dnsip

DNS server IP for name resolution.

Note.png Note: Command dhcp will set this variable automatically, if a DHCP server is available and a vaild IP address was assigned.



1.7 serverip

Used for tftpboot command to identify the TFTP server.

Note.png Note: Command dhcp will set this variable automatically, if a DHCP server is available and a vaild IP address was assigned.


Warning.png The dhcp command will set this variable to the DHCP server address, NOT to your desired TFTP server address. Any time a dhcp command is executed, the serverip must be corrected to match your TFTP server address.





Arr u.png    back to top

2 D.SignT network specific environment variables

2.1 ipconfig

A custom variable to distinguish a fix IP address setting from DHCP assigned addresses. Use value fix for a fixed IP address and dhcp for a dynamically assigned address.

Used in macro netconf

2.2 tftpservername

A optional custom variable to identify a TFTP server by its name. Requires a vaild DNS server Ip setting (s. dnsip above).

2.3 tftpserverip

If the TFTP server IP address is known and will not change, this variable can be used to identify the TFTP server. Deactivate tftpservername in this case.

2.4 nfsserverip

If the NFS server IP address is known and will not change, this variable can be used to identify the NFS server. Deactivate nfsservername in this case.



Arr u.png    back to top

3 D.SignT network specific macros

3.1 netconf

Macro netconf checks variable ipconfig and performs a DHCP request if configured for DHCP. If no IP address is assigned, a warning is issued.

If IP address assignment was successful, macros settftpserver and setnfsserver are executed.

3.2 settftpserver

When a TFTP server is identified by its name via variable tftpservername, this macro tries to resolve the IP address and if it succeeds variable tftpserverip is set to the resolved address. Additionally when this macro succeeds environment variable serverip is set to the resolved address and a tftpboot command should work.

3.3 setnfsserver

When a NFS server is identified by its name via variable nfsservername, this macro tries to resolve the IP address and if it succeeds variable nfsserverip is set to the resolved address.



Arr u.png    back to top

4 Script AMC1_NetConfig.ser

###################################################################//##
#
# @file       AMC1_NetConfig.ser
# @verbatim                 _         _             _
#                        __| |    ___(_) ____ _ __ | |_
#                       / _` |   / __| |/ _` | '_ \| __|
#                      | (_| | _ \__ \ | (_| | | | | |_
#                       \__,_|(_) ___/_|\__, |_| |_|\__|
#                      Signalprocessing |___/ Technology
# @endverbatim
# @brief      U-Boot configuration script for network settings
# @author     D.SignT GmbH & Co. KG, Claus Hermbusche
# @date       2017-08-29 09:33 AM
#
# Change this script according to your network settings. It is re-
# commended to execute environment script AMC1_ClearEnvironment.ser to
# get a clean environment before.
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#! Warning:                                                           !
#! - your network settings will be re-set                             !
#! - macro bootcmd is changed to execute netconf macro after boot     !
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# Environment variables set in this script:
#   ipaddr          - either fix (192.168.168.77) or #dhcp
#   tftpservername  - TFTP server name (needs DNS resolution) or
#   tftpserverip    - TFTP server IP address
#   ipconfig        - fix or dhcp
#   netmask         - if IP address is fix
#   gatewayip       - if IP address is fix
#   dnsip           - if IP address is fix
#   settftpserver   - resolve TFTP server IP
#   setnfsserver    - resolve NFS server IP
#   autosave        - temporary variable to save environment
#   netconf         - macro to configure network environment
#   bootcmd         - is set to execute netconf
#
#######################################################################

# set ipaddr to #dhcp if dhcp is used else enter your desired IP:
# setenv ipaddr 192.168.168.77
setenv ipaddr #dhcp

# either set tftpservername or tftpserverip
setenv tftpservername sitara-sdk400
#setenv tftpserverip 192.168.168.158

# either set nfsservername or nfsserverip
setenv nfsservername sitara-sdk400
#setenv nfsserverip 192.168.168.158


# if ipaddr not configured for dhcp, set netmask and gateway manually
if test -n ${ipaddr}; then
   setenv netmask 255.255.255.0;
   setenv gatewayip 192.168.168.100;
   setenv dnsip 192.168.168.100;
   setenv ipconfig fix
else
   setenv ipconfig dhcp
fi

setenv settftpserver '
if test -n \\"${tftpservername}\\"; then
    dns \\"${tftpservername}\\" tftpserverip; true;
else
    if test -z \\"${tftpserverip}\\"; then
        echo TFTP server address could not be resolved; false;
    else
        true;
    fi;
fi && setenv serverip \\"${tftpserverip}\\"'

setenv setnfsserver '
if test -n \\"${nfsservername}\\"; then
    dns \\"${nfsservername}\\" nfsserverip; true;
else
    if test -z \\"${nfsserverip}\\"; then
        echo NFS server address could not be resolved; false;
    else
        true;
    fi;
fi && setenv nfsserver \\"${nfsserverip}\\"'

setenv autosave 'setenv autosave ; setenv bootcmd run netconf; setenv firstboot ; saveenv'
setenv netconf '
if test \\"${ipconfig}\\" = dhcp; then
    dhcp;
elif test -z ${ipaddr}; then
    echo missing IP address settings; false;
else
    true;
fi && run settftpserver setnfsserver'

run autosave netconf


Arr u.png    back to top


5 Additional Tags

Reset U-Boot environment on AMC1
Backup and restore U-Boot environment on AMC1


Contact Post.png Support Tool.png