README.odroid 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. U-boot for Odroid X2/U3/XU3
  2. ========================
  3. 1. Summary
  4. ==========
  5. This is a quick instruction for setup Odroid boards.
  6. Board config: odroid_config for X2/U3
  7. Board config: odroid-xu3_config for XU3
  8. 2. Supported devices
  9. ====================
  10. This U-BOOT config can be used on three boards:
  11. - Odroid U3
  12. - Odroid X2
  13. with CPU Exynos 4412 rev 2.0 and 2GB of RAM
  14. - Odroid XU3
  15. with CPU Exynos5422 and 2GB of RAM
  16. 3. Boot sequence
  17. ================
  18. iROM->BL1->(BL2 + TrustZone)->U-BOOT
  19. This version of U-BOOT doesn't implement SPL. So, BL1, BL2, and TrustZone
  20. binaries are needed to boot up.
  21. << X2/U3 >>
  22. It can be found in "boot.tar.gz" from here:
  23. http://dev.odroid.com/projects/4412boot/wiki/FrontPage?action=download&value=boot.tar.gz
  24. or here:
  25. http://odroid.in/guides/ubuntu-lfs/boot.tar.gz
  26. << XU3 >>
  27. It can be downloaded from:
  28. https://github.com/hardkernel/u-boot/tree/odroidxu3-v2012.07/sd_fuse/hardkernel
  29. 4. Boot media layout
  30. ====================
  31. The table below shows SD/eMMC cards layout for U-boot.
  32. The block offset is starting from 0 and the block size is 512B.
  33. -------------------------------------
  34. | Binary | Block offset| part type |
  35. | name | SD | eMMC |(eMMC only)|
  36. -------------------------------------
  37. | Bl1 | 1 | 0 | 1 (boot) |
  38. | Bl2 | 31 | 30 | 1 (boot) |
  39. | U-boot | 63 | 62 | 1 (boot) |
  40. | Tzsw | 2111 | 2110 | 1 (boot) |
  41. | Uboot Env | 2560 | 2560 | 0 (user) |
  42. -------------------------------------
  43. 5. Prepare the SD boot card - with SD card reader
  44. =================================================
  45. To prepare bootable media you need boot binaries provided by hardkernel.
  46. From the downloaded files, You can find:
  47. - bl1.bin
  48. - tzsw.bin
  49. - bl2.bin
  50. - sd_fusing.sh
  51. - u-boot.bin
  52. (The file names can be slightly different, but you can distinguish what they are
  53. without problem)
  54. This is all you need to boot this board. But if you want to use your custom
  55. u-boot then you need to change u-boot.bin with your own u-boot binary*
  56. and run the script "sd_fusing.sh" - this script is valid only for SD card.
  57. *note:
  58. The proper binary file of current U-boot is u-boot-dtb.bin.
  59. quick steps for Linux:
  60. - Download all files from the link at point 3 and extract it if needed.
  61. - put any SD card into the SD reader
  62. - check the device with "dmesg"
  63. - run ./sd_fusing.sh /dev/sdX - where X is SD card device (but not a partition)
  64. Check if Hardkernel U-boot is booting, and next do the same with your U-boot.
  65. 6. Prepare the eMMC boot card
  66. with a eMMC card reader (boot from eMMC card slot)
  67. =====================================================
  68. To boot the device from the eMMC slot you should use a special card reader
  69. which supports eMMC partition switch. All of the boot binaries are stored
  70. on the eMMC boot partition which is normally hidden.
  71. The "sd_fusing.sh" script can be used after updating offsets of binaries
  72. according to the table from point 4. Be sure that you are working on the right
  73. eMMC partition - its size is usually very small, about 1-4 MiB.
  74. 7. Prepare the eMMC boot card
  75. with a SD card reader (boot from SD card slot)
  76. =================================================
  77. If you have an eMMC->microSD adapter you can prepare the card as in point 5.
  78. But then the device can boot only from the SD card slot.
  79. 8. Prepare the boot media using Hardkernel U-boot
  80. =================================================
  81. You can update the U-boot to the custom one if you have a working bootloader
  82. delivered with the board on the eMMC/SD card. Then follow the steps:
  83. - install the android fastboot tool
  84. - connect a micro usb cable to the board
  85. - on the U-boot prompt, run command: fastboot (as a root)
  86. - on the host, run command: "fastboot flash bootloader u-boot-dtb.bin"
  87. - the custom U-boot should start after the board resets.
  88. 9. Partition layout
  89. ====================
  90. Default U-boot environment is setup for fixed partition layout.
  91. Partition table: MSDOS. Disk layout and files as listed in the table below.
  92. ----- ------ ------ ------ -------- ---------------------------------
  93. | Num | Name | FS | Size | Offset | Reguired files |
  94. | | | Type | MiB | MiB | |
  95. ----- ------ ------ ------ -------- ---------------------------------
  96. | 1 | BOOT | fat | 100 | 2 | kernel, fdt** |
  97. | 2 | ROOT | ext4 | - | | any Linux system |
  98. ----- ------ ------ ------ -------- ---------------------------------
  99. **note:
  100. Supported fdt files are:
  101. - exynos4412-odroidx2.dtb
  102. - exynos4412-odroidu3.dtb
  103. - exynos5422-odroidxu3.dtb
  104. Supported kernel files are:
  105. - Image.itb
  106. - zImage
  107. - uImage
  108. The default environmental variable "dfu_alt_info" is set* for above layout.
  109. Each partition size is just an example, dfu_alt_info tries init two partitions.
  110. The size of each is not important.
  111. *note:
  112. $dfu_alt_info is set on a boot time and it is concatenated using two variables:
  113. - $dfu_alt_boot(set dynamically)
  114. - $dfu_alt_system(from current env).
  115. To add any changes to dfu_alt_info - please modify $dfu_alt_system only.
  116. Changes are visible after board reset.
  117. 10. The environment and booting the kernel
  118. ==========================================
  119. There are three macros defined in config for various boot options:
  120. Two for both, kernel with device tree support and also without it:
  121. - boot_uimg - load uImage
  122. - boot_zimg - load zImage
  123. If proper fdt file exists then it will be automatically loaded,
  124. so for old kernel types, please remove fdt file from boot partition.
  125. The third boot option for multi image support (more info: doc/uImage.FIT/)
  126. - boot_fit - for binary file: "Image.itb"
  127. Default boot command: "autoboot"
  128. And the boot sequence is:
  129. - boot_fit - if "Image.itb" exists
  130. - boot_zimg - if "zImage" exists
  131. - boot_uimg - if "uImage" exists
  132. 11. USB host support
  133. ====================
  134. NOTE: This section is only for Odroid X2/U3.
  135. The ethernet can be accessed after starting the USB subsystem in U-Boot.
  136. The adapter does not come with a preconfigured MAC address, and hence it needs
  137. to be set before starting USB.
  138. setenv usbethaddr 02:DE:AD:BE:EF:FF
  139. Note that in this example a locally managed MAC address is chosen. Care should
  140. be taken to make these MAC addresses unique within the same subnet.
  141. Start the USB subsystem:
  142. Odroid # setenv usbethaddr 02:DE:AD:BE:EF:FF
  143. Odroid # usb start
  144. (Re)start USB...
  145. USB0: USB EHCI 1.00
  146. scanning bus 0 for devices... 4 USB Device(s) found
  147. scanning usb for storage devices... 1 Storage Device(s) found
  148. scanning usb for ethernet devices... 1 Ethernet Device(s) found
  149. Odroid #
  150. Automatic IP assignment:
  151. ------------------------
  152. If the ethernet is connected to a DHCP server (router maybe with DHCP enabled),
  153. then the below will automatically assign an ip address through DHCP.
  154. setenv autoload no
  155. dhcp
  156. Odroid # setenv autoload no
  157. Odroid # dhcp
  158. Waiting for Ethernet connection... done.
  159. BOOTP broadcast 1
  160. DHCP client bound to address 192.168.1.10 (524 ms)
  161. Odroid #
  162. Note that this automatically sets the many IP address related variables in
  163. U-Boot that is obtained from the DHCP server.
  164. Odroid # printenv ipaddr netmask gatewayip dnsip
  165. ipaddr=192.168.1.10
  166. netmask=255.255.255.0
  167. gatewayip=192.168.1.1
  168. dnsip=192.168.1.1
  169. Ping example:
  170. The ping command can be used a test to check connectivity. In this example,
  171. 192.168.1.27 is a pingable server in the network.
  172. Odroid # ping 192.168.1.27
  173. Waiting for Ethernet connection... done.
  174. Using sms0 device
  175. host 192.168.1.27 is alive
  176. Odroid #
  177. Static IP assignment:
  178. ---------------------
  179. In the case where there are no DHCP servers in the network, or you want to
  180. set the IP address statically, it can be done by:
  181. Odroid # setenv ipaddr 192.168.1.10
  182. Odroid # ping 192.168.1.27
  183. Waiting for Ethernet connection... done.
  184. Using sms0 device
  185. host 192.168.1.27 is alive
  186. TFTP booting:
  187. -------------
  188. Say there exists a tftp server in the network with address 192.168.1.27 and
  189. it serves a kernel image (zImage.3.17) and a DTB blob (exynos4412-odroidu3.dtb)
  190. that needs to be loaded and booted. It can be accomplished as below:
  191. (Assumes that you have setenv usbethaddr, and have not set autoload to no)
  192. Odroid # setenv serverip 192.168.1.27
  193. Odroid # tftpboot 0x40080000 zImage.3.17
  194. Waiting for Ethernet connection... done.
  195. Using sms0 device
  196. TFTP from server 192.168.1.27; our IP address is 192.168.1.10
  197. Filename 'zImage.3.17'.
  198. Load address: 0x40080000
  199. Loading: #################################################################
  200. #################################################################
  201. #################################################################
  202. #######################
  203. 52.7 KiB/s
  204. done
  205. Bytes transferred = 3194200 (30bd58 hex)
  206. Odroid # tftpboot 0x42000000 exynos4412-odroidu3.dtb
  207. Waiting for Ethernet connection... done.
  208. Using sms0 device
  209. TFTP from server 192.168.1.27; our IP address is 192.168.1.10
  210. Filename 'exynos4412-odroidu3.dtb'.
  211. Load address: 0x42000000
  212. Loading: ####
  213. 40 KiB/s
  214. done
  215. Bytes transferred = 46935 (b757 hex)
  216. Odroid # printenv bootargs
  217. bootargs=Please use defined boot
  218. Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/mmcblk0p2 rootwait
  219. Odroid # bootz 40080000 - 42000000
  220. Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
  221. ## Flattened Device Tree blob at 42000000
  222. Booting using the fdt blob at 0x42000000
  223. Loading Device Tree to 4fff1000, end 4ffff756 ... OK
  224. Starting kernel ...
  225. [ 0.000000] Booting Linux on physical CPU 0xa00
  226. ... etc ...
  227. In the above example you can substitute 'dhcp' for 'tftpboot' as well.
  228. USB Storage booting:
  229. --------------------
  230. Similarly we can use the USB storage to load the kernel image/initrd/fdt etc
  231. and boot. For this example, there is a USB drive plugged in. It has a FAT
  232. 1st partition and an EXT 2nd partition. Using the generic FS (ls/load) makes
  233. it even easier to work with FAT/EXT file systems.
  234. For this example the second EXT partition is used for booting and as rootfs.
  235. The boot files - kernel and the dtb are present in the /boot directory of the
  236. second partition.
  237. Odroid # usb start
  238. (Re)start USB...
  239. USB0: USB EHCI 1.00
  240. scanning bus 0 for devices... 4 USB Device(s) found
  241. scanning usb for storage devices... 1 Storage Device(s) found
  242. scanning usb for ethernet devices...
  243. Error: sms0 address not set. <----- Note the error as usbethaddr
  244. Warning: failed to set MAC address <----- is not set.
  245. 1 Ethernet Device(s) found
  246. Odroid # usb part 0
  247. Partition Map for USB device 0 -- Partition Type: DOS
  248. Part Start Sector Num Sectors UUID Type
  249. 1 3072 263168 000c4046-01 06
  250. 2 266240 13457408 000c4046-02 83
  251. Odroid # ls usb 0:2 /boot
  252. <DIR> 4096 .
  253. <DIR> 4096 ..
  254. 353 boot.scr
  255. 281 boot.txt
  256. 101420 config-3.8.13.23
  257. 2127254 initrd.img-3.8.13.23
  258. 2194825 uInitrd
  259. 2194825 uInitrd-3.8.13.23
  260. 2453112 zImage
  261. 101448 config-3.8.13.26
  262. 2127670 uInitrd-3.8.13.26
  263. 2127606 initrd.img-3.8.13.26
  264. 3194200 zImage.3.17 <--- Kernel
  265. 46935 exynos4412-odroidu3.dtb <--- DTB
  266. Odroid # load usb 0:2 40080000 /boot/zImage.3.17
  267. 3194200 bytes read in 471 ms (6.5 MiB/s)
  268. Odroid # load usb 0:2 42000000 /boot/exynos4412-odroidu3.dtb
  269. 46935 bytes read in 233 ms (196.3 KiB/s)
  270. Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/sda2 rootwait
  271. Odroid # bootz 40080000 - 42000000
  272. Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
  273. ## Flattened Device Tree blob at 42000000
  274. Booting using the fdt blob at 0x42000000
  275. Loading Device Tree to 4fff1000, end 4ffff756 ... OK
  276. Starting kernel ...
  277. [ 0.000000] Booting Linux on physical CPU 0xa00
  278. Please refer to README.usb for additional information.