README.imximage 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. ---------------------------------------------
  2. Imximage Boot Image generation using mkimage
  3. ---------------------------------------------
  4. This document describes how to set up a U-Boot image that can be booted
  5. by Freescale MX25, MX35, MX51, MX53 and MX6 processors via internal boot
  6. mode.
  7. These processors can boot directly from NAND, SPI flash and SD card flash
  8. using its internal boot ROM support. MX6 processors additionally support
  9. boot from NOR flash and SATA disks. All processors can boot from an internal
  10. UART, if booting from device media fails.
  11. Booting from NOR flash does not require to use this image type.
  12. For more details refer Chapter 2 - System Boot and section 2.14
  13. (flash header description) of the processor's manual.
  14. This implementation does not use at the moment the secure boot feature
  15. of the processor. The image is generated disabling all security fields.
  16. Command syntax:
  17. --------------
  18. ./tools/mkimage -l <mx u-boot_file>
  19. to list the imx image file details
  20. ./tools/mkimage -T imximage \
  21. -n <board specific configuration file> \
  22. -e <execution address> -d <u-boot binary> <output image file>
  23. For example, for the mx51evk board:
  24. ./tools/mkimage -n ./board/freescale/mx51evk/imximage.cfg \
  25. -T imximage -e 0x97800000 \
  26. -d u-boot.bin u-boot.imx
  27. You can generate directly the image when you compile u-boot with:
  28. $ make u-boot.imx
  29. The output image can be flashed on the board SPI flash or on a SD card.
  30. In both cases, you have to copy the image at the offset required for the
  31. chosen media devices (0x400 for both SPI flash or SD card).
  32. Please check Freescale documentation for further details.
  33. Board specific configuration file specifications:
  34. -------------------------------------------------
  35. 1. This file must present in the $(BOARDDIR) and the name should be
  36. imximage.cfg (since this is used in Makefile).
  37. 2. This file can have empty lines and lines starting with "#" as first
  38. character to put comments.
  39. 3. This file can have configuration command lines as mentioned below,
  40. any other information in this file is treated as invalid.
  41. Configuration command line syntax:
  42. ---------------------------------
  43. 1. Each command line is must have two strings, first one command or address
  44. and second one data string
  45. 2. Following are the valid command strings and associated data strings:-
  46. Command string data string
  47. -------------- -----------
  48. IMXIMAGE_VERSION 1/2
  49. 1 is for mx25/mx35/mx51 compatible,
  50. 2 is for mx53/mx6 compatible,
  51. others is invalid and error is generated.
  52. This command need appear the fist before
  53. other valid commands in configuration file.
  54. BOOT_OFFSET value
  55. This command is parallel to BOOT_FROM and
  56. is preferred over BOOT_FROM.
  57. value: Offset of the image header, this
  58. value shall be set to one of the
  59. values found in the file:
  60. arch/arm/include/asm/\
  61. imx-common/imximage.cfg
  62. Example:
  63. BOOT_OFFSET FLASH_OFFSET_STANDARD
  64. BOOT_FROM nand/spi/sd/onenand/nor/sata
  65. This command is parallel to BOOT_OFFSET and
  66. is to be deprecated in favor of BOOT_OFFSET.
  67. Example:
  68. BOOT_FROM spi
  69. DATA type address value
  70. type: word=4, halfword=2, byte=1
  71. address: physycal register address
  72. value: value to be set in register
  73. All values are in in hexadecimal.
  74. Example (write to IOMUXC):
  75. DATA 4 0x73FA88a0 0x200
  76. The processor support up to 60 register programming commands for IMXIMAGE_VERSION 1
  77. and 121 register programming commands for IMXIMAGE_VERSION 2.
  78. An error is generated if more commands are found in the configuration file.
  79. 3. All commands are optional to program.
  80. Setup a SD Card for booting
  81. --------------------------------
  82. The following example prepare a SD card with u-boot and a FAT partition
  83. to be used to stored the kernel to be booted.
  84. I will set the SD in the most compatible mode, setting it with
  85. 255 heads and 63 sectors, as suggested from several documentation and
  86. howto on line (I took as reference the preparation of a SD Card for the
  87. Beagleboard, running u-boot as bootloader).
  88. You should start clearing the partitions table on the SD card. Because
  89. the u-boot image must be stored at the offset 0x400, it must be assured
  90. that there is no partition at that address. A new SD card is already
  91. formatted with FAT filesystem and the partition starts from the first
  92. cylinder, so we need to change it.
  93. You can do all steps with fdisk. If the device for the SD card is
  94. /dev/mmcblk0, the following commands make the job:
  95. 1. Start the fdisk utility (as superuser)
  96. fdisk /dev/mmcblk0
  97. 2. Clear the actual partition
  98. Command (m for help): o
  99. 3. Print card info:
  100. Command (m for help): p
  101. Disk /dev/mmcblk0: 1981 MB, 1981284352 bytes
  102. In my case, I have a 2 GB card. I need the size to set later the correct value
  103. for the cylinders.
  104. 4. Go to expert mode:
  105. Command (m for help): x
  106. 5. Set card geometry
  107. Expert command (m for help): h
  108. Number of heads (1-256, default 4): 255
  109. Expert command (m for help): s
  110. Number of sectors (1-63, default 16): 63
  111. Warning: setting sector offset for DOS compatiblity
  112. We have set 255 heads, 63 sector. We have to set the cylinder.
  113. The value to be set can be calculated with:
  114. cilynder = <total size> / <heads> / <sectors> / <blocksize>
  115. in this example,
  116. 1981284352 / 255 / 63 / 512 = 239.x = 239
  117. Expert command (m for help): c
  118. Number of cylinders (1-1048576, default 60032): 239
  119. 6. Leave the expert mode
  120. Expert command (m for help): r
  121. 7. Set up a partition
  122. Now set a partition table to store the kernel or whatever you want. Of course,
  123. you can set additional partitions to store rootfs, data, etc.
  124. In my example I want to set a single partition. I must take care
  125. to not overwrite the space where I will put u-boot.
  126. Command (m for help): n
  127. Command action
  128. e extended
  129. p primary partition (1-4)
  130. p
  131. Partition number (1-4): 1
  132. First cylinder (1-239, default 1): 3
  133. Last cylinder, +cylinders or +size{K,M,G} (3-239, default 239): +100M
  134. Command (m for help): p
  135. Disk /dev/mmcblk0: 1967 MB, 1967128576 bytes
  136. 255 heads, 63 sectors/track, 239 cylinders
  137. Units = cylinders of 16065 * 512 = 8225280 bytes
  138. Disk identifier: 0xb712a870
  139. Device Boot Start End Blocks Id System
  140. /dev/mmcblk0p1 3 16 112455 83 Linux
  141. I have set 100MB, leaving the first 2 sectors free. I will copy u-boot
  142. there.
  143. 8. Write the partition table and exit.
  144. Command (m for help): w
  145. The partition table has been altered!
  146. Calling ioctl() to re-read partition table.
  147. 9. Copy u-boot.imx on the SD card
  148. I use dd:
  149. dd if=u-boot.imx of=/dev/mmcblk0 bs=512 seek=2
  150. This command copies the u-boot image at the address 0x400, as required
  151. by the processor.
  152. Now remove your card from the PC and go to the target. If evrything went right,
  153. the u-boot prompt should come after power on.
  154. ------------------------------------------------
  155. Author: Stefano babic <sbabic@denx.de>