README.mx35pdk 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. Overview
  2. --------------
  3. mx35pdk (known als as mx35_3stack) is a development board by Freescale.
  4. It consists of three pluggable board:
  5. - CPU module, with CPU, RAM, flash
  6. - Personality board, with most interfaces (USB, Network,..)
  7. - Debug board with JTAG header.
  8. The board is usually delivered with redboot. This howto explains how to boot
  9. a linux kernel and how to replace the original bootloader with U-Boot.
  10. The board is delivered with Redboot on the NAND flash. It is possible to
  11. switch the boot device with the switches SW1-SW2 on the Personality board,
  12. and with SW5-SW10 on the Debug board.
  13. Delivered Redboot script to start the kernel
  14. ---------------------------------------------------
  15. In redboot the following script is stored:
  16. fis load kernel
  17. exec -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock8 rw rootfstype=jffs2 ip=dhcp fec_mac=00:04:9F:00:E7:76"
  18. Kernel is taken from flash. The image is in zImage format.
  19. Booting from NET, rootfs on NFS:
  20. -----------------------------------
  21. To change the script in redboot:
  22. load -r -b 0x100000 <path_to_zImage>
  23. exec -c "noinitrd console=ttymxc0,115200 root=/dev/nfsroot rootfstype=nfsroot nfsroot=192.168.1.1:/opt/eldk-4.2-arm/armVFP rw ip=dhcp"
  24. If the ip address is not set, you can set it with :
  25. ip_address -l <board_ip/netmask> -h <server_ip>
  26. Linux partitions:
  27. ---------------------------
  28. As default, the board is shipped with these partition tables for NAND
  29. and for NOR:
  30. Creating 5 MTD partitions on "NAND 2GiB 3,3V 8-bit":
  31. 0x00000000-0x00100000 : "nand.bootloader"
  32. 0x00100000-0x00600000 : "nand.kernel"
  33. 0x00600000-0x06600000 : "nand.rootfs"
  34. 0x06600000-0x06e00000 : "nand.configure"
  35. 0x06e00000-0x80000000 : "nand.userfs"
  36. Creating 6 MTD partitions on "mxc_nor_flash.0":
  37. 0x00000000-0x00080000 : "Bootloader"
  38. 0x00080000-0x00480000 : "nor.Kernel"
  39. 0x00480000-0x02280000 : "nor.userfs"
  40. 0x02280000-0x03e80000 : "nor.rootfs"
  41. 0x01fe0000-0x01fe3000 : "FIS directory"
  42. 0x01fff000-0x04000000 : "Redboot config"
  43. NAND partitions can be recognized enabling in kernel CONFIG_MTD_REDBOOT_PARTS.
  44. For this board, CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK should be set to 2.
  45. However, the setup in redboot is not correct and does not use the whole flash.
  46. Better solution is to use the kernel parameter mtdparts.
  47. Here the resulting script to be defined in RedBoot with fconfig:
  48. load -r -b 0x100000 sbabic/mx35pdk/zImage.2.6.37
  49. exec -c "noinitrd console=ttymxc0,115200 root=/dev/nfsroot rootfstype=nfsroot nfsroot=192.168.1.1:/opt/eldk-4.2-arm/arm rw ip=dhcp mtdparts=mxc_nand:1m(boot),5m(linux),96m(root),8m(cfg),1938m(user);physmap-flash.0:512k(b),4m(k),30m(u),28m(r)"
  50. Flashing U-Boot
  51. --------------------------------
  52. There are two options: the original bootloader in NAND can be replaced with
  53. u-boot, or u-boot can be stored on the NOR flash without erasing
  54. the delivered bootloader.
  55. The boot storage can be select using the switches on the personality board
  56. (SW1-SW2) and on the DEBUG board (SW4-SW10).
  57. The second option is to be preferred if you have not a JTAG debugger.
  58. If something goes wrong flashing the bootloader, it is always possible to
  59. recover the board booting from the other device.
  60. Replacing the bootloader on the NAND
  61. --------------------------------------
  62. To replace RedBoot with U-Boot, the easy way is to do this in linux.
  63. Start the kernel with the suggested options. Make sure to have set the
  64. mtdparts exactly as described, because this matches the layout on the
  65. mx35pdk.
  66. You should see in your boot log the following entries for the NAND
  67. flash:
  68. 5 cmdlinepart partitions found on MTD device mxc_nand
  69. Creating 5 MTD partitions on "mxc_nand":
  70. 0x000000000000-0x000000100000 : "boot"
  71. 0x000000100000-0x000000600000 : "linux"
  72. 0x000000600000-0x000006600000 : "root"
  73. 0x000006600000-0x000006e00000 : "cfg"
  74. 0x000006e00000-0x000080000000 : "user"
  75. You can use the utilities flash_eraseall and nandwrite to put
  76. u-boot on the NAND. The bootloader is marked as "boot", and 1MB is
  77. reserved. If everything is correct, this partition is accessed as
  78. /dev/mtd4. However, check if it is correct with "cat /proc/mtd" and
  79. get the device node from the partition name:
  80. $ cat /proc/mtd | grep boot
  81. I suggest you try the utilities on a different partition to be sure
  82. if everything works correctly. If not, and you remove RedBoot, you have to
  83. reinstall it using the ATK tool as suggested by Freescale, or using a
  84. JTAG debugger.
  85. I report the versions of the utilities I used (they are provided with ELDK):
  86. -bash-3.2# nandwrite --version
  87. nandwrite $Revision: 1.32 $
  88. flash_eraseall --version
  89. flash_eraseall $Revision: 1.22 $
  90. nandwrite reports a warning if the file to be saved is not sector aligned.
  91. This should have no consequences, but I preferred to pad u-boot.bin
  92. to get no problem at all.
  93. $ dd if=/dev/zero of=zeros bs=1 count=74800
  94. $ cat u-boot.bin zeros > u-boot-padded.bin
  95. To erase the partition:
  96. $ flash_eraseall /dev/mtd4
  97. Writing u-boot:
  98. $ nandwrite /dev/mtd4 u-boot-padded.bin
  99. Now U-Boot is stored on the booting partition.
  100. To boot from NAND, you have to select the switches as follows:
  101. Personality board
  102. SW2 1, 4, 5 on
  103. 2, 3, 6, 7, 8 off
  104. SW1 all off
  105. Debug Board:
  106. SW5 0
  107. SW6 0
  108. SW7 0
  109. SW8 1
  110. SW9 1
  111. SW10 0
  112. Saving U-Boot in the NOR flash
  113. ---------------------------------
  114. The procedure to save in the NOR flash is quite the same as to write into the NAND.
  115. Check the partition for boot in the NOR flash. Setting the mtdparts as reported,
  116. the boot partition should be /dev/mtd0.
  117. Creating 6 MTD partitions on "mxc_nor_flash.0":
  118. 0x00000000-0x00080000 : "Bootloader"
  119. 0x00080000-0x00480000 : "nor.Kernel"
  120. 0x00480000-0x02280000 : "nor.userfs"
  121. 0x02280000-0x03e80000 : "nor.rootfs"
  122. 0x01fe0000-0x01fe3000 : "FIS directory"
  123. 0x01fff000-0x04000000 : "Redboot config"
  124. To erase the whole partition:
  125. $ flash_eraseall /dev/mtd0
  126. Writing u-boot:
  127. dd if=u-boot.bin of=/dev/mtd0
  128. To boot from NOR, you have to select the switches as follows:
  129. Personality board
  130. SW2 all off
  131. SW1 all off
  132. Debug Board:
  133. SW5 0
  134. SW6 0
  135. SW7 0
  136. SW8 1
  137. SW9 1
  138. SW10 0