README.mx28_common 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. Booting U-boot on a MX28 processor
  2. ==================================
  3. This document describes the MX28 U-Boot port. This document mostly
  4. covers topics related to making the module/board bootable.
  5. Terminology
  6. -----------
  7. The dollar symbol ($) introduces a snipped of shell code. This shall be typed
  8. into the unix command prompt in U-Boot source code root directory.
  9. The (=>) introduces a snipped of code that should by typed into U-Boot command
  10. prompt
  11. Contents
  12. --------
  13. 1) Prerequisites
  14. 2) Compiling U-Boot for a MX28 based board
  15. 3) Installation of U-Boot for a MX28 based board to SD card
  16. 1) Prerequisites
  17. ----------------
  18. To make a MX28 based board bootable, some tools are necessary. The first one
  19. is the "elftosb" tool distributed by Freescale Semiconductor. The other one
  20. is the "mxsboot" tool found in U-Boot source tree.
  21. Firstly, obtain the elftosb archive from the following location:
  22. http://foss.doredevelopment.dk/mirrors/imx/elftosb-10.12.01.tar.gz
  23. We use a $VER variable here to denote the current version. At the time of
  24. writing of this document, that is "10.12.01". To obtain the file from command
  25. line, use:
  26. $ VER="10.12.01"
  27. $ wget http://foss.doredevelopment.dk/mirrors/imx/elftosb-${VER}.tar.gz
  28. Extract the file:
  29. $ tar xzf elftosb-${VER}.tar.gz
  30. Compile the file. We need to manually tell the linker to use also libm:
  31. $ cd elftosb-${VER}/
  32. $ make LIBS="-lstdc++ -lm" elftosb
  33. Optionally, remove debugging symbols from elftosb:
  34. $ strip bld/linux/elftosb
  35. Finally, install the "elftosb" binary. The "install" target is missing, so just
  36. copy the binary by hand:
  37. $ sudo cp bld/linux/elftosb /usr/local/bin/
  38. Make sure the "elftosb" binary can be found in your $PATH, in this case this
  39. means "/usr/local/bin/" has to be in your $PATH.
  40. 2) Compiling U-Boot for a MX28 based board
  41. -------------------------------------------
  42. Compiling the U-Boot for a MX28 board is straightforward and done as compiling U-Boot
  43. for any other ARM device. For cross-compiler setup, please refer to ELDK5.0
  44. documentation. First, clean up the source code:
  45. $ make mrproper
  46. Next, configure U-Boot for a MX28 based board
  47. $ make <mx28_based_board_name>_config
  48. Examples:
  49. 1. For building U-boot for Denx M28EVK board:
  50. $ make m28evk_config
  51. 2. For building U-boot for Freescale MX28EVK board:
  52. $ make mx28evk_config
  53. Lastly, compile U-Boot and prepare a "BootStream". The "BootStream" is a special
  54. type of file, which the i.MX28 CPU can boot. This is handled by the following
  55. command:
  56. $ make u-boot.sb
  57. HINT: To speed-up the build process, you can add -j<N>, where N is number of
  58. compiler instances that'll run in parallel.
  59. The code produces "u-boot.sb" file. This file needs to be augmented with a
  60. proper header to allow successful boot from SD or NAND. Adding the header is
  61. discussed in the following chapters.
  62. 3) Installation of U-Boot for a MX28 based board to SD card
  63. -----------------------------------------------------------
  64. To boot a MX28 based board from SD, set the boot mode DIP switches according
  65. to i.MX28 manual chapter 12.2.1 (Table 12-2), PORT=SSP0, SD/MMC master on
  66. SSP0, 3.3V.
  67. An SD card the i.MX28 CPU can use to boot U-Boot must contain a DOS partition
  68. table, which in turn carries a partition of special type and which contains a
  69. special header. The rest of partitions in the DOS partition table can be used
  70. by the user.
  71. To prepare such partition, use your favourite partitioning tool. The partition
  72. must have the following parameters:
  73. * Start sector .......... sector 2048
  74. * Partition size ........ at least 1024 kb
  75. * Partition type ........ 0x53 (sometimes "OnTrack DM6 Aux3")
  76. For example in Linux fdisk, the sequence for a clear card follows. Be sure to
  77. run fdisk with the option "-u=sectors" to set units to sectors:
  78. * o ..................... create a clear partition table
  79. * n ..................... create new partition
  80. * p ............. primary partition
  81. * 1 ............. first partition
  82. * 2048 .......... first sector is 2048
  83. * +1M ........... make the partition 1Mb big
  84. * t 1 ................... change first partition ID
  85. * 53 ............ change the ID to 0x53 (OnTrack DM6 Aux3)
  86. * <create other partitions>
  87. * w ..................... write partition table to disk
  88. The partition layout is ready, next the special partition must be filled with
  89. proper contents. The contents is generated by running the following command
  90. (see chapter 2)):
  91. $ ./tools/mxsboot sd u-boot.sb u-boot.sd
  92. The resulting file, "u-boot.sd", shall then be written to the partition. In this
  93. case, we assume the first partition of the SD card is /dev/mmcblk0p1:
  94. $ dd if=u-boot.sd of=/dev/mmcblk0p1
  95. Last step is to insert the card into MX28 based board and boot.
  96. NOTE: If the user needs to adjust the start sector, the "mxsboot" tool contains
  97. a "-p" switch for that purpose. The "-p" switch takes the sector number as
  98. an argument.
  99. 4) Installation of U-Boot for NAND flash
  100. -----------------------------------------------
  101. To boot a MX28 based board from NAND, set the boot mode DIP switches according to i.MX28
  102. manual chapter 12.2.1 (Table 12-2), PORT=GPMI, NAND 1.8 V.
  103. There are two possibilities when preparing an image writable to NAND flash.
  104. I) The NAND wasn't written at all yet or the BCB is broken
  105. ----------------------------------------------------------
  106. In this case, both BCB (FCB and DBBT) and firmware needs to be
  107. written to NAND. To generate NAND image containing all these,
  108. there is a tool called "mxsboot" in the "tools/" directory. The tool
  109. is invoked on "u-boot.sb" file from chapter 2):
  110. $ ./tools/mxsboot nand u-boot.sb u-boot.nand
  111. NOTE: The above invokation works for NAND flash with geometry of
  112. 2048b per page, 64b OOB data, 128kb erase size. If your chip
  113. has a different geometry, please use:
  114. -w <size> change page size (default 2048 b)
  115. -o <size> change oob size (default 64 b)
  116. -e <size> change erase size (default 131072 b)
  117. The geometry information can be obtained from running U-Boot
  118. on the MX28 board by issuing the "nand info" command.
  119. The resulting file, "u-boot.nand" can be written directly to NAND
  120. from the U-Boot prompt. To simplify the process, the U-Boot default
  121. environment contains script "update_nand_full" to update the system.
  122. This script expects a working TFTP server containing the file
  123. "u-boot.nand" in it's root directory. This can be changed by
  124. adjusting the "update_nand_full_filename" varible.
  125. To update the system, run the following in U-Boot prompt:
  126. => run update_nand_full
  127. In case you would only need to update the bootloader in future,
  128. see II) below.
  129. II) The NAND was already written with a good BCB
  130. ------------------------------------------------
  131. This part applies after the part I) above was done at least once.
  132. If part I) above was done correctly already, there is no need to
  133. write the FCB and DBBT parts of NAND again. It's possible to upgrade
  134. only the bootloader image.
  135. To simplify the process of firmware update, the U-Boot default
  136. environment contains script "update_nand_firmware" to update only
  137. the firmware, without rewriting FCB and DBBT.
  138. This script expects a working TFTP server containing the file
  139. "u-boot.sb" in it's root directory. This can be changed by
  140. adjusting the "update_nand_firmware_filename" varible.
  141. To update the system, run the following in U-Boot prompt:
  142. => run update_nand_firmware
  143. III) Special settings for the update scripts
  144. --------------------------------------------
  145. There is a slight possibility of the user wanting to adjust the
  146. STRIDE and COUNT options of the NAND boot. For description of these,
  147. see i.MX28 manual section 12.12.1.2 and 12.12.1.3.
  148. The update scripts take this possibility into account. In case the
  149. user changes STRIDE by blowing fuses, the user also has to change
  150. "update_nand_stride" variable. In case the user changes COUNT by
  151. blowing fuses, the user also has to change "update_nand_count"
  152. variable for the update scripts to work correctly.
  153. In case the user needs to boot a firmware image bigger than 1Mb, the
  154. user has to adjust the "update_nand_firmware_maxsz" variable for the
  155. update scripts to work properly.