README.ublimage 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. ---------------------------------------------
  2. UBL image Boot Image generation using mkimage
  3. ---------------------------------------------
  4. This document describes how to set up an U-Boot image that can be directly
  5. booted by a DaVinci processor via NAND boot mode, using an UBL header,
  6. but without need for UBL.
  7. For more details see section 11.2 "ARM ROM Boot Modes" of
  8. http://focus.ti.com/lit/ug/sprufg5a/sprufg5a.pdf
  9. Command syntax:
  10. --------------
  11. ./tools/mkimage -l <u-boot_file>
  12. to list the UBL image file details
  13. ./tools/mkimage -T ublimage \
  14. -n <board specific configuration file> \
  15. -d <u-boot binary> <output image file>
  16. For example, for the davinci dm365evm board:
  17. ./tools/mkimage -n ./board/davinci/dm365evm/ublimage.cfg \
  18. -T ublimage \
  19. -d u-boot-nand.bin u-boot.ubl
  20. You can generate the image directly when you compile u-boot with:
  21. $ make u-boot.ubl
  22. The output image can be flashed into the NAND.
  23. Please check the DaVinci documentation for further details.
  24. Board specific configuration file specifications:
  25. -------------------------------------------------
  26. 1. This file must present in the $(BOARDDIR) and the name should be
  27. ublimage.cfg (since this is used in Makefile).
  28. 2. This file can have empty lines and lines starting with "#" as first
  29. character to put comments.
  30. 3. This file can have configuration command lines as mentioned below,
  31. any other information in this file is treated as invalid.
  32. Configuration command line syntax:
  33. ---------------------------------
  34. 1. Each command line must have two strings, first one command or address
  35. and second one data string
  36. 2. Following are the valid command strings and associated data strings:-
  37. Command string data string
  38. -------------- -----------
  39. MODE UBL special mode, on of:
  40. safe
  41. Example:
  42. MODE safe
  43. ENTRY Entry point address for the user
  44. bootloader (absolute address) = TEXT_BASE
  45. nand_spl loader.
  46. Example:
  47. ENTRY 0x00000020
  48. PAGES Number of pages (size of user bootloader
  49. in number of pages)
  50. Example:
  51. PAGES 27
  52. START_BLOCK Block number where user bootloader is present
  53. Example:
  54. START_BLOCK 5
  55. START_PAGE Page number where user bootloader is present
  56. (for RBL always 0)
  57. Example:
  58. START_PAGE 0
  59. ------------------------------------------------
  60. Structure of the u-boot.ubl binary:
  61. compile steps:
  62. 1) nand_spl code compile, with pad_to = (TEXT_BASE +
  63. (CONFIG_SYS_NROF_PAGES_NAND_SPL * pagesize))
  64. Example: cam_enc_4xx pad_to = 0x20 + (6 * 0x800) = 0x3020 = 12320
  65. -> u-boot-spl-16k.bin
  66. !! TEXT_BASE = 0x20, as the RBL starts at 0x20
  67. 2) compile u-boot.bin ("normal" u-boot)
  68. -> u-boot.bin
  69. 3) create u-boot-nand.bin = u-boot-spl-16k.bin + u-boot.bin
  70. 4) create u-boot.ubl, size = 1 page size NAND
  71. create UBL header and paste it before u-boot.bin
  72. This steps are done automagically if you do a "make all"
  73. -> You get an u-boot.ubl binary, which you can flash
  74. into your NAND.
  75. Structure of this binary (Example for the cam_enc_4xx board with a NAND
  76. page size = 0x800):
  77. offset : 0x00000 | 0x800 | 0x3800
  78. content: UBL | nand_spl | u-boot code
  79. Header | code |
  80. The NAND layout looks for example like this:
  81. (Example for the cam_enc_4xx board with a NAND page size = 0x800, block
  82. size = 0x20000 and CONFIG_SYS_NROF_UBL_HEADER 5):
  83. offset : 0x80000 | 0xa0000 | 0xa3000
  84. content: UBL | nand_spl | u-boot code
  85. Header | code |
  86. ^ ^
  87. ^ 0xa0000 = CONFIG_SYS_NROF_UBL_HEADER * 0x20000
  88. ^
  89. 0x80000 = Block 4 * 0x20000
  90. If the cpu starts in NAND boot mode, it checks the UBL descriptor
  91. starting with block 1 (page 0). When a valid UBL signature is found,
  92. the corresponding block number (from 1 to 24) is written to the last 32
  93. bits of ARM internal memory (0x7ffc-0x8000). This feature is provided
  94. as a basic debug mechanism. If not found, it continues with block 2
  95. ... last possible block is 24
  96. If a valid UBL descriptor is found, the UBL descriptor is read and
  97. processed. The descriptor gives the information required for loading
  98. and control transfer to the nand_spl code. The nand_spl code is then
  99. read and processed.
  100. Once the user-specified start-up conditions are set, the RBL copies the
  101. nand_spl into ARM internal RAM, starting at address 0x0000: 0020.
  102. ^^^^
  103. The nand_spl code itself now does necessary intializations, and at least,
  104. copies the u-boot code from NAND into RAM, and jumps to it ...
  105. ------------------------------------------------
  106. Author: Heiko Schocher <hs@denx.de>