1dab14934SVanessa MaegimaHow to Update U-Boot on Pico-imx6ul board
2dab14934SVanessa Maegima-----------------------------------------
3dab14934SVanessa Maegima
4dab14934SVanessa MaegimaRequired software on the host PC:
5dab14934SVanessa Maegima
6dab14934SVanessa Maegima- imx_usb_loader: https://github.com/boundarydevices/imx_usb_loader
7dab14934SVanessa Maegima
8dab14934SVanessa Maegima- dfu-util: http://dfu-util.sourceforge.net/releases/
9dab14934SVanessa Maegima
10dab14934SVanessa MaegimaBuild U-Boot for Pico:
11dab14934SVanessa Maegima
12dab14934SVanessa Maegima$ make mrproper
13dab14934SVanessa Maegima$ make pico-imx6ul_defconfig
14dab14934SVanessa Maegima$ make
15dab14934SVanessa Maegima
16*28a36fd8SFabio EstevamThis generates the SPL and u-boot-dtb.img binaries.
17c97c9e08SFabio Estevam
18c97c9e08SFabio Estevam1. Loading U-Boot via USB Serial Download Protocol
19c97c9e08SFabio Estevam
20c97c9e08SFabio EstevamNote: This method is convenient for development purposes.
21c97c9e08SFabio EstevamIf the eMMC has already a U-Boot flashed with DFU support then
22c97c9e08SFabio Estevamthe user can go to step 2 below in order to update U-Boot.
23dab14934SVanessa Maegima
24dab14934SVanessa MaegimaPut pico board in USB download mode (refer to the document
25978138faSOtavio Salvadorhttp://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf
26978138faSOtavio Salvadorpage 15).
27dab14934SVanessa Maegima
28978138faSOtavio SalvadorConnect a USB to serial adapter between the host PC and pico.
29dab14934SVanessa Maegima
30978138faSOtavio SalvadorConnect a USB cable between the OTG pico port and the host PC.
31dab14934SVanessa Maegima
32978138faSOtavio SalvadorOpen a terminal program such as minicom.
33dab14934SVanessa Maegima
34*28a36fd8SFabio EstevamCopy SPL and u-boot-dtb.img to the imx_usb_loader folder.
35dab14934SVanessa Maegima
36c97c9e08SFabio EstevamLoad the SPL binary via USB:
37dab14934SVanessa Maegima
38c97c9e08SFabio Estevam$ sudo ./imx_usb SPL
39c97c9e08SFabio Estevam
40*28a36fd8SFabio EstevamLoad the u-boot-dtb.img binary via USB:
41c97c9e08SFabio Estevam
42*28a36fd8SFabio Estevam$ sudo ./imx_usb u-boot-dtb.img
43dab14934SVanessa Maegima
44978138faSOtavio SalvadorThen U-Boot starts and its messages appear in the console program.
45dab14934SVanessa Maegima
46dab14934SVanessa MaegimaUse the default environment variables:
47dab14934SVanessa Maegima
48dab14934SVanessa Maegima=> env default -f -a
49dab14934SVanessa Maegima=> saveenv
50dab14934SVanessa Maegima
51c97c9e08SFabio Estevam2. Flashing U-Boot into the eMMC
52c97c9e08SFabio Estevam
53978138faSOtavio SalvadorRun the DFU agent so we can flash the new images using dfu-util tool:
54978138faSOtavio Salvador
55dab14934SVanessa Maegima=> dfu 0 mmc 0
56dab14934SVanessa Maegima
57*28a36fd8SFabio EstevamFlash SPL and u-boot-dtb.img into the eMMC running the following commands on a PC:
58dab14934SVanessa Maegima
59c97c9e08SFabio Estevam$ sudo dfu-util -D SPL -a spl
60c97c9e08SFabio Estevam
61*28a36fd8SFabio Estevam$ sudo dfu-util -D u-boot-dtb.img -a u-boot
62dab14934SVanessa Maegima
63dab14934SVanessa MaegimaRemove power from the pico board.
64dab14934SVanessa Maegima
65978138faSOtavio SalvadorPut pico board into normal boot mode.
66dab14934SVanessa Maegima
67dab14934SVanessa MaegimaPower up the board and the new updated U-Boot should boot from eMMC.
68d27748b7SFabio Estevam
69d27748b7SFabio EstevamBooting in Falcon mode
70d27748b7SFabio Estevam======================
71d27748b7SFabio Estevam
72d27748b7SFabio EstevamGenerate a uImage kernel:
73d27748b7SFabio Estevam
74d27748b7SFabio Estevam$ make imx_v6_v7_defconfig (Using the default imx_v6_v7_defconfig configuration
75d27748b7SFabio Estevamjust for an example. In order to boot faster the user should customize the
76d27748b7SFabio Estevamdefconfig by only enabling the minimal required drivers).
77d27748b7SFabio Estevam
78d27748b7SFabio Estevam$ make -j4 uImage LOADADDR=0x80800000
79d27748b7SFabio Estevam
80d27748b7SFabio Estevam$ cp arch/arm/boot/uImage /tftpboot
81d27748b7SFabio Estevam$ cp arch/arm/boot/dts/imx6ul-pico-hobbit.dtb /tftpboot
82d27748b7SFabio Estevam
83d27748b7SFabio EstevamIn the U-Boot prompt:
84d27748b7SFabio Estevam
85d27748b7SFabio EstevamSetup the server and board IP addresses:
86d27748b7SFabio Estevam=> setenv serverip 192.168.0.10
87d27748b7SFabio Estevam=> setenv ipaddr 192.168.0.11
88d27748b7SFabio Estevam
89d27748b7SFabio EstevamGet the dtb file:
90d27748b7SFabio Estevam=> tftp ${fdt_addr} imx6ul-pico-hobbit.dtb
91d27748b7SFabio Estevam
92d27748b7SFabio EstevamGet the kernel:
93d27748b7SFabio Estevam=> tftp ${loadaddr} uImage
94d27748b7SFabio Estevam
95d27748b7SFabio EstevamWrite the kernel at 2MB offset:
96d27748b7SFabio Estevam=> mmc write ${loadaddr} 0x1000 0x4000
97d27748b7SFabio Estevam
98d27748b7SFabio EstevamSetup the bootargs:
99d27748b7SFabio Estevam=> setenv bootargs 'console=ttymxc5,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw'
100d27748b7SFabio Estevam
101d27748b7SFabio EstevamPrepare args:
102d27748b7SFabio Estevam=> spl export fdt ${loadaddr} - ${fdt_addr}
103d27748b7SFabio Estevam## Booting kernel from Legacy Image at 82000000 ...
104d27748b7SFabio Estevam   Image Name:   Linux-4.19.0-rc2-next-20180905-0
105d27748b7SFabio Estevam   Image Type:   ARM Linux Kernel Image (uncompressed)
106d27748b7SFabio Estevam   Data Size:    8365608 Bytes = 8 MiB
107d27748b7SFabio Estevam   Load Address: 80800000
108d27748b7SFabio Estevam   Entry Point:  80800000
109d27748b7SFabio Estevam   Verifying Checksum ... OK
110d27748b7SFabio Estevam## Flattened Device Tree blob at 83000000
111d27748b7SFabio Estevam   Booting using the fdt blob at 0x83000000
112d27748b7SFabio Estevam   Loading Kernel Image ... OK
113d27748b7SFabio Estevam   Using Device Tree in place at 83000000, end 83009c63
114d27748b7SFabio Estevamsubcommand not supported
115d27748b7SFabio Estevamsubcommand not supported
116d27748b7SFabio Estevam   Using Device Tree in place at 83000000, end 8300cc63
117d27748b7SFabio EstevamArgument image is now in RAM: 0x83000000
118d27748b7SFabio Estevam
119d27748b7SFabio EstevamWrite 1MB of args data (0x800 sectors) to 1MB offset (0x800 sectors):
120d27748b7SFabio Estevam
121d27748b7SFabio Estevam=> mmc write ${fdt_addr} 0x800 0x800
122d27748b7SFabio Estevam
123d27748b7SFabio EstevamIn order to boot with Falcon mode, activate the CONFIG_SPL_OS_BOOT
124d27748b7SFabio Estevamoption in the defconfig
125d27748b7SFabio Estevam
126d27748b7SFabio Estevam--- a/configs/pico-hobbit-imx6ul_defconfig
127d27748b7SFabio Estevam+++ b/configs/pico-hobbit-imx6ul_defconfig
128d27748b7SFabio Estevam@@ -53,3 +53,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
129d27748b7SFabio Estevam CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
130d27748b7SFabio Estevam CONFIG_CI_UDC=y
131d27748b7SFabio Estevam CONFIG_OF_LIBFDT=y
132d27748b7SFabio Estevam+CONFIG_SPL_OS_BOOT=y
133d27748b7SFabio Estevam
134d27748b7SFabio EstevamThen rebuild U-Boot:
135d27748b7SFabio Estevam
136d27748b7SFabio Estevam$ make pico-hobbit-imx6ul_defconfig
137d27748b7SFabio Estevam$ make -j4
138d27748b7SFabio Estevam
139d27748b7SFabio EstevamLaunch UMS:
140d27748b7SFabio Estevam=> ums 0 mmc 0
141d27748b7SFabio Estevam
142d27748b7SFabio EstevamFlash the new binaries:
143d27748b7SFabio Estevam
144d27748b7SFabio Estevam$ sudo dd if=SPL of=/dev/sdX bs=1k seek=1; sync
145*28a36fd8SFabio Estevam$ sudo dd if=u-boot-dtb.img  of=/dev/sdX bs=1k seek=69; sync
146d27748b7SFabio Estevam
147d27748b7SFabio EstevamAnd then SPL binary will load and jump directly to the kernel:
148d27748b7SFabio Estevam
149d27748b7SFabio EstevamU-Boot SPL 2018.09-rc2-00156-g8c46f15-dirty (Sep 05 2018 - 16:24:05 -0300)
150d27748b7SFabio EstevamTrying to boot from MMC1
151d27748b7SFabio Estevam[    0.000000] Booting Linux on physical CPU 0x0
152d27748b7SFabio Estevam[    0.000000] Linux version 4.19.0-rc2-next-20180905-00001-gb805e2d (fabio@fabio-Latitude-E5450) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)) #533 SMP Wed Sep 5 16:21:03 -03 2018
153d27748b7SFabio Estevam[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
154d27748b7SFabio Estevam[    0.000000] CPU: div instructions available: patching division code
155d27748b7SFabio Estevam[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
156d27748b7SFabio Estevam[    0.000000] OF: fdt: Machine model: Technexion Pico i.MX6UL Board
157d27748b7SFabio Estevam[    0.000000] Memory policy: Data cache writealloc
158d27748b7SFabio Estevam[    0.000000] cma: Reserved 64 MiB at 0x8c000000
159d27748b7SFabio Estevam...
160