README.odroid 11 KB

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