Boot media (SBC-i.MX51)

Aus BECOM Systems Support
Version vom 31. Oktober 2023, 09:03 Uhr von Peter (Diskussion | Beiträge) (1 Version importiert)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

General idea

The SBC supports booting from multiple media. The following is just a guideline - of course you are free to take whatever path you want.

For the initial setup, the easiest way is to write the boot loader and the root file system to an SD card. You can then boot from this SD card and subsequently e.g. set up the NAND flash for booting.

In case you need to update the boot loader you can do this from the already running boot loader. In case this goes wrong, you can go back to SD card to boot the "old but working" one.

The other modes are mainly used for production or special applications (using the Freescale ATK Tool).

Boot mode pins

The boot mode pins define from which source the i.MX51 will boot. You can change these by setting the DIP switches on the board accordingly.

Booting from SD card

Dip switch setup:

{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: | | }}{{#if: | | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: | {{#ifeq: {{{9}}} | 1 | | {{#ifeq: {{{9}}} | X | | }} }} | }}{{#if: | {{#ifeq: {{{10}}} | 1 | | {{#ifeq: {{{10}}} | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: | {{#ifeq: {{{9}}} | 0 | | {{#ifeq: {{{9}}} | X | | }} }} | }}{{#if: | {{#ifeq: {{{10}}} | 0 | | {{#ifeq: {{{10}}} | X | | }} }} | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: | | }}{{#if: | | }}
1234567890

Setting up a bootable SD card

The easiest way to set up a bootable SD card is to use the following script:

btmxc/scripts/sd_card_setup.sh

It uses the SD card's device file as first argument, and the type of image as second argument, e.g.

btmxc/scripts/sd_card_setup.sh /dev/sde gnome

It assumes that you have built everything (Redboot, Linux zImage, Linux rootfs image) before. It will also set up the Redboot configuration and generate a random MAC address. If anything goes wrong, it will output error messages. The script was successfully tested on Ubuntu 9.04, 9.10, and 10.04 LTS.

WARNING! The script executes several commands as root by running sudo. Double-check that you give the correct device file to the script, e.g. by looking at the dmesg output after inserting the card. You may damage content of your hard disk!

What the script will do:

  • Write Redboot to the SD card, including the FIS, configuration data, and logo
  • Write the Linux kernel to the SD card
  • Create a partition and format it with EXT3
  • Unpacks the root file system into the partition
  • Unmounts the card

If the script tells you that it was successful, you can remove the card and use it for the SBC.

Redboot configuration

RedBoot> fconfig -l
Run script at boot: true
Boot script: 
.. sdhc 0 0x100000 0x100000 0x300000 r
.. e -b 0x100000 -l 0x300000 -c "console=ttymxc0,115200 console=tty1 root=/dev/mmcblk0p1 psplash=false rootdelay=1 display=hdmi:1024x768M-16@60"

Boot script timeout (1000ms resolution): 0
Use BOOTP for network configuration: true
Default server IP address: 0.0.0.0
Board specifics: 0
Console baud rate: 115200
Enable fast logo display at boot: true
Set FEC network hardware address [MAC]: true
FEC network hardware address [MAC]: 0x6A:0x50:0x69:0x7F:0x26:0x8E
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
RedBoot> 

Booting from NAND flash

This is the default boot mode for the SBC.

Dip switch setup:

{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 1 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: 1 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: | | }}{{#if: | | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: | {{#ifeq: {{{9}}} | 1 | | {{#ifeq: {{{9}}} | X | | }} }} | }}{{#if: | {{#ifeq: {{{10}}} | 1 | | {{#ifeq: {{{10}}} | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: | {{#ifeq: {{{9}}} | 0 | | {{#ifeq: {{{9}}} | X | | }} }} | }}{{#if: | {{#ifeq: {{{10}}} | 0 | | {{#ifeq: {{{10}}} | X | | }} }} | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 1 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: 1 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: | | }}{{#if: | | }}
1234567890

Setting up the NAND flash with a bootable SD card

The easiest way to set up the NAND flash is booting up with an SD card and executing the setup in Linux. We have made a little script that copies the necessary files to the SD card. It assumes that you already have a bootable SD card (see above).

btmxc/scripts/prepare_for_nand_setup.sh

It uses the SD card's mount directory as first argument and the type of image as second argument, e.g.

btmxc/scripts/sd_card_setup_for_nand_setup.sh /media/disk gnome

It assumes that you have built everything (Redboot, Linux zImage, Linux rootfs image) before. It will also set up the Redboot configuration and generate a valid random MAC address. If anything goes wrong, it will output error messages. The script was successfully tested on Ubuntu 9.0.4 and Ubuntu 9.0.10.

WARNING! The script executes several commands as root by running sudo.

After you have booted the SBC-i.MX51 with that SD card, you have to execute /home/root/nand_setup/nand_setup.sh. This sets up the NAND flash. Afterwards, cleanly shutdown Linux, switch the boot mode to NAND and power up the SBC.

Redboot default configuration

RedBoot> fconfig -l
Run script at boot: true
Boot script: 
.. fis load kernel
.. e -c "console=ttymxc0,115200 console=tty1 root=/dev/mtdblock2 rootfstype=jffs2 psplash=false display=hdmi:1024x768M-16@60"

Boot script timeout (1000ms resolution): 0
Use BOOTP for network configuration: false
Gateway IP address: 0.0.0.0
Local IP address: 0.0.0.0
Local IP address mask: 0.0.0.0
Default server IP address: 0.0.0.0
Board specifics: 0
Console baud rate: 115200
Enable fast logo display at boot: true
Set FEC network hardware address [MAC]: true
FEC network hardware address [MAC]: 0x1A:0x4A:0xC1:0xE5:0x69:0x38
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
RedBoot> 


Boot from UART/USB

The i.MX51 processor can boot from UART (UART1) or USB (USB-OTG). This is also the fall-back boot mode if boot from another media fails.

DIP switch setup:

{{#if: 1 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: | | }}{{#if: | | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 1 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 1 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: | {{#ifeq: {{{9}}} | 1 | | {{#ifeq: {{{9}}} | X | | }} }} | }}{{#if: | {{#ifeq: {{{10}}} | 1 | | {{#ifeq: {{{10}}} | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 1 | {{#ifeq: 1 | 0 | | {{#ifeq: 1 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: 0 | {{#ifeq: 0 | 0 | | {{#ifeq: 0 | X | | }} }} | }}{{#if: | {{#ifeq: {{{9}}} | 0 | | {{#ifeq: {{{9}}} | X | | }} }} | }}{{#if: | {{#ifeq: {{{10}}} | 0 | | {{#ifeq: {{{10}}} | X | | }} }} | }}{{#if: 1 | | }}{{#if: 1 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: 0 | | }}{{#if: | | }}{{#if: | | }}
1234567890

Use the ATK tool from Freescale (Windows program) to communicate with the i.MX51. You can download this tool from [1].

Boot from NFS (Network File System)

During development, downloading the kernel image from your PC and mounting the rootfs from your PC may save you a lot of time.

The boot loader Redboot executes from SD card or from NAND flash.

NFS root file system preparation

Refer to NFS Server for a quick NFS server how-to.

We assume that the rootfs is available at /tftpboot/rootfs-sbc. Before you let your target mount this NFS share, you have to disable configuration of the eth0 network device. This would override the kernel's network setup for the device and interrupt the connection to the NFS server and hence to the root file system.

Edit /tftpboot/rootfs-sbc/etc/network/interfaces and comment each line with eth0 in it:

#auto eth0
#iface eth0 inet dhcp

There's also a little script that makes things faster:

btmxc/scripts/rootfs_unpack.sh

Redboot configuration

RedBoot> fconfig -l
Run script at boot: true
Boot script: 
.. load -r -b 0x100000 zImage
.. e -c "console=ttymxc0,115200 console=tty1 root=/dev/nfs nfsroot=192.168.5.1:/tftpboot/rootfs-sbc/,v3,tcp debug psplash=false ip=dhcp display=hdmi:1024x768M-16@60"

Boot script timeout (1000ms resolution): 1
Use BOOTP for network configuration: true
Default server IP address: 192.168.5.1
Board specifics: 0
Console baud rate: 115200
Set FEC network hardware address [MAC]: true
FEC network hardware address [MAC]: 0x00:0x01:0x02:0x03:0x04:0x28
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false

Linux boot

During Linux boot, you will see the following messages if the root file system mount was successful:

eth0: config: auto-negotiation on, 100FDX, 100HDX, 10FDX, 10HDX.
Sending DHCP requests .., OK
IP-Config: Got DHCP answer from 192.168.5.1, my address is 192.168.5.121
IP-Config: Complete:
     device=eth0, addr=192.168.5.121, mask=255.255.255.0, gw=192.168.5.1,
     host=192.168.5.121, domain=krapfi.intern, nis-domain=(none),
     bootserver=192.168.5.1, rootserver=192.168.5.1, rootpath=
Looking up port of RPC 100003/3 on 192.168.5.1
Looking up port of RPC 100005/3 on 192.168.5.1
VFS: Mounted root (nfs filesystem).