Przemyslaw Marczak | a314d9e | 2014-09-01 13:50:53 +0200 | [diff] [blame] | 1 | U-boot for Odroid X2/U3 |
| 2 | ======================== |
| 3 | |
| 4 | 1. Summary |
| 5 | ========== |
| 6 | This is a quick instruction for setup Odroid boards based on Exynos4412. |
| 7 | Board config: odroid_config |
| 8 | |
| 9 | 2. Supported devices |
| 10 | ==================== |
| 11 | This U-BOOT config can be used on two boards: |
| 12 | - Odroid U3 |
| 13 | - Odroid X2 |
| 14 | with CPU Exynos 4412 rev 2.0 and 2GB of RAM |
| 15 | |
| 16 | 3. Boot sequence |
| 17 | ================ |
| 18 | iROM->BL1->(BL2 + TrustZone)->U-BOOT |
| 19 | |
| 20 | This version of U-BOOT doesn't implement SPL but it is required(BL2) |
| 21 | and can be found in "boot.tar.gz" from here: |
| 22 | http://dev.odroid.com/projects/4412boot/wiki/FrontPage?action=download&value=boot.tar.gz |
| 23 | or here: |
| 24 | http://odroid.in/guides/ubuntu-lfs/boot.tar.gz |
| 25 | |
| 26 | 4. Boot media layout |
| 27 | ==================== |
| 28 | The table below shows SD/eMMC cards layout for U-boot. |
| 29 | The 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 | |
| 41 | 5. Prepare the SD boot card - with SD card reader |
| 42 | ================================================= |
| 43 | To prepare bootable media you need boot binaries provided by hardkernel. |
| 44 | File "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 | |
| 51 | This is all you need to boot this board. But if you want to use your custom |
| 52 | u-boot then you need to change u-boot.bin with your own u-boot binary* |
| 53 | and run the script "sd_fusing.sh" - this script is valid only for SD card. |
| 54 | |
| 55 | *note: |
| 56 | The proper binary file of current U-boot is u-boot-dtb.bin. |
| 57 | |
| 58 | quick 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) |
| 63 | Check if Hardkernel U-boot is booting, and next do the same with your U-boot. |
| 64 | |
| 65 | 6. Prepare the eMMC boot card |
| 66 | with a eMMC card reader (boot from eMMC card slot) |
| 67 | ===================================================== |
| 68 | To boot the device from the eMMC slot you should use a special card reader |
| 69 | which supports eMMC partiion switch. All of the boot binaries are stored |
| 70 | on the eMMC boot partition which is normally hidden. |
| 71 | |
| 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 | |
| 76 | 7. Prepare the eMMC boot card |
| 77 | with a SD card reader (boot from SD card slot) |
| 78 | ================================================= |
| 79 | If you have an eMMC->microSD adapter you can prepare the card as in point 5. |
| 80 | But then the device can boot only from the SD card slot. |
| 81 | |
| 82 | 8. Prepare the boot media using Hardkernel U-boot |
| 83 | ================================================= |
| 84 | You can update the U-boot to the custom one if you have an working bootloader |
| 85 | delivered 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 | |
| 92 | 9. Partition layout |
| 93 | ==================== |
| 94 | Default U-boot environment is setup for fixed partiion layout. |
| 95 | |
| 96 | Partition 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: |
| 106 | Supported fdt files are: |
| 107 | - exynos4412-odroidx2.dtb |
| 108 | - exynos4412-odroidu3.dtb |
| 109 | |
| 110 | Supported kernel files are: |
| 111 | - Image.itb |
| 112 | - zImage |
| 113 | - uImage |
| 114 | |
| 115 | The default environmental variable "dfu_alt_info" is set* for above layout. |
| 116 | Each partition size is just an example, dfu_alt_info tries init two partitions. |
| 117 | The 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 | |
| 124 | To add any changes to dfu_alt_info - please modify $dfu_alt_system only. |
| 125 | Changes are visible after board reset. |
| 126 | |
| 127 | 10. The environment and booting the kernel |
| 128 | ========================================== |
| 129 | There are three macros defined in config for various boot options: |
| 130 | Two for both, kernel with device tree support and also without it: |
| 131 | - boot_uimg - load uImage |
| 132 | - boot_zimg - load zImage |
| 133 | If proper fdt file exists then it will be automatically loaded, |
| 134 | so for old kernel types, please remove fdt file from boot partition. |
| 135 | |
| 136 | The third boot option for multi image support (more info: doc/uImage.FIT/) |
| 137 | - boot_fit - for binary file: "Image.itb" |
| 138 | |
| 139 | Default boot command: "autoboot" |
| 140 | And the boot sequence is: |
| 141 | - boot_fit - if "Image.itb" exists |
| 142 | - boot_zimg - if "zImage" exists |
| 143 | - boot_uimg - if "uImage" exists |
Suriyan Ramasami | 1b39878 | 2014-11-20 17:26:29 -0800 | [diff] [blame^] | 144 | |
| 145 | 11. USB host support |
| 146 | ==================== |
| 147 | |
| 148 | The ethernet can be accessed after starting the USB subsystem in U-Boot. |
| 149 | The adapter does not come with a preconfigured MAC address, and hence it needs |
| 150 | to be set before starting USB. |
| 151 | setenv usbethaddr 02:DE:AD:BE:EF:FF |
| 152 | |
| 153 | Note that in this example a locally managed MAC address is chosen. Care should |
| 154 | be taken to make these MAC addresses unique within the same subnet. |
| 155 | |
| 156 | Start the USB subsystem: |
| 157 | Odroid # setenv usbethaddr 02:DE:AD:BE:EF:FF |
| 158 | Odroid # usb start |
| 159 | (Re)start USB... |
| 160 | USB0: USB EHCI 1.00 |
| 161 | scanning 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 |
| 164 | Odroid # |
| 165 | |
| 166 | Automatic IP assignment: |
| 167 | ------------------------ |
| 168 | If the ethernet is connected to a DHCP server (router maybe with DHCP enabled), |
| 169 | then the below will automatically assign an ip address through DHCP. |
| 170 | setenv autoload no |
| 171 | dhcp |
| 172 | |
| 173 | Odroid # setenv autoload no |
| 174 | Odroid # dhcp |
| 175 | Waiting for Ethernet connection... done. |
| 176 | BOOTP broadcast 1 |
| 177 | DHCP client bound to address 192.168.1.10 (524 ms) |
| 178 | Odroid # |
| 179 | |
| 180 | Note that this automatically sets the many IP address related variables in |
| 181 | U-Boot that is obtained from the DHCP server. |
| 182 | |
| 183 | Odroid # printenv ipaddr netmask gatewayip dnsip |
| 184 | ipaddr=192.168.1.10 |
| 185 | netmask=255.255.255.0 |
| 186 | gatewayip=192.168.1.1 |
| 187 | dnsip=192.168.1.1 |
| 188 | |
| 189 | Ping example: |
| 190 | The ping command can be used a test to check connectivity. In this example, |
| 191 | 192.168.1.27 is a pingable server in the network. |
| 192 | Odroid # ping 192.168.1.27 |
| 193 | Waiting for Ethernet connection... done. |
| 194 | Using sms0 device |
| 195 | host 192.168.1.27 is alive |
| 196 | Odroid # |
| 197 | |
| 198 | Static IP assignment: |
| 199 | --------------------- |
| 200 | In the case where there are no DHCP servers in the network, or you want to |
| 201 | set the IP address statically, it can be done by: |
| 202 | Odroid # setenv ipaddr 192.168.1.10 |
| 203 | Odroid # ping 192.168.1.27 |
| 204 | Waiting for Ethernet connection... done. |
| 205 | Using sms0 device |
| 206 | host 192.168.1.27 is alive |
| 207 | |
| 208 | TFTP booting: |
| 209 | ------------- |
| 210 | Say there exists a tftp server in the network with address 192.168.1.27 and |
| 211 | it serves a kernel image (zImage.3.17) and a DTB blob (exynos4412-odroidu3.dtb) |
| 212 | that 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 | |
| 215 | Odroid # setenv serverip 192.168.1.27 |
| 216 | Odroid # tftpboot 0x40080000 zImage.3.17 |
| 217 | Waiting for Ethernet connection... done. |
| 218 | Using sms0 device |
| 219 | TFTP from server 192.168.1.27; our IP address is 192.168.1.10 |
| 220 | Filename 'zImage.3.17'. |
| 221 | Load address: 0x40080000 |
| 222 | Loading: ################################################################# |
| 223 | ################################################################# |
| 224 | ################################################################# |
| 225 | ####################### |
| 226 | 52.7 KiB/s |
| 227 | done |
| 228 | Bytes transferred = 3194200 (30bd58 hex) |
| 229 | Odroid # tftpboot 0x42000000 exynos4412-odroidu3.dtb |
| 230 | Waiting for Ethernet connection... done. |
| 231 | Using sms0 device |
| 232 | TFTP from server 192.168.1.27; our IP address is 192.168.1.10 |
| 233 | Filename 'exynos4412-odroidu3.dtb'. |
| 234 | Load address: 0x42000000 |
| 235 | Loading: #### |
| 236 | 40 KiB/s |
| 237 | done |
| 238 | Bytes transferred = 46935 (b757 hex) |
| 239 | Odroid # printenv bootargs |
| 240 | bootargs=Please use defined boot |
| 241 | Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/mmcblk0p2 rootwait |
| 242 | Odroid # bootz 40080000 - 42000000 |
| 243 | Kernel 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 | |
| 248 | Starting kernel ... |
| 249 | |
| 250 | [ 0.000000] Booting Linux on physical CPU 0xa00 |
| 251 | ... etc ... |
| 252 | |
| 253 | In the above example you can substitute 'dhcp' for 'tftpboot' as well. |
| 254 | |
| 255 | USB Storage booting: |
| 256 | -------------------- |
| 257 | Similarly we can use the USB storage to load the kernel image/initrd/fdt etc |
| 258 | and boot. For this example, there is a USB drive plugged in. It has a FAT |
| 259 | 1st partition and an EXT 2nd partition. Using the generic FS (ls/load) makes |
| 260 | it even easier to work with FAT/EXT file systems. |
| 261 | For this example the second EXT partition is used for booting and as rootfs. |
| 262 | The boot files - kernel and the dtb are present in the /boot directory of the |
| 263 | second partition. |
| 264 | |
| 265 | Odroid # usb start |
| 266 | (Re)start USB... |
| 267 | USB0: USB EHCI 1.00 |
| 268 | scanning 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... |
| 271 | Error: sms0 address not set. <----- Note the error as usbethaddr |
| 272 | Warning: failed to set MAC address <----- is not set. |
| 273 | 1 Ethernet Device(s) found |
| 274 | Odroid # usb part 0 |
| 275 | |
| 276 | Partition Map for USB device 0 -- Partition Type: DOS |
| 277 | |
| 278 | Part Start Sector Num Sectors UUID Type |
| 279 | 1 3072 263168 000c4046-01 06 |
| 280 | 2 266240 13457408 000c4046-02 83 |
| 281 | |
| 282 | Odroid # 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 |
| 297 | Odroid # load usb 0:2 40080000 /boot/zImage.3.17 |
| 298 | 3194200 bytes read in 471 ms (6.5 MiB/s) |
| 299 | Odroid # load usb 0:2 42000000 /boot/exynos4412-odroidu3.dtb |
| 300 | 46935 bytes read in 233 ms (196.3 KiB/s) |
| 301 | Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/sda2 rootwait |
| 302 | Odroid # bootz 40080000 - 42000000 |
| 303 | Kernel 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 | |
| 308 | Starting kernel ... |
| 309 | |
| 310 | [ 0.000000] Booting Linux on physical CPU 0xa00 |
| 311 | |
| 312 | Please refer to README.usb for additional information. |