Difference between revisions of "BootLoader"

From ArmadeusWiki
Jump to: navigation, search
(Introduction)
Line 28: Line 28:
  
 
Device 0: NAND 256MiB 1,8V 16-bit, sector size 128 KiB
 
Device 0: NAND 256MiB 1,8V 16-bit, sector size 128 KiB
</pre>
 
 
<pre class="apf">
 
BIOS> i2c probe
 
Valid chip addresses: 38 39 3F 50 51 52 53 54 55 56 57 7F
 
Excluded chip addresses:
 
 
</pre>
 
</pre>
  
Line 47: Line 41:
 
  setenv ipaddr 192.168.0.10
 
  setenv ipaddr 192.168.0.10
 
  setenv serverip 192.168.0.2                (the IP address of your TFTP Host server to download image files)
 
  setenv serverip 192.168.0.2                (the IP address of your TFTP Host server to download image files)
  setenv rootpath "/tftpboot/apf9328-root"    (to boot Linux over NFS)
+
  setenv rootpath "/tftpboot/apfXX-root"    (to boot Linux over NFS)
 
</pre>
 
</pre>
 
* You can use the '''dhcp''' command to configure these variable from your DHCP server. Probably you will have to adjust the '''serverip''' variable manually.
 
* You can use the '''dhcp''' command to configure these variable from your DHCP server. Probably you will have to adjust the '''serverip''' variable manually.
Line 65: Line 59:
 
Build process is now part of the Armadeus automated build (see [[Toolchain | Install Armadeus software]]). To only build U-Boot you can launch:
 
Build process is now part of the Armadeus automated build (see [[Toolchain | Install Armadeus software]]). To only build U-Boot you can launch:
 
<pre class="host">
 
<pre class="host">
  $ make u-boot-clean
+
  $ make uboot-rebuild
$ make u-boot
+
 
</pre>
 
</pre>
  
 
===Binaries===
 
===Binaries===
Compiled binary files will be put in the ''buildroot/binaries/apfxx/'' subdirectory:
+
Compiled binary files will be put in the ''buildroot/output/images/'' subdirectory:
 
* '''apfxx-u-boot.bin''' is a binary image file that can be downloaded and flashed from U-Boot itself (see below)
 
* '''apfxx-u-boot.bin''' is a binary image file that can be downloaded and flashed from U-Boot itself (see below)
* '''apf9328-u-boot-brec''' is a boostrap record file compatible with the [[BootStrap | Freescale bootstrap]] inside the i.MXL (only when compiling for [[APF9328]]).
 
  
 
===Customizing===
 
===Customizing===
Line 80: Line 72:
  
 
*Configuration file (target specific) used to customize the build is:
 
*Configuration file (target specific) used to customize the build is:
** ''buildroot/target/device/armadeus/apfxx/apfxx.h''
+
** ''buildroot/target/device/armadeus/apfxx/apfxx-u-boot-<version>.h''
  
 
==Install or restore from scratch (board bricked)==
 
==Install or restore from scratch (board bricked)==
Line 93: Line 85:
 
There are 2 steps to update U-Boot:
 
There are 2 steps to update U-Boot:
 
*1] Load the new U-Boot code in RAM (You can use the following commands to download U-boot):
 
*1] Load the new U-Boot code in RAM (You can use the following commands to download U-boot):
**With ethernet and a [[Connection_with_U-Boot_on_Linux#TFTP_server |TFTP server]]: <pre class="apf">BIOS> tftpboot ${loadaddr} apfxx-u-boot.bin</pre>
+
**With ethernet and a [[Connection_with_U-Boot_on_Linux#TFTP_server |TFTP server]]: <pre class="apf">BIOS>run download_uboot</pre>
**With ethernet and a [[Network_Configuration | NFS server]]: <pre class="apf">BIOS> nfs ${loadaddr} ${serverip}:/nfs_path_to_buildroot/apfxx-u-boot.bin</pre>
+
**With ethernet and a [[Network_Configuration | NFS server]]: <pre class="apf">BIOS> nfs ${loadaddr} ${serverip}:/tftpboot/apfxx-u-boot.bin</pre>
 
**With the kermit and a serial line:  
 
**With the kermit and a serial line:  
 
<pre class="apf">
 
<pre class="apf">
Line 113: Line 105:
 
The command "boot" is the common way to run Linux from flash memory.
 
The command "boot" is the common way to run Linux from flash memory.
 
This command is equivalent to the macro:
 
This command is equivalent to the macro:
 +
- on the APF9328 board
 
<pre class="apf">
 
<pre class="apf">
 
BIOS> run jffsboot
 
BIOS> run jffsboot
 +
</pre>
 +
- on the other APF board
 +
<pre class="apf">
 +
BIOS> run ubifsboot
 
</pre>
 
</pre>
  
Line 121: Line 118:
 
BIOS> printenv bootcmd
 
BIOS> printenv bootcmd
 
bootcmd=run jffsboot
 
bootcmd=run jffsboot
 +
or
 +
bootcmd=run ubifsboot
 
</pre>
 
</pre>
 
U-Boot also supports the commands to boot from the network or a SD/MMC card.
 
U-Boot also supports the commands to boot from the network or a SD/MMC card.
Line 130: Line 129:
 
This command boots Linux rootfs from a NFS server. Change the U-Boot variables ''serverip'' and ''rootpath'' to fit with your host PC.
 
This command boots Linux rootfs from a NFS server. Change the U-Boot variables ''serverip'' and ''rootpath'' to fit with your host PC.
 
     serverip=192.168.0.2
 
     serverip=192.168.0.2
     rootpath="/tftpboot/apf9328-root"
+
     rootpath="/tftpboot/apfXX-root"
  
 
* MMC/SD boot
 
* MMC/SD boot
Line 136: Line 135:
 
BIOS> run mmcboot
 
BIOS> run mmcboot
 
</pre>
 
</pre>
This command boots Linux rootfs from an sd/mmc memory card. Adapt the variables: ''mmcroot'' and ''mmcrootfstype'' to your card's boot partition type.
 
    mmcroot=/dev/mmcblk0p1
 
    mmcrootfstype=ext2
 
  
==Customize the flash memory organization==
 
TBD
 
 
== Installing Target software from U-Boot ==
 
== Installing Target software from U-Boot ==
  

Revision as of 17:54, 1 April 2012

Introduction

This page describe the U-Boot usage/installation in the Armadeus context.

Some (informational) commands

BIOS> printenv
BIOS> bdinfo
arch_number = 0x000006A2
env_t       = 0x00000000
boot_params = 0xA0000100
DRAM bank   = 0x00000000
-> start    = 0xA0000000
-> size     = 0x04000000
DRAM bank   = 0x00000001
-> start    = 0xB0000000
-> size     = 0x04000000
ethaddr     = 00:1E:AC:00:10:54
ip_addr     = 192.168.1.10
baudrate    = 115200 bps
BIOS> nand info

Device 0: NAND 256MiB 1,8V 16-bit, sector size 128 KiB

Modify your environment variables

  • There is a set of variables you can customize to your needs. The command printenv show you most of them and their current state. Use the command setenv to change one of these variable. For instance:
 BIOS> setenv ipaddr 192.168.0.10
  • Use the command saveenv to save the state of your environment variables in flash memory.
  • In order to use network features with U-Boot you have to set the network environment variables:
 setenv netmask 255.255.255.0                (default value should be fine in most situations)
 setenv ipaddr 192.168.0.10
 setenv serverip 192.168.0.2                 (the IP address of your TFTP Host server to download image files)
 setenv rootpath "/tftpboot/apfXX-root"    (to boot Linux over NFS)
  • You can use the dhcp command to configure these variable from your DHCP server. Probably you will have to adjust the serverip variable manually.
 BIOS> dhcp
 dm9000 i/o: 0x15c00000, id: 0x90000a46
 MAC: 00:0e:32:00:00:01
 operating at 100M full duplex mode
 BOOTP broadcast 1
 DHCP client bound to address 192.168.0.10
 BIOS>setenv serverip 192.168.0.2
 BIOS>saveenv
  • Do not forget to save your changes in flash with saveenv to have them available at power up !

Build U-Boot

Build process is now part of the Armadeus automated build (see Install Armadeus software). To only build U-Boot you can launch:

 $ make uboot-rebuild

Binaries

Compiled binary files will be put in the buildroot/output/images/ subdirectory:

  • apfxx-u-boot.bin is a binary image file that can be downloaded and flashed from U-Boot itself (see below)

Customizing

  • U-Boot build is done by the following Makefiles:
    • buildroot/target/u-boot/Makefile.in (generic part)
    • buildroot/target/device/armadeus/u-boot/u-boot.mk (target specific part)
  • Configuration file (target specific) used to customize the build is:
    • buildroot/target/device/armadeus/apfxx/apfxx-u-boot-<version>.h

Install or restore from scratch (board bricked)

If your Armadeus board doesn't boot anymore (flash content erased or dammaged), you will have to use the bootstrap mode of the i.MX.
In that case the uboot_recover python script is used to flash a new U-Boot version; this tool is located in the armadeus/software/uboot_recover/ folder of the Armadeus project tree.
Take a look a the INSTALL file the first time you want to use the recover tool.
Remark: the serial port must support a baud rate of 57600 bps per second.

Update U-Boot

There are 2 steps to update U-Boot:

  • 1] Load the new U-Boot code in RAM (You can use the following commands to download U-boot):
    • With ethernet and a TFTP server:
      BIOS>run download_uboot
    • With ethernet and a NFS server:
      BIOS> nfs ${loadaddr} ${serverip}:/tftpboot/apfxx-u-boot.bin
    • With the kermit and a serial line:
BIOS> loadb ${loadaddr}
    <CTRL> <ALT GR> \ then c
    send /path_to_tftpboot/apfxx-u-boot.bin
    ...>>> LOADING IN PROGRESS <<<...
    c
  • 2] Transfer code from RAM to FLASH memory (there is a simple U-Boot command/script to do that):
 BIOS> run flash_uboot

Advanced Linux boot

The command "boot" is the common way to run Linux from flash memory. This command is equivalent to the macro: - on the APF9328 board

BIOS> run jffsboot

- on the other APF board

BIOS> run ubifsboot

This is the default command stored in the U-Boot variable: bootcmd.

BIOS> printenv bootcmd
bootcmd=run jffsboot
or
bootcmd=run ubifsboot 

U-Boot also supports the commands to boot from the network or a SD/MMC card.

  • NFS boot
BIOS> run nfsboot

This command boots Linux rootfs from a NFS server. Change the U-Boot variables serverip and rootpath to fit with your host PC.

   serverip=192.168.0.2
   rootpath="/tftpboot/apfXX-root"
  • MMC/SD boot
BIOS> run mmcboot

Installing Target software from U-Boot

Target Software Installation

Booting Linux

The Install Armadeus software on target provide some information to install linux on Armadeus board

Customize Linux boot mode

Typical Kermit (.kermrc) config file

set line /dev/ttyS0
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5
set transmit linefeed on

Links