Installing U-boot the universal bootloader


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

Introduction


Now when we can communicate with our board it is high time to install U-boot, the universal bootloader. U-boot is an open source, primary boot loader used in embedded devices. It is available for a number of different computer architectures, including PPC, ARM, MIPS, AVR32, x86, 68k, Nios, OpenRISC and MicroBlaze. U-boot will simplify the loading of programs and help us install Linux one day.

U-boot for OpenRISC


This wiki page explains the OpenRISC implementation of U-boot. We start by downloading the source files from the GIT repository: git clone git://openrisc.net/stefan/u-boot

Here is the installed directory structure:




 

Configuration


There is already a pre-compiled configuration file ready to be used, called atlys.h in the directory: include/configs:

 


 

Building the software
 

Building U-Boot has been tested in several native build environments and in many different cross environments. If we are not using a native environment, it is assumed that we have GNU cross compiling tools available in our path. In this case, we must set the environment variable CROSS_COMPILE in our shell. Note that no changes to the Makefile or any other source files are necessary.

CROSS_COMPILE=or32-elf-
export CROSS_COMPILE

Lets add this line in our .bashrc file: export 
CROSS_COMPILE=or32-elf-

Next step is to run:

make distclean
make atlys


Converting the image.bin file


We take the generated u-boot.bin file and run it through the same process as we did with the LEDtest.bin  file.


U-boot running in the system


After waiting a few minutes for the image to be programmed to the SPI flash and then moved to the SDRAM and started, this is displayed on the serial terminal. We have U-boot up and running.



 
 

Starting U-boot after power-up
 

After powering up the board we can restart U-boot by pressing the Reset button.
 


 

Setting up the environment


The environment variables are defined from inside the U-boot program. We start by setting the MAC address to some address not used by any other node in the network.



 

Next step is to set the IP addresses matching the addresses used in our local network. We have to find an IP address for our board not used in our subnet. Here is an example from our installation. After setting the environment variables we us the command saveenv to save all the settings in the SPI flash. We then have to reset our board.

 


To find the serverip execute the following command on our host:

 


 


Using U-boot


Here is a link to the U-boot user's manual. The help command display all the available commands: