Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 1 | How to Update U-Boot on Pico-imx6ul board |
| 2 | ----------------------------------------- |
| 3 | |
| 4 | Required software on the host PC: |
| 5 | |
| 6 | - imx_usb_loader: https://github.com/boundarydevices/imx_usb_loader |
| 7 | |
| 8 | - dfu-util: http://dfu-util.sourceforge.net/releases/ |
| 9 | |
| 10 | Build U-Boot for Pico: |
| 11 | |
| 12 | $ make mrproper |
| 13 | $ make pico-imx6ul_defconfig |
| 14 | $ make |
| 15 | |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 16 | This generates the SPL and u-boot-dtb.img binaries. |
Fabio Estevam | c45978b | 2018-09-04 10:23:13 -0300 | [diff] [blame] | 17 | |
| 18 | 1. Loading U-Boot via USB Serial Download Protocol |
| 19 | |
| 20 | Note: This method is convenient for development purposes. |
| 21 | If the eMMC has already a U-Boot flashed with DFU support then |
| 22 | the user can go to step 2 below in order to update U-Boot. |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 23 | |
| 24 | Put pico board in USB download mode (refer to the document |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 25 | http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf |
| 26 | page 15). |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 27 | |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 28 | Connect a USB to serial adapter between the host PC and pico. |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 29 | |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 30 | Connect a USB cable between the OTG pico port and the host PC. |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 31 | |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 32 | Open a terminal program such as minicom. |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 33 | |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 34 | Copy SPL and u-boot-dtb.img to the imx_usb_loader folder. |
Fabio Estevam | c45978b | 2018-09-04 10:23:13 -0300 | [diff] [blame] | 35 | |
| 36 | Load the SPL binary via USB: |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 37 | |
Fabio Estevam | c45978b | 2018-09-04 10:23:13 -0300 | [diff] [blame] | 38 | $ sudo ./imx_usb SPL |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 39 | |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 40 | Load the u-boot-dtb.img binary via USB: |
Fabio Estevam | c45978b | 2018-09-04 10:23:13 -0300 | [diff] [blame] | 41 | |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 42 | $ sudo ./imx_usb u-boot-dtb.img |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 43 | |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 44 | Then U-Boot starts and its messages appear in the console program. |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 45 | |
| 46 | Use the default environment variables: |
| 47 | |
| 48 | => env default -f -a |
| 49 | => saveenv |
| 50 | |
Fabio Estevam | c45978b | 2018-09-04 10:23:13 -0300 | [diff] [blame] | 51 | 2. Flashing U-Boot into the eMMC |
| 52 | |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 53 | Run the DFU agent so we can flash the new images using dfu-util tool: |
| 54 | |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 55 | => dfu 0 mmc 0 |
| 56 | |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 57 | Flash SPL and u-boot-dtb.img into the eMMC running the following commands on a PC: |
Fabio Estevam | c45978b | 2018-09-04 10:23:13 -0300 | [diff] [blame] | 58 | |
| 59 | $ sudo dfu-util -D SPL -a spl |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 60 | |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 61 | $ sudo dfu-util -D u-boot-dtb.img -a u-boot |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 62 | |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 63 | Remove power from the pico board. |
| 64 | |
Otavio Salvador | 145c536 | 2018-09-04 10:23:17 -0300 | [diff] [blame] | 65 | Put pico board into normal boot mode. |
Vanessa Maegima | 96bd20e | 2016-06-15 12:48:15 -0300 | [diff] [blame] | 66 | |
| 67 | Power up the board and the new updated U-Boot should boot from eMMC. |
Fabio Estevam | 561c221 | 2018-09-13 16:57:06 -0300 | [diff] [blame] | 68 | |
| 69 | Booting in Falcon mode |
| 70 | ====================== |
| 71 | |
| 72 | Generate a uImage kernel: |
| 73 | |
| 74 | $ make imx_v6_v7_defconfig (Using the default imx_v6_v7_defconfig configuration |
| 75 | just for an example. In order to boot faster the user should customize the |
| 76 | defconfig by only enabling the minimal required drivers). |
| 77 | |
| 78 | $ make -j4 uImage LOADADDR=0x80800000 |
| 79 | |
| 80 | $ cp arch/arm/boot/uImage /tftpboot |
| 81 | $ cp arch/arm/boot/dts/imx6ul-pico-hobbit.dtb /tftpboot |
| 82 | |
| 83 | In the U-Boot prompt: |
| 84 | |
| 85 | Setup the server and board IP addresses: |
| 86 | => setenv serverip 192.168.0.10 |
| 87 | => setenv ipaddr 192.168.0.11 |
| 88 | |
| 89 | Get the dtb file: |
| 90 | => tftp ${fdt_addr} imx6ul-pico-hobbit.dtb |
| 91 | |
| 92 | Get the kernel: |
| 93 | => tftp ${loadaddr} uImage |
| 94 | |
| 95 | Write the kernel at 2MB offset: |
| 96 | => mmc write ${loadaddr} 0x1000 0x4000 |
| 97 | |
| 98 | Setup the bootargs: |
| 99 | => setenv bootargs 'console=ttymxc5,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw' |
| 100 | |
| 101 | Prepare args: |
| 102 | => spl export fdt ${loadaddr} - ${fdt_addr} |
| 103 | ## Booting kernel from Legacy Image at 82000000 ... |
| 104 | Image Name: Linux-4.19.0-rc2-next-20180905-0 |
| 105 | Image Type: ARM Linux Kernel Image (uncompressed) |
| 106 | Data Size: 8365608 Bytes = 8 MiB |
| 107 | Load Address: 80800000 |
| 108 | Entry Point: 80800000 |
| 109 | Verifying Checksum ... OK |
| 110 | ## Flattened Device Tree blob at 83000000 |
| 111 | Booting using the fdt blob at 0x83000000 |
| 112 | Loading Kernel Image ... OK |
| 113 | Using Device Tree in place at 83000000, end 83009c63 |
| 114 | subcommand not supported |
| 115 | subcommand not supported |
| 116 | Using Device Tree in place at 83000000, end 8300cc63 |
| 117 | Argument image is now in RAM: 0x83000000 |
| 118 | |
| 119 | Write 1MB of args data (0x800 sectors) to 1MB offset (0x800 sectors): |
| 120 | |
| 121 | => mmc write ${fdt_addr} 0x800 0x800 |
| 122 | |
| 123 | In order to boot with Falcon mode, activate the CONFIG_SPL_OS_BOOT |
| 124 | option in the defconfig |
| 125 | |
| 126 | --- a/configs/pico-hobbit-imx6ul_defconfig |
| 127 | +++ b/configs/pico-hobbit-imx6ul_defconfig |
| 128 | @@ -53,3 +53,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 |
| 129 | CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 |
| 130 | CONFIG_CI_UDC=y |
| 131 | CONFIG_OF_LIBFDT=y |
| 132 | +CONFIG_SPL_OS_BOOT=y |
| 133 | |
| 134 | Then rebuild U-Boot: |
| 135 | |
| 136 | $ make pico-hobbit-imx6ul_defconfig |
| 137 | $ make -j4 |
| 138 | |
| 139 | Launch UMS: |
| 140 | => ums 0 mmc 0 |
| 141 | |
| 142 | Flash the new binaries: |
| 143 | |
| 144 | $ sudo dd if=SPL of=/dev/sdX bs=1k seek=1; sync |
Fabio Estevam | 0fe7c85 | 2019-02-14 10:01:51 -0200 | [diff] [blame] | 145 | $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1k seek=69; sync |
Fabio Estevam | 561c221 | 2018-09-13 16:57:06 -0300 | [diff] [blame] | 146 | |
| 147 | And then SPL binary will load and jump directly to the kernel: |
| 148 | |
| 149 | U-Boot SPL 2018.09-rc2-00156-g8c46f15-dirty (Sep 05 2018 - 16:24:05 -0300) |
| 150 | Trying to boot from MMC1 |
| 151 | [ 0.000000] Booting Linux on physical CPU 0x0 |
| 152 | [ 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 |
| 153 | [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d |
| 154 | [ 0.000000] CPU: div instructions available: patching division code |
| 155 | [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache |
| 156 | [ 0.000000] OF: fdt: Machine model: Technexion Pico i.MX6UL Board |
| 157 | [ 0.000000] Memory policy: Data cache writealloc |
| 158 | [ 0.000000] cma: Reserved 64 MiB at 0x8c000000 |
| 159 | ... |