Using U-boot


2012-03-22Publicerad av Sven-Åke Andersson

Introduction


When we have U-boot running in our system, we get access to many useful commands for transfering images from our host to the Atlys board. For this to work we need a network connection to our host using the local area network and an ethernet connection.

Setting up the ethernet connection


The Atlys board includes a Marvell Alaska Tri-mode PHY 88E1111 paired with a Halo HFJ11-1G01E RJ-45 connector. Both MII and GMII interface modes are supported at 10/100/1000 Mb/s. Default settings used at power-on or reset are:


  • MII/GMII mode to copper interface
  • Auto Negotiation Enabled, advertising all speeds, preferring Slave
  • MDIO interface selected, PHY MDIO address = 00111
  • No asymmetric pause, no MAC pause, automatic crossover enabled
  • Energy detect on cable disabled (Sleep Mode disabled), interrupt polarity LOW

OpenRISC designs can access the PHY using 10/100Mbps ethernet MAC  core for 10/100 Mbps. Observe!! There is no support for 1Gbps.

Connecting to the local area network
 

There are six LEDs on the board  indicating the following status:

LED Description
0 Duplex
1 Transmitt
2 Receive
3 Link10
4 Link100
5 Link1000


 




 

Networking configuration procedures


To be able to communicate between our board and the host system through the LAN we need to setup different networking procedures. This tutorial will show us how to setup communication channels between U-boot running in the OpenRISC processor and the host system we use for all our program development and hardware generation. We will look at setting up a TFTP server and a NFS server. We will also look at how to use telnet and ftp for communication with our board.
 

Using the Trivial File Transfer Protocol


Trivial File Transfer Protocol (TFTP) is a file transfer protocol notable for its simplicity. It is generally used for automated transfer of configuration or boot files between machines in a local environment. Compared to FTP, TFTP is extremely limited, providing no authentication, and is rarely used interactively by a user. Due to its simple design, TFTP could be implemented using a very small amount of memory. It is therefore useful for booting computers such as routers which may not have any data storage devices. It is an element of the Preboot Execution Environment (PXE) network boot protocol, where it is implemented in the firmware ROM / NVRAM of the host's network card. We will use tftp for transfering program image files from our server host to the SDRAM in our OpenRISC system using U-boot and then start program execution from U-boot.
 

Setting up the /tftpboot directory


The tftpboot command always looks for the image file in the host directory /tftpboot. We have to create this directory on our host machine and allow full access (chmod 777). All the images must be copied to this directory before they can be transfered to the Atlys board using the tftpboot command.


Preparing the boot image


There are two types of boot images that can be transfered using the tftpboot command in U-boot. The first is the ELF format. Here is an example. We use the command: bootelf to start the program.

 




 

Create a bare metal boot image


To create a u-boot image from a baremetal program in bin format, the u-boot tool <mkimage> is used. It is available in u-boot's tools/ directory and the following command can be used to create a not compressed bare metal image called 'PrimeNumbers' with load address 0 and entry point at 0x100:


or32-elf-objcopy -O binary PrimeNumbers PrimeNumbers.bin

mkimage -A or1k -T standalone -C none -a 0 -e 0x100 -n PrimeNumbers -d PrimeNumbers.bin /tftpboot/PrimeNumbers.ub
 


 

We use the command: tftp PrimeNumbers.ub to transfer the image to the SDRAM on the board. The command:  bootm 100000 is used to run the program.