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