OpenCores

U-Boot

From OR1K

Contents

About

Das U-Boot, the universal bootloader, is a popular bootloader for embedded systems. For information about the project itself see its webpage.

This page contains information about the OpenRISC 1000 architecture port and board additions.

Downloading

U-Boot sources with OpenRISC 1000 support is available in the official U-boot sources and can be downloaded from http://www.denx.de/wiki/U-Boot/SourceCode

Configuration

There are two different ways to do configuration in U-Boot, one is the pre-compile configuration in the include/configs/boardname.h and the other is the runtime configuration called the 'environment'

Network

The following configuration knobs are necessary to enable networking:

#define CONFIG_ETHOC
#define CONFIG_SYS_ETHOC_BASE 		0x92000000
 

The preferred way of setting up MAC address and IP settings is through the environment:

setenv ethaddr 00:12:34:56:78:9a
setenv gatewayip 192.168.255.254
setenv ipaddr 192.168.255.27
setenv netmask 255.255.0.0
setenv serverip 192.168.255.100
saveenv
 

NOTE: you need to restart your board after you have set 'ethaddr'.

If for some reason there is no possibility to save the environment to a non-volatile storage, the settings can also be hardcoded into to the pre-compile configuration

#define CONFIG_ETHADDR			00:12:34:56:78:9a
#define CONFIG_GATEWAYIP		192.168.255.254
#define CONFIG_IPADDR   		192.168.255.103
#define CONFIG_NETMASK  		255.255.0.0
#define CONFIG_SERVERIP			192.168.255.100
  

Creating a Linux kernel boot image

To create a u-boot Linux kernel boot image, a tool called mkimage is used. It is available in u-boot's tools/ directory and the following command can be used to create a not compressed kernel image called 'uImage' with load address at 0 and entry point at 0x100

tools/mkimage -n 'Linux for OpenRISC' -A or1k -O linux -T kernel -C none -a 0 -e 0x100 -d /path/to/vmlinux.bin uImage

Creating a bare metal boot image

To create a u-boot image from a baremetal program, the u-boot tool call 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 'helloWorld' with load address 0 and entry point at 0x100

mkimage -A or1k -T standalone -C none -a 0 -e 0x100 -n helloWorld -d hello.bin uImage

Downloading the image to the board

The following will use NFS to download this image to the board. Ensure you have NFS set up and accessible somewhere on your machine. Copy the resulting file from the previous step, uImage, there. So long as the board has network access, set the following in u-boot:

set serverip 192.168.1.65
set bootfile "/path/to/your/nfs/share/uImage"
set loadaddr 100000

The above assumes your host machine (running the NFS server) is at 192.168.1.65 - change this to the appropriate IP in your case. The program will be saved into RAM at the 1MB mark (0x100000). Now run the NFS download program:

==> nfs
ethoc
Using ETHOC-0 device
File transfer via NFS from server 192.168.1.65; our IP address is 192.168.1.72
Filename '/home/user/path/to/uImage'.
Load address: 0x100000
Loading: ################
done
Bytes transferred = 80176 (13930 hex)

Your exact details may vary.

Running the image from RAM

This image can then be booted from that address with

bootm 100000

Saving the image to flash and booting it

Or we can copy it to the 1MB mark in flash memory with the following:

protect off all
erase f0100000 +20000
cp 100000 f0100000 13930
protect on all

We copied 80176 bytes (13930 hex) to the 1MB mark in flash (address 0xf0100000) from RAM address at 1MB.

This image can now be booted with:

bootm f0100000

Booting from tftp

When u-boot's net configuration is properly setup, and a tftp server is running, the following command is used to load the file uImage into RAM.

tftpboot uImage

When the image has finished loading, it can be booted by using the bootm command.

bootm

Supported boards

The supported boards so far are board ports from ORPSoC.

ordb1a3pe1500

This board is the ORSoC Actel development board with an A3PE1500 Actel part on it.

The board config is far from complete, see the file include/configs/ordb1a3pe1500.h for more information on the config.

To build for this board run:

make ordb1a3pe1500_config
make

ml501

This board is a Xilinx Virtex 5 development board.

make ml501_config
make

atlys

This board is a Xilinx Spartan 6 development board from Digilent.

make atlys_config
make

de0_nano

This board is a Altera Cyclone IV development board from Terasic.

make de0_nano_config
make

How to create your own board port

To add your own board port follow these steps. We will use the atlys board as a starting point, and we will call our new board 'myboard':

1) copy u-boot/include/configs/atlys.h to u-boot/include/configs/myboard.h
2) copy the folder u-boot/board/atlys to u-boot/board/myboard
3) add 'myboard' to u-boot/boards.cfg in a similar way as the 'atlys' board appears
4) edit u-boot/include/configs/myboard.h and u-boot/board/myboard/u-boot.lds to suite your needs
5) run make myboard_config

© copyright 1999-2017 OpenCores.org, equivalent to ORSoC AB, all rights reserved. OpenCores®, registered trademark.