README 6.1 KB
Newer Older
1 2 3 4 5
U-Boot for the Gateworks Ventana Product Family boards

This file contains information for the port of U-Boot to the Gateworks
Ventana Product family boards.

6 7 8 9 10 11
The entire Ventana product family (http://www.gateworks.com/product#ventana)
is supported by a single bootloader build by using a common SPL and U-Boot
that dynamically determines the characterstics of the board at runtime via
information from an EEPROM on the board programmed at the factory and supports
all of the various boot mediums available.

T
Tim Harvey 已提交
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
1. Secondary Program Loader (SPL)
---------------------------------

The i.MX6 has a BOOT ROM PPL (Primary Program Loader) which supports loading
an executable image from various boot devices.

The Gateworks Ventana board config uses an SPL build configuration. This
will build the following artifacts from u-boot source:
 - SPL - Secondary Program Loader that the i.MX6 BOOT ROM (Primary Program
         Loader) boots.  This detects CPU/DRAM configuration, configures
         The DRAM controller, loads u-boot.img from the detected boot device,
         and jumps to it.  As this is booted from the PPL, it has an IVT/DCD
         table.
 - u-boot.img - The main u-boot core which is u-boot.bin with a image header.


2. Build
--------

To build U-Boot for the Gateworks Ventana product family:

 make gwventana_config
 make


37 38 39 40 41 42 43 44 45 46 47 48 49 50
3. Boot source:
---------------

The Gateworks Ventana boards support booting from NAND or micro-SD depending
on the board model. The IMX6 BOOT ROM will choose a boot media based on eFUSE
settings programmed at the factory.

Boards with NAND flash will always boot from NAND, and NAND-less boards will
always boot from micro-SD. However, it is possible to use the U-Boot bmode
command (or the technique it uses) to essentially bootstrap to another boot
media at runtime.

3.1. boot from NAND
-------------------
51 52 53

The i.MX6 BOOT ROM expects some structures that provide details of NAND layout
and bad block information (referred to as 'bootstreams') which are replicated
T
Tim Harvey 已提交
54 55 56 57 58 59 60 61
multiple times in NAND. The number of replications and their spacing (referred
to as search stride) is configurable through board strapping options and/or
eFUSE settings (BOOT_SEARCH_COUNT / Pages in block from BOOT_CFG2). In
addition, the i.MX6 BOOT ROM Flash Configuration Block (FCB) supports two
copies of a bootloader in flash in the case that a bad block has corrupted one.
The Freescale 'kobs-ng' application from the Freescale LTIB BSP, which runs
under Linux and operates on an MTD partition, must be used to program the
bootstream in order to setup this flash structure correctly.
62 63 64 65

The Gateworks Ventana boards with NAND flash have been factory programmed
such that their eFUSE settings expect 2 copies of the boostream (this is
specified by providing kobs-ng with the --search_exponent=1 argument). Once in
T
Tim Harvey 已提交
66
Linux with MTD support for the NAND on /dev/mtd0 you can program the SPL
67 68
with:

T
Tim Harvey 已提交
69
kobs-ng init -v -x --search_exponent=1 SPL
70

T
Tim Harvey 已提交
71 72 73 74 75
The kobs-ng application uses an imximage which contains the Image Vector Table
(IVT) and Device Configuration Data (DCD) structures that the i.MX6 BOOT ROM
requires to boot.  The kobs-ng adds the Firmware Configuration Block (FCB) and
Discovered Bad Block Table (DBBT).  The SPL build artifact from u-boot is
an imximage.
76

T
Tim Harvey 已提交
77 78 79 80
The u-boot.img, which is the non SPL u-boot binary appended to a u-boot image
header must be programmed in the NAND flash boot device at an offset hard
coded in the SPL. For the Ventana boards, this has been chosen to be 14MB.
The image can be programmed from either u-boot or Linux:
81

T
Tim Harvey 已提交
82 83 84 85
u-boot:
Ventana > setenv mtdparts mtdparts=nand:14m(spl),2m(uboot),1m(env),-(rootfs)
Ventana > tftp ${loadaddr} u-boot.img && nand erase.part uboot && \
          nand write ${loadaddr} uboot ${filesize}
86

T
Tim Harvey 已提交
87 88
Linux:
nandwrite /dev/mtd1 u-boot.img
89

T
Tim Harvey 已提交
90 91 92 93 94 95
The above assumes the default Ventana partitioning scheme which is configured
via the mtdparts env var:
 - spl: 14MB
 - uboot: 2M
 - env: 1M
 - rootfs: the rest
96

T
Tim Harvey 已提交
97
This information is taken from:
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 138 139 140 141 142 143 144 145 146 147 148
  http://trac.gateworks.com/wiki/ventana/bootloader#nand

More details about the i.MX6 BOOT ROM can be found in the IMX6 reference manual.

3.1. boot from micro-SD
-----------------------

When the IMX6 eFUSE settings have been factory programmed to boot from
micro-SD the SPL will be loaded from offset 0x400 (1KB). Once the SPL is
booted, it will load and execute U-boot (u-boot.img) from offset 69KB
on the micro-SD (defined by CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR).

While it is technically possible to enable the SPL to be able to load
U-Boot from a file on a FAT/EXT filesystem on the micro-SD, we chose to
use raw micro-SD access to keep the code-size and boot time of the SPL down.

For these reasons a micro-SD that will be used as an IMX6 primary boot
device must be carefully partitioned and prepared.

The following shell commands are executed on a Linux host (adjust DEV to the
block storage device of your micro-SD):

 DEV=/dev/sdc
 # zero out 1MB of device
 sudo dd if=/dev/zero of=$DEV count=1 bs=1M oflag=sync status=none && sync
 # copy SPL to 1KB offset
 sudo dd if=SPL of=$DEV bs=1K seek=1 oflag=sync status=none && sync
 # copy U-Boot to 69KB offset
 sudo dd if=u-boot.img of=$DEV bs=1K seek=69 oflag=sync status=none && sync
 # create a partition table with a single rootfs partition starting at 1MB
 printf "1,,L\n" | sudo sfdisk --in-order --no-reread -L -uM $DEV && sync
 # format partition
 sudo mkfs.ext4 -L root ${DEV}1
 # mount the partition
 sudo udisks --mount ${DEV}1
 # extract filesystem
 sudo tar xvf rootfs.tar.gz -C /media/root
 # flush and unmount
 sync && sudo umount /media/root

The above assumes the default Ventana micro-SD partitioning scheme
 - spl    :   1KB-69KB  (68KB)  required by IMX6 BOOT ROM
 - uboot  :  69KB-709KB (640KB) defined by
                                CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 - env    : 709KB-965KB (256KB) defined by
                                CONFIG_ENV_MMC_SIZE
                                CONFIG_ENV_MMC_OFFSET_REDUND
 - rootfs :   1MB-

This information is taken from:
  http://trac.gateworks.com/wiki/ventana/bootloader#microsd
149

T
Tim Harvey 已提交
150
More details about the i.MX6 BOOT ROM can be found in the IMX6 reference manual.
151