Hardware/ARMEBS/3/u-bootBefore2.6.26

From UIT
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{private}} {{TOC right}} = u-boot = '''This page is only for kernel older than 2.6.26, for newer kernels, see ObjectWifi''' u-boot is a bootloader, we've choosen it because ...")
 
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{private}}
+
{{public}}
 
{{TOC right}}
 
{{TOC right}}
 
= u-boot =
 
= u-boot =
'''This page is only for kernel older than 2.6.26, for newer kernels, see ObjectWifi'''
+
'''This page is only for kernel older than 2.6.26, for newer kernels, see Hardware/ARMEBS/3/u-boot'''
  
u-boot is a bootloader, we've choosen it because it supports usb and network operations. [[BR]]
+
u-boot is a bootloader, we've choosen it because it supports usb and network operations.
It has been adapted to support our board, especially an [wiki:AutoUpdate auto-update] function, using an USB flash drive. [[BR]]
+
It has been adapted to support our board, especially an [[Hardware/ARMEBS/3/AutoUpdate auto-update]] function, using an USB flash drive.
As any bootloader, u-boot can be used (and this is it's main purpose) to start another program (or operating system), for instance Linux. [[BR]]
+
As any bootloader, u-boot can be used (and this is it's main purpose) to start another program (or operating system), for instance Linux.
The application we want to run must be in a special form called ''image'' and can be generated using {{{mkimage}}} (in u-boot/tools/), for instance generating a Linux kernel image is done using the following command :  
+
The application we want to run must be in a special form called ''image'' and can be generated using '''mkimage''' (in u-boot/tools/), for instance generating a Linux kernel image is done using the following command :  
{{{
+
mkimage -A ARM -T kernel -C none -O Linux -a 0x20008000 -d /opt/armebs3/linux-2.6.15/output/arch/arm/boot/zImage linux.img
+
}}}
+
Since r641 of our Linux kernel, {{{make zImage.img}}} will build this image for you.
+
  
== Automatic startup {{{bootcmd}}} ==
+
  mkimage -A ARM -T kernel -C none -O Linux -a 0x20008000 -d /opt/armebs3/linux-2.6.15/output/arch/arm/boot/zImage linux.img
 +
 
 +
After r641 of our Linux kernel, '''make zImage.img''' will build this image for you.
 +
 
 +
== Automatic startup '''bootcmd''' ==
 
At boot, u-boot do this:
 
At boot, u-boot do this:
  * By default, it runs the command in the {{{bootcmd}}} variable.
+
* By default, it runs the command in the '''bootcmd''' variable.
  * If the first button (S1 on the ARMEBS3) is pressed, it tries to do AutoUpdate on the USB key. If it fails, it runs {{{bootcmd}}}.
+
* If the first button (S1 on the ARMEBS3) is pressed, it tries to do AutoUpdate on the USB key. If it fails, it runs '''bootcmd'''.
  * If the third button (S3 on the ARMEBS3) is pressed, it jumps to 0x10060000, after disabling instruction cache.
+
* If the third button (S3 on the ARMEBS3) is pressed, it jumps to 0x10060000, after disabling instruction cache.
  
 
=== Settings for the technical informatics laboratories ===
 
=== Settings for the technical informatics laboratories ===
 
The instruction cache must be shut-down before downloading a software via the JTAG interface.
 
The instruction cache must be shut-down before downloading a software via the JTAG interface.
{{{
+
  set bootcmd icache off
set bootcmd icache off
+
  save
save
+
 
}}}
+
  
 
=== Get the Linux kernel from tftp (using a static ip address), and launch it ===
 
=== Get the Linux kernel from tftp (using a static ip address), and launch it ===
  * the kernel image (zImage.img) is at the root of the tftp server
+
* the kernel image (zImage.img) is at the root of the tftp server
  * the tftp server IP is 153.109.5.233
+
* the tftp server IP is 153.109.5.233
  * the armebs3 IP is 153.109.5.232
+
* the armebs3 IP is 153.109.5.232
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
* don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
{{{
+
  set ipaddr 153.109.5.232
set ipaddr 153.109.5.232
+
  set serverip 153.109.5.233
set serverip 153.109.5.233
+
  setenv bootcmd "tftpboot 0x21000000 zImage.img ; bootm 0x21000000"
setenv bootcmd "tftpboot 0x21000000 zImage.img ; bootm 0x21000000"
+
  save
save
+
}}}
+
  
 
=== Get the Linux kernel from tftp (using DHCP), and launch it ===
 
=== Get the Linux kernel from tftp (using DHCP), and launch it ===
  * the kernel image (zImage.img) is at the root of the tftp server
+
* the kernel image (zImage.img) is at the root of the tftp server
  * the tftp server IP is 153.109.5.233
+
* the tftp server IP is 153.109.5.233
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
* don't forget to set the LinuxCommandLine in the '''bootargs''' variable
{{{
+
  set serverip 153.109.5.233
set serverip 153.109.5.233
+
  setenv bootcmd "bootp 0x21000000 zImage.img ; bootm 0x21000000"
setenv bootcmd "bootp 0x21000000 zImage.img ; bootm 0x21000000"
+
  save
save
+
}}}
+
  
 
=== Get the Linux kernel from flash, and launch it ===
 
=== Get the Linux kernel from flash, and launch it ===
  * The kernel image is supposed to be flashed at 0x10060000
+
* The kernel image is supposed to be flashed at 0x10060000
    * Download the kernel to ram (using tftp for intance)
+
* Download the kernel to ram (using tftp for intance)
    * Flash it
+
* Flash it
{{{
+
  erase 0x10060000 +0x200000
erase 0x10060000 +0x200000
+
  cp.b 0x21000000 0x10060000 0x200000
cp.b 0x21000000 0x10060000 0x200000
+
* don't forget to set the LinuxCommandLine in the '''bootargs''' variable
}}}
+
  setenv bootcmd "bootm 0x10060000"
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
  save
{{{
+
setenv bootcmd "bootm 0x10060000"
+
save
+
}}}
+
  
 
=== Get the Linux kernel from an USB key, and launch it ===
 
=== Get the Linux kernel from an USB key, and launch it ===
  * The USB key must be FAT16 formated, without partitions
+
* The USB key must be FAT16 formated, without partitions
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
* don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
{{{
+
  set bootcmd "usb start ; fatload usb 0 0x21000000 zImage.img ; bootm 0x21000000"
set bootcmd "usb start ; fatload usb 0 0x21000000 zImage.img ; bootm 0x21000000"
+
}}}
+
  
 
== Configuration ==  
 
== Configuration ==  
The first time you start '''u-boot''' there is some things to configure. [[BR]]
+
The first time you start '''u-boot''' there are some things to configure.
Connect with a terminal emulator on the first serial port (115200,8,n,1). [[BR]]
+
 
 +
Connect with a terminal emulator on the first serial port (115200,8,n,1).
  
 
=== Basic commands ===
 
=== Basic commands ===
 
here is a small list of usefull commands:
 
here is a small list of usefull commands:
  help::
+
*help
    give you help for built-in commands (without argument, display a list of all commands)
+
give you help for built-in commands (without argument, display a list of all commands)
  bmp::
+
* bmp
    used to display a bmp on the screen (example: '''bmp 0x10f00000''' will display the bitmap at address 0x10f00000). This command support standard bmp or gzipped bmp, and it's possible to  
+
used to display a bmp on the screen (example: '''bmp 0x10f00000''' will display the bitmap at address 0x10f00000). This command support standard bmp or gzipped bmp, and it's possible to  
  usb::
+
* usb
    used to manage usb for  instance: '''usb start''', then '''usb storage''' to see which storage has been attached
+
used to manage usb for  instance: '''usb start''', then '''usb storage''' to see which storage has been attached
  fatload::
+
* fatload
    load a file from a fat file system into memory, example : '''fatload usb 0 0x21000000 linux.img''' will load the linux kernel image at 0x21000000, don't forget to do '''usb start''' before that :-),  
+
load a file from a fat file system into memory, example : '''fatload usb 0 0x21000000 linux.img''' will load the linux kernel image at 0x21000000, don't forget to do '''usb start''' before that :-),  
  erase::
+
* erase
    erase flash, for instance '''erase 0x10060000 +0x200000''' for erasing flash from 0x10060000 to 0x10260000
+
erase flash, for instance '''erase 0x10060000 +0x200000''' for erasing flash from 0x10060000 to 0x10260000
  cp![.size]::
+
* cp![.size]
    copy from memory to memory (or to flash), for intsance '''cp.b 0x21000000 0x10060000 0x200000''' for copying 0x20000 byte from 0x21000000 (SDRAM) to 0x10060000 (flash)
+
copy from memory to memory (or to flash), for intsance '''cp.b 0x21000000 0x10060000 0x200000''' for copying 0x20000 byte from 0x21000000 (SDRAM) to 0x10060000 (flash)
  
 
u-boot works with environment variable for storing configuration option, and here are the basic commands for setting/reading variables:
 
u-boot works with environment variable for storing configuration option, and here are the basic commands for setting/reading variables:
  * setting a variable (v1)  
+
* setting a variable (v1)  
{{{
+
  setenv toto hello world
#!shell
+
  toto=hello world
#u U-Boot> '''%r'''
+
u setenv toto hello world
+
toto=hello world
+
}}}
+
  
  * printing a variable (v1)  
+
* printing a variable (v1)  
{{{
+
  printenv toto
#!shell
+
  toto=hello world
#u U-Boot> '''%r'''
+
u printenv toto
+
toto=hello world
+
}}}
+
  
  * printing a variable (v2)  
+
* printing a variable (v2)  
{{{
+
  echo ${toto}
#!shell
+
  hello world
#u U-Boot> '''%r'''
+
u echo ${toto}
+
hello world
+
}}}
+
  
  * saving variables (to flash)
+
* saving variables (to flash)
{{{
+
  saveenv
#!shell
+
  Saving Environment to Flash...
#u U-Boot> '''%r'''
+
  Un-Protected 1 sectors
u saveenv
+
  Erasing Flash...
Saving Environment to Flash...
+
  .done
Un-Protected 1 sectors
+
  Erased 1 sectors
Erasing Flash...
+
  Writing to Flash... .
. done
+
  done
Erased 1 sectors
+
  Protected 1 sectors
Writing to Flash... .
+
done
+
Protected 1 sectors
+
}}}
+
  
 
=== Well known variables ===
 
=== Well known variables ===
u-boot uses some known variables names for it's own use, here is an overview (see also [source:u-boot/trunk/README u-boot README])
+
u-boot uses some known variables names for it's own use, here is an overview.
board ('''armebs3''' specific) and '''protected*''' variable ::  
+
* board ('''armebs3''' specific) and '''protected*''' variable :
  name (type of the board), used to init board specific hardware. u-boot is compiled to support ALL ARMEBS3 based board and uses this variable to know which board it is running on. possible values are : '''armebs3''', '''ipresenter''', '''sidney''', '''proto'''.  
+
name (type of the board), used to init board specific hardware. u-boot is compiled to support ALL ARMEBS3 based board and uses this variable to know which board it is running on. possible values are : '''armebs3''', '''ipresenter''', '''sidney''', '''proto'''.  
 
+
* ethadd '''protected*''' variable
ethadd '''protected*''' variable::
+
Ethernet address, '''MUST''' be set-up for boards using network, example : '''setenv ethaddr 00:00:17:00:00:00'''.
  Ethernet address, '''MUST''' be set-up for boards using network, example : '''setenv ethaddr 00:00:17:00:00:00'''.
+
* boot-delay
 
+
delay after reset before the bootcmp is run
bootdelay::
+
* bootcmd
  delay after reset before the bootcmp is run
+
command to run automatically after a reset, example : '''setenv bmp display 0x10f00000 \; bootm 0x10060000''' to diplay the bitmap located at 0x10f00000 and run the software from 0x10060000. unset it (setenv bootcmd) to do nothing at boot.
bootcmd::
+
* bootargs (see also [wiki:LinuxCommandLine linux command line])
  command to run automatically after a reset, example : '''setenv bmp display 0x10f00000 \; bootm 0x10060000''' to diplay the bitmap located at 0x10f00000 and run the software from 0x10060000. unset it (setenv bootcmd) to do nothing at boot.
+
boot arguments, passed to the application to be run (at least passed to linux as the kernel command line), example '''setenv bootargs root=1f03 ro rootfstype=romfs console=ttyS0,9600 video=s1d13x06fb:crt,mode:800x600-16'''
bootargs (see also [wiki:LinuxCommandLine linux command line])::
+
* baudrate
  boot arguments, passed to the application to be run (at least passed to linux as the kernel command line), example '''setenv bootargs root=1f03 ro rootfstype=romfs console=ttyS0,9600 video=s1d13x06fb:crt,mode:800x600-16'''
+
The baudrate for the console
baudrate::
+
  the baudrate for the console
+
  
 
'''*protected variables''' can only be set once. To reset this variables, the flash configuration area must be erased and the system rebooted ('''flash protect off all ; erase 0x10040000 + 0x20000 ; boot'''), then the protected variables can be set again.
 
'''*protected variables''' can only be set once. To reset this variables, the flash configuration area must be erased and the system rebooted ('''flash protect off all ; erase 0x10040000 + 0x20000 ; boot'''), then the protected variables can be set again.
 +
 
== compiling/installing ==
 
== compiling/installing ==
  * checkout the sources from !https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk ([source:u-boot/trunk view])
+
* checkout the sources from https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk
{{{
+
  cd /opt/armebs3
#!shell
+
  /opt/armebs3 snv checkout !https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk u-boot
u anywhere cd /opt/armebs3
+
  ...
u /opt/armebs3 snv checkout !https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk u-boot
+
 
...
+
* compile it
u /opt/armebs3
+
  /opt/armebs3 cd u-boot
}}}
+
  /opt/armebs3/u-boot make armebs3_config
  * compile it
+
  ...
{{{
+
  /opt/armebs3/u-boot make
#!shell
+
  ...
u /opt/armebs3 cd u-boot
+
  /opt/armebs3/u-boot
u /opt/armebs3/u-boot make armebs3_config
+
 
...
+
* flash it
u /opt/armebs3/u-boot make
+
  /opt/armebs3/u-boot cp u-boot.bin /opt/armebs3/tftp
...
+
  reset
u /opt/armebs3/u-boot
+
  mm 0xfffffc20  0x0000ff01
}}}
+
  mm 0xffffff70  0x000030ff
  * flash it
+
  mm 0xfffffc30  0x00000001
{{{
+
  unlock 0x10000000 0x20000 2
#!shell
+
  erase 0x10000000 0x20000 2
#u devuser@devmachine %w > '''%r'''
+
  Erasing flash at 0x10000000
#r '''root'''@devmachine {{{  }}} %w > '''%r'''
+
  Erasing flash at 0x10020000
#tr '''root'''@target %w > r'''%r'''
+
  Erasing flash passed
#b (on the bdi) armebs3> '''%r'''
+
  prog 0x10000000 u-boot.bin bin
#rb (on the bdi) ''%r''
+
  Programming u-boot.bin , please wait ....
u /opt/armebs3/u-boot cp u-boot.bin /opt/armebs3/tftp
+
  Programming flash passed
b reset
+
b mm 0xfffffc20  0x0000ff01
+
b mm 0xffffff70  0x000030ff
+
b mm 0xfffffc30  0x00000001
+
b unlock 0x10000000 0x20000 2
+
b erase 0x10000000 0x20000 2
+
rb Erasing flash at 0x10000000
+
rb Erasing flash at 0x10020000
+
rb Erasing flash passed
+
b prog 0x10000000 u-boot.bin bin
+
rb Programming u-boot.bin , please wait ....
+
rb Programming flash passed
+
}}}
+
  
 
== u-boot, step by step, file by file ==
 
== u-boot, step by step, file by file ==
 
here is a small overview of what is done in which file
 
here is a small overview of what is done in which file
  * [source:/u-boot/trunk/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S]
+
* /u-boot/trunk/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S
    * reset vectors -> reset
+
** reset vectors -> reset
    * reset
+
** reset
      * do cpu init
+
*** do cpu init
      * call lowlevel_init from [source:/u-boot/trunk/cpu/arm920t/at91rm9200/lowlevel_init.S u-boot/cpu/arm920t/at91rm9200/lowlevel_init.S]
+
*** call lowlevel_init from [source:/u-boot/trunk/cpu/arm920t/at91rm9200/lowlevel_init.S u-boot/cpu/arm920t/at91rm9200/lowlevel_init.S]
        * init sdram, chip select, ...
+
**** init sdram, chip select, ...
      * relocates to sdram, setup stack, clear bss section
+
*** relocates to sdram, setup stack, clear bss section
      * jump to start_armboot (relocated)
+
*** jump to start_armboot (relocated)
    * start_armboot from [source:/u-boot/trunk/lib_arm/board.c u-boot/cpu/arm920t/lib_arm/board.c]
+
*** start_armboot from [source:/u-boot/trunk/lib_arm/board.c u-boot/cpu/arm920t/lib_arm/board.c]
      * init global data sturcture (gd)
+
**** init global data sturcture (gd)
      * call every functions from the init_sequence[] table
+
**** call every functions from the init_sequence[] table
        * basic cpu dependent setup    cpu_init [source:/u-boot/trunk/cpu/arm920t/cpu.c u-boot/cpu/arm920t/cpu.c]
+
***** basic cpu dependent setup    cpu_init [source:/u-boot/trunk/cpu/arm920t/cpu.c u-boot/cpu/arm920t/cpu.c]
        * basic board dependent setup  board_init [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]                       
+
***** basic board dependent setup  board_init [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]                       
        * set up exceptions            interrupt_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/interrupts.c u-boot/cpu/arm920t/at91rm9200/interrupts.c]
+
***** set up exceptions            interrupt_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/interrupts.c u-boot/cpu/arm920t/at91rm9200/interrupts.c]
        * initialize environment        env_init [source:/u-boot/trunk/common/env_flash.c u-boot/common/env_flash.c]
+
***** initialize environment        env_init [source:/u-boot/trunk/common/env_flash.c u-boot/common/env_flash.c]
        * initialze baudrate settings  init_baudrate [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
+
***** initialze baudrate settings  init_baudrate [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
        * serial communications setup  serial_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/serial.c u-boot/cpu/arm920t/at91rm9200/serial.c]
+
***** serial communications setup  serial_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/serial.c u-boot/cpu/arm920t/at91rm9200/serial.c]
        * stage 1 init of console      console_init_f [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]
+
***** stage 1 init of console      console_init_f [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]
        * say that we are here          display_banner [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
+
***** say that we are here          display_banner [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
        * configure available RAM banks dram_init (only setup how many sdram is here for u-boot, no sdram initialization) [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]   
+
***** configure available RAM banks dram_init (only setup how many sdram is here for u-boot, no sdram initialization) [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]   
        * display dram info            display_dram_config [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
+
***** display dram info            display_dram_config [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
      * ...
+
**** ...
      * run u-boot
+
**** run u-boot
  
 
== External link(s) ==
 
== External link(s) ==
here is the u-boot home page: [http://u-boot.sourceforge.net/ http://u-boot.sourceforge.net/].
+
here is the u-boot home page: [http://u-boot.sourceforge.net/].
 +
 
 +
[[Category:Hardware]] [[Category:ARMEBS]]

Latest revision as of 14:43, 26 June 2015

Contents

u-boot

This page is only for kernel older than 2.6.26, for newer kernels, see Hardware/ARMEBS/3/u-boot

u-boot is a bootloader, we've choosen it because it supports usb and network operations. It has been adapted to support our board, especially an Hardware/ARMEBS/3/AutoUpdate auto-update function, using an USB flash drive. As any bootloader, u-boot can be used (and this is it's main purpose) to start another program (or operating system), for instance Linux. The application we want to run must be in a special form called image and can be generated using mkimage (in u-boot/tools/), for instance generating a Linux kernel image is done using the following command :

 mkimage -A ARM -T kernel -C none -O Linux -a 0x20008000 -d /opt/armebs3/linux-2.6.15/output/arch/arm/boot/zImage linux.img

After r641 of our Linux kernel, make zImage.img will build this image for you.

Automatic startup bootcmd

At boot, u-boot do this:

  • By default, it runs the command in the bootcmd variable.
  • If the first button (S1 on the ARMEBS3) is pressed, it tries to do AutoUpdate on the USB key. If it fails, it runs bootcmd.
  • If the third button (S3 on the ARMEBS3) is pressed, it jumps to 0x10060000, after disabling instruction cache.

Settings for the technical informatics laboratories

The instruction cache must be shut-down before downloading a software via the JTAG interface.

 set bootcmd icache off
 save


Get the Linux kernel from tftp (using a static ip address), and launch it

  • the kernel image (zImage.img) is at the root of the tftp server
  • the tftp server IP is 153.109.5.233
  • the armebs3 IP is 153.109.5.232
  • don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
 set ipaddr 153.109.5.232
 set serverip 153.109.5.233
 setenv bootcmd "tftpboot 0x21000000 zImage.img ; bootm 0x21000000"
 save

Get the Linux kernel from tftp (using DHCP), and launch it

  • the kernel image (zImage.img) is at the root of the tftp server
  • the tftp server IP is 153.109.5.233
  • don't forget to set the LinuxCommandLine in the bootargs variable
 set serverip 153.109.5.233
 setenv bootcmd "bootp 0x21000000 zImage.img ; bootm 0x21000000"
 save

Get the Linux kernel from flash, and launch it

  • The kernel image is supposed to be flashed at 0x10060000
  • Download the kernel to ram (using tftp for intance)
  • Flash it
 erase 0x10060000 +0x200000
 cp.b 0x21000000 0x10060000 0x200000
  • don't forget to set the LinuxCommandLine in the bootargs variable
 setenv bootcmd "bootm 0x10060000"
 save

Get the Linux kernel from an USB key, and launch it

  • The USB key must be FAT16 formated, without partitions
  • don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
 set bootcmd "usb start ; fatload usb 0 0x21000000 zImage.img ; bootm 0x21000000"

Configuration

The first time you start u-boot there are some things to configure.

Connect with a terminal emulator on the first serial port (115200,8,n,1).

Basic commands

here is a small list of usefull commands:

  • help

give you help for built-in commands (without argument, display a list of all commands)

  • bmp

used to display a bmp on the screen (example: bmp 0x10f00000 will display the bitmap at address 0x10f00000). This command support standard bmp or gzipped bmp, and it's possible to

  • usb

used to manage usb for instance: usb start, then usb storage to see which storage has been attached

  • fatload

load a file from a fat file system into memory, example : fatload usb 0 0x21000000 linux.img will load the linux kernel image at 0x21000000, don't forget to do usb start before that :-),

  • erase

erase flash, for instance erase 0x10060000 +0x200000 for erasing flash from 0x10060000 to 0x10260000

  • cp![.size]

copy from memory to memory (or to flash), for intsance cp.b 0x21000000 0x10060000 0x200000 for copying 0x20000 byte from 0x21000000 (SDRAM) to 0x10060000 (flash)

u-boot works with environment variable for storing configuration option, and here are the basic commands for setting/reading variables:

  • setting a variable (v1)
 setenv toto hello world
 toto=hello world
  • printing a variable (v1)
 printenv toto
 toto=hello world
  • printing a variable (v2)
 echo ${toto}
 hello world
  • saving variables (to flash)
 saveenv
 Saving Environment to Flash...
 Un-Protected 1 sectors
 Erasing Flash...
 .done
 Erased 1 sectors
 Writing to Flash... .
 done
 Protected 1 sectors

Well known variables

u-boot uses some known variables names for it's own use, here is an overview.

  • board (armebs3 specific) and protected* variable :

name (type of the board), used to init board specific hardware. u-boot is compiled to support ALL ARMEBS3 based board and uses this variable to know which board it is running on. possible values are : armebs3, ipresenter, sidney, proto.

  • ethadd protected* variable

Ethernet address, MUST be set-up for boards using network, example : setenv ethaddr 00:00:17:00:00:00.

  • boot-delay

delay after reset before the bootcmp is run

  • bootcmd

command to run automatically after a reset, example : setenv bmp display 0x10f00000 \; bootm 0x10060000 to diplay the bitmap located at 0x10f00000 and run the software from 0x10060000. unset it (setenv bootcmd) to do nothing at boot.

  • bootargs (see also [wiki:LinuxCommandLine linux command line])

boot arguments, passed to the application to be run (at least passed to linux as the kernel command line), example setenv bootargs root=1f03 ro rootfstype=romfs console=ttyS0,9600 video=s1d13x06fb:crt,mode:800x600-16

  • baudrate

The baudrate for the console

*protected variables can only be set once. To reset this variables, the flash configuration area must be erased and the system rebooted (flash protect off all ; erase 0x10040000 + 0x20000 ; boot), then the protected variables can be set again.

compiling/installing

 cd /opt/armebs3
 /opt/armebs3 snv checkout !https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk u-boot
 ...
  • compile it
 /opt/armebs3 cd u-boot
 /opt/armebs3/u-boot make armebs3_config
 ...
 /opt/armebs3/u-boot make
 ...
 /opt/armebs3/u-boot
  • flash it
 /opt/armebs3/u-boot cp u-boot.bin /opt/armebs3/tftp
 reset
 mm 0xfffffc20  0x0000ff01
 mm 0xffffff70  0x000030ff
 mm 0xfffffc30  0x00000001
 unlock 0x10000000 0x20000 2
 erase 0x10000000 0x20000 2
 Erasing flash at 0x10000000
 Erasing flash at 0x10020000
 Erasing flash passed
 prog 0x10000000 u-boot.bin bin
 Programming u-boot.bin , please wait ....
 Programming flash passed

u-boot, step by step, file by file

here is a small overview of what is done in which file

  • /u-boot/trunk/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S
    • reset vectors -> reset
    • reset
      • do cpu init
      • call lowlevel_init from [source:/u-boot/trunk/cpu/arm920t/at91rm9200/lowlevel_init.S u-boot/cpu/arm920t/at91rm9200/lowlevel_init.S]
        • init sdram, chip select, ...
      • relocates to sdram, setup stack, clear bss section
      • jump to start_armboot (relocated)
      • start_armboot from [source:/u-boot/trunk/lib_arm/board.c u-boot/cpu/arm920t/lib_arm/board.c]
        • init global data sturcture (gd)
        • call every functions from the init_sequence[] table
          • basic cpu dependent setup cpu_init [source:/u-boot/trunk/cpu/arm920t/cpu.c u-boot/cpu/arm920t/cpu.c]
          • basic board dependent setup board_init [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]
          • set up exceptions interrupt_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/interrupts.c u-boot/cpu/arm920t/at91rm9200/interrupts.c]
          • initialize environment env_init [source:/u-boot/trunk/common/env_flash.c u-boot/common/env_flash.c]
          • initialze baudrate settings init_baudrate [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
          • serial communications setup serial_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/serial.c u-boot/cpu/arm920t/at91rm9200/serial.c]
          • stage 1 init of console console_init_f [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]
          • say that we are here display_banner [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
          • configure available RAM banks dram_init (only setup how many sdram is here for u-boot, no sdram initialization) [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]
          • display dram info display_dram_config [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
        • ...
        • run u-boot

External link(s)

here is the u-boot home page: [1].

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox