README.mxs 8.4 KB

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