-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathU-Boot.mw
137 lines (102 loc) · 5.56 KB
/
U-Boot.mw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
= About =
Das U-Boot, the universal bootloader, is a popular bootloader for embedded systems. For information about the project itself see its [http://www.denx.de/wiki/U-Boot 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:
<nowiki>
#define CONFIG_ETHOC
#define CONFIG_SYS_ETHOC_BASE 0x92000000
</nowiki>
The preferred way of setting up MAC address and IP settings is through the environment:
<nowiki>
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
</nowiki>
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
<nowiki>
#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
</nowiki>
= 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
<nowiki>tools/mkimage -n 'Linux for OpenRISC' -A or1k -O linux -T kernel -C none -a 0 -e 0x100 -d /path/to/vmlinux.bin uImage</nowiki>
= 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
<nowiki>mkimage -A or1k -T standalone -C none -a 0 -e 0x100 -n helloWorld -d hello.bin uImage</nowiki>
== 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:
<nowiki>set serverip 192.168.1.65
set bootfile "/path/to/your/nfs/share/uImage"
set loadaddr 100000</nowiki>
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:
<nowiki>==> 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)</nowiki>
Your exact details may vary.
== Running the image from RAM ==
This image can then be booted from that address with
<nowiki>bootm 100000</nowiki>
== Saving the image to flash and booting it ==
Or we can copy it to the 1MB mark in flash memory with the following:
<nowiki>protect off all
erase f0100000 +20000
cp 100000 f0100000 13930
protect on all</nowiki>
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:
<nowiki>bootm f0100000</nowiki>
= 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.
<nowiki>tftpboot uImage</nowiki>
When the image has finished loading, it can be booted by using the ''bootm'' command.
<nowiki>bootm</nowiki>
= Supported boards =
The supported boards so far are board ports from [[ORPSoC]].
== ordb1a3pe1500 ==
This board is the [[FPGA_Development_Boards#ORSoC_OpenRISC_development_board | 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:
<nowiki>make ordb1a3pe1500_config
make</nowiki>
== ml501 ==
This board is a [[FPGA_Development_Boards#Xilinx_ML501 | Xilinx Virtex 5 development board]].
<nowiki>make ml501_config
make</nowiki>
== atlys ==
This board is a [[FPGA_Development_Boards#Digilent_Atlys | Xilinx Spartan 6 development board from Digilent]].
<nowiki>make atlys_config
make</nowiki>
== de0_nano ==
This board is a [[FPGA_Development_Boards#Terasic_DE0_Nano | Altera Cyclone IV development board from Terasic]].
<nowiki>make de0_nano_config
make</nowiki>
= 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':
<nowiki>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</nowiki>