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