colibri_imx7.rst 3.6 KB

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