README.mx28_common 8.1 KB

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