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