README.imximage 5.9 KB

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