blob: 6fb952666661da574bf7bc211d0b1f0ca8d5c10b [file] [log] [blame]
Igor Opaniuk3f59fa02020-02-12 17:14:28 +02001.. SPDX-License-Identifier: GPL-2.0+
2
3Colibri iMX7
4============
5
6Quick Start
7-----------
8
9- Build U-Boot
10- NAND IMX image adjustments before flashing
11- Flashing manually U-Boot to eMMC
12- Flashing manually U-Boot to NAND
13- Using ``update_uboot`` script
14
15Build U-Boot
16------------
17
18.. code-block:: bash
19
20 $ export CROSS_COMPILE=arm-linux-gnueabi-
21 $ export ARCH=arm
22 $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
23 $ make
24
25After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific
26image, ready for flashing (but check next section for additional
27adjustments).
28
29Final IMX program image includes (section ``6.6.7`` from `IMX7DRM
30<https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
31
32* **Image vector table** (IVT) for BootROM
33* **Boot data** -indicates the program image location, program image size
34 in bytes, and the plugin flag.
35* **Device configuration data**
36* **User image**: U-Boot image (``u-boot-dtb.bin``)
37
38
39IMX image adjustments prior to flashing
40---------------------------------------
41
421. U-Boot for both Colibri iMX7 NAND and eMMC versions
43is built with HABv4 support (`AN4581.pdf
44<https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
45enabled by default, which requires to generate a proper
46Command Sequence File (CSF) by srktool from NXP (not included in the
47U-Boot tree, check additional details in introduction_habv4.txt)
48and concatenate it to the final ``u-boot-dtb.imx``.
49
502. In case if you don't want to generate a proper ``CSF`` (for any reason),
51you still need to pad the IMX image so i has the same size as specified in
52in **Boot Data** section of IMX image.
53To obtain this value, run:
54
55.. code-block:: bash
56
57 $ od -X -N 0x30 u-boot-dtb.imx
58 0000000 402000d1 87800000 00000000 877ff42c
59 0000020 877ff420 877ff400 878a5000 00000000
60 ^^^^^^^^
61 0000040 877ff000 000a8060 00000000 40b401d2
62 ^^^^^^^^ ^^^^^^^^
63
64Where:
65
66* ``877ff400`` - IVT self address
67* ``877ff000`` - Program image address
68* ``000a8060`` - Program image size
69
70To calculate the padding:
71
72* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
73* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
74
75and then pad the image:
76
77.. code-block:: bash
78
79 $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
80 u-boot-dtb.imx u-boot-dtb.imx.zero-padded
81
823. Also, according to requirement from ``6.6.7.1``, the final image
83should have ``0x400`` offset for initial IVT table.
84
85For eMMC setup we handle this by flashing it to ``0x400``, howewer
86for NAND setup we adjust the image prior to flashing, adding padding in the
87beginning of the image.
88
89.. code-block:: bash
90
91 $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
92
93Flash U-Boot IMX image to eMMC
94------------------------------
95
96Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
97boot area partition:
98
99.. code-block:: bash
100
101
102 => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
103 => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
104 => mmc dev 0 1
105 => mmc write ${loadaddr} 0x2 ${blkcnt}
106
107Flash U-Boot IMX image to NAND
108------------------------------
109
110.. code-block:: bash
111
112 => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
113 => nand erase.part u-boot1
114 => nand write ${loadaddr} u-boot1 ${filesize}
115 => nand erase.part u-boot2
116 => nand write ${loadaddr} u-boot2 ${filesize}
117
118Using update_uboot script
119-------------------------
120
121You can also usb U-Boot env update_uboot script,
122which wraps all eMMC/NAND specific command invocation:
123
124.. code-block:: bash
125
126 => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
127 => run update_uboot