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