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