README.m28 8.2 KB

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