5. Das U-Boot
5.2. Unpacking the Source Code
If you used GIT to get a copy of the U-Boot sources, then you can skip this next step since you already have an unpacked directory tree. If you downloaded a compressed tarball from the DENX FTP server, you can unpack it as follows:
$ cd /opt/eldk/usr/src
$ wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.3.tar.bz2 $ rm -f u-boot
$ bunzip2 < u-boot-1.1.3.tar.bz2 | tar xf - $ ln -s u-boot-1.1.3 u-boot
$ cd u-boot
5.3. Configuration
After changing to the directory with the U-Boot source code you should make sure that there are no build results from any previous configurations left:
$ make distclean
The following (model) command configures U-Boot for the Yosemite board: $ make yosemite_config
The Yosemite board currently supports single configuration, to configure U-Boot for Yosemite image compliation do
make yosemite_config
And finally we can compile the tools and U-Boot itself: $ make all
By default the build is performed locally and the objects are saved in the source directory. One of the two methods can be used to change this behaviour and build U-Boot to some external directory:
1. Add O= to the make command line invocations: make O=/tmp/build distclean
make O=/tmp/build yosemite_config make O=/tmp/build all
Note that if the 'O=output/dir' option is used then it must be used for all invocations of make. 2. Set environment variable BUILD_DIR to point to the desired location:
export BUILD_DIR=/tmp/build make distclean
make yosemite_config make all
Note that the command line "O=" setting overrides the BUILD_DIR environment variable.
5.4. Installation
5.4.1. Before You Begin
5.4.1.1. Installation Requirements
The following section assumes that flash memory is used as the storage device for the firmware on your board. If this is not the case, the following instructions will not work - you will probably have to replace the storage device (probably ROM or EPROM) on such systems to install or update U-Boot.
5.4.1.2. Board Identification Data
All Yosemite boards use a serial number for identification purposes. Also, all boards have at least one ethernet (MAC) address assigned. You may lose your warranty on the board if this data gets lost. Before installing U-Boot or otherwise changing the software configuration of a board (like erasing some flash memory) you should make sure that you have all necessary information about such data.
5.4.2. Installation Using a BDM/JTAG Debugger
A fast and simple way to write new data to flash memory is via the use of a debugger or flash programmer with a BDM or JTAG interface. In cases where there is no running firmware at all (for instance on new hardware), this is usually the only way to install any software at all.We use (and highly recommend) the BDI2000 by Abatron .
Other BDM / JTAG debuggers may work too, but how to use them is beyond the scope of this document. Please see the documentation for the tool you want to use.
Before you can use the BDI2000 you have to configure it. A configuration file that can be used with Yosemite boards is included in section 13.1. BDI2000 Configuration file
To install a new U-Boot image on your Yosemite board using a BDI2000, proceed as follows: BDI>reset
- TARGET: processing user reset request - TARGET: resetting target passed
- TARGET: processing target startup .... - TARGET: core #0 PVR is 0x422218D3
- TARGET: processing target startup passed BDI>halt
Core number : 0
Core state : debug mode
Debug entry cause : JTAG stop request Current PC : 0xfffffffc Current CR : 0x3db74d1c Current MSR : 0x00000000 Current LR : 0xfffff174 BDI>erase Erasing flash at 0xfff80000 Erasing flash at 0xfff90000 Erasing flash at 0xfffa0000 Erasing flash at 0xfffb0000 Erasing flash at 0xfffc0000 Erasing flash at 0xfffd0000 Erasing flash at 0xfffe0000 Erasing flash at 0xffff0000 Erasing flash passed
BDI>prog
Programming /tftpboot/yosemite/u-boot.bin , please wait .... Programming flash passed
BDI>
5.4.3. Installation using U-Boot
If U-Boot is already installed and running on your board, you can use these instructions to download another U-Boot image to replace the current one.
Warning: Before you can install the new image, you have to erase the current one. If anything goes wrong your board will be dead. It is strongly recommended that:
you have a backup of the old, working U-Boot image •
you know how to install an image on a virgin system •
Proceed as follows:
=> tftp 100000 /tftpboot/yosemite/u-boot.bin
Waiting for PHY auto negotiation to complete... done ENET Speed is 100 Mbps - FULL duplex connection Using ppc_440x_eth0 device
TFTP from server 192.168.1.1; our IP address is 192.168.100.1 Filename '/tftpboot/yosemite/u-boot.bin'.
Load address: 0x100000
Loading: * ################################################################# ######################################
done
Bytes transferred = 524288 (80000 hex) => protect off fff80000 ffffffff Un-Protected 4 sectors => era fff80000 ffffffff .... done Erased 4 sectors => cp.b 100000 fff80000 ${filesize} Copy to Flash... done
=> setenv filesize => saveenv
Saving Environment to Flash... Un-Protected 1 sectors
Un-Protected 1 sectors Erasing Flash... . done
Erased 1 sectors
Writing to Flash... done Protected 1 sectors Protected 1 sectors => md fff80000 fff80000: 27051956 552d426f 6f742031 2e312e33 '..VU-Boot 1.1.3 fff80010: 20285365 70203134 20323030 35202d20 (Sep 14 2005 - fff80020: 32323a30 313a3436 29000000 00000000 22:01:46)... fff80030: 00000000 00000000 00000000 00000000 ... fff80040: 00000000 00000000 00000000 00000000 ... fff80050: 00000000 00000000 00000000 00000000 ... fff80060: 00000000 00000000 00000000 00000000 ... fff80070: 00000000 00000000 00000000 00000000 ... fff80080: 00000000 00000000 00000000 00000000 ... fff80090: 00000000 00000000 00000000 00000000 ... fff800a0: 00000000 00000000 00000000 00000000 ... fff800b0: 00000000 00000000 00000000 00000000 ... fff800c0: 00000000 00000000 00000000 00000000 ... fff800d0: 00000000 00000000 00000000 00000000 ... fff800e0: 00000000 00000000 00000000 00000000 ... fff800f0: 00000000 00000000 00000000 00000000 ...
5.5. Tool Installation
U-Boot uses a special image format when loading the Linux kernel or ramdisk or other images. This image contains (among other things) information about the time of creation, operating system, compression type, image type, image name and CRC32 checksums.
The tool mkimage is used to create such images or to display the information they contain. When using the ELDK, the mkimage command is already included with the other ELDK tools.
If you don't use the ELDK then you should install mkimage in some directory that is in your command search PATH, for instance:
$ cp tools/mkimage /usr/local/bin/
5.6. Initialization
To initialize the U-Boot firmware running on your Yosemite board, you have to connect a terminal to the board's serial console port.
The default configuration of the console port on the Yosemite board uses a baudrate of 115200/8N1 (115200 bps, 8 Bit per character, no parity, 1 stop bit, no handshake).
If you are running Linux on your host system we recommend either kermit or cu as terminal emulation programs. Do not use minicom, since this has caused problems for many users, especially for software download over the serial port.
For the configuration of your terminal program see section 4.1. Serial Console Access Make sure that both hardware and software flow control are disabled.