Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 1 | How to update U-Boot on pico-imx7d board |
| 2 | ---------------------------------------- |
| 3 | |
| 4 | Required software on the host PC: |
| 5 | |
| 6 | - imx_usb_loader: https://github.com/boundarydevices/imx_usb_loader |
| 7 | |
| 8 | Build U-Boot for pico: |
| 9 | |
| 10 | $ make mrproper |
| 11 | $ make pico-imx7d_defconfig |
| 12 | $ make |
| 13 | |
Fabio Estevam | cfabd11 | 2019-04-26 09:36:23 -0300 | [diff] [blame] | 14 | This generates the SPL and u-boot-dtb.img binaries. |
Fabio Estevam | 23e08f9 | 2018-09-04 10:23:12 -0300 | [diff] [blame] | 15 | |
| 16 | 1. Loading U-Boot via USB Serial Download Protocol |
| 17 | |
| 18 | Note: This method is convenient for development purposes. |
| 19 | If the eMMC has already a U-Boot flashed with DFU support then |
| 20 | the user can go to step 2 below in order to update U-Boot. |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 21 | |
| 22 | Put pico board in USB download mode (refer to the PICO-iMX7D Quick Start Guide |
| 23 | page 3) |
| 24 | |
| 25 | Connect a USB to serial adapter between the host PC and pico. |
| 26 | |
| 27 | Connect a USB cable between the OTG pico port and the host PC. |
| 28 | |
Fabio Estevam | 7fabe8d | 2019-03-27 20:03:39 -0300 | [diff] [blame] | 29 | Note: Some computers may be a bit strict with USB current draw and will |
| 30 | shut down their ports if the draw is too high. The solution for that is |
| 31 | to use an externally powered USB hub between the board and the host computer. |
| 32 | |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 33 | Open a terminal program such as minicom. |
| 34 | |
Fabio Estevam | cfabd11 | 2019-04-26 09:36:23 -0300 | [diff] [blame] | 35 | Copy SPL and u-boot-dtb.img to the imx_usb_loader folder. |
Fabio Estevam | 23e08f9 | 2018-09-04 10:23:12 -0300 | [diff] [blame] | 36 | |
| 37 | Load the SPL binary via USB: |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 38 | |
Fabio Estevam | 23e08f9 | 2018-09-04 10:23:12 -0300 | [diff] [blame] | 39 | $ sudo ./imx_usb SPL |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 40 | |
Fabio Estevam | cfabd11 | 2019-04-26 09:36:23 -0300 | [diff] [blame] | 41 | Load the u-boot-dtb.img binary via USB: |
Fabio Estevam | 23e08f9 | 2018-09-04 10:23:12 -0300 | [diff] [blame] | 42 | |
Fabio Estevam | cfabd11 | 2019-04-26 09:36:23 -0300 | [diff] [blame] | 43 | $ sudo ./imx_usb u-boot-dtb.img |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 44 | |
| 45 | Then U-Boot starts and its messages appear in the console program. |
| 46 | |
| 47 | Use the default environment variables: |
| 48 | |
| 49 | => env default -f -a |
| 50 | => saveenv |
| 51 | |
Fabio Estevam | 23e08f9 | 2018-09-04 10:23:12 -0300 | [diff] [blame] | 52 | 2. Flashing U-Boot into the eMMC |
| 53 | |
Otavio Salvador | 938aa68 | 2018-06-29 15:19:19 -0300 | [diff] [blame] | 54 | Run the DFU agent so we can flash the new images using dfu-util tool: |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 55 | |
Otavio Salvador | 938aa68 | 2018-06-29 15:19:19 -0300 | [diff] [blame] | 56 | => dfu 0 mmc 0 |
| 57 | |
Fabio Estevam | cfabd11 | 2019-04-26 09:36:23 -0300 | [diff] [blame] | 58 | Flash SPL and u-boot-dtb.img into the eMMC running the following commands on a PC: |
Otavio Salvador | 938aa68 | 2018-06-29 15:19:19 -0300 | [diff] [blame] | 59 | |
| 60 | $ sudo dfu-util -D SPL -a spl |
| 61 | |
Fabio Estevam | cfabd11 | 2019-04-26 09:36:23 -0300 | [diff] [blame] | 62 | $ sudo dfu-util -D u-boot-dtb.img -a u-boot |
Vanessa Maegima | 27142c3 | 2017-05-08 13:17:28 -0300 | [diff] [blame] | 63 | |
| 64 | Remove power from the pico board. |
| 65 | |
| 66 | Put pico board into normal boot mode. |
| 67 | |
| 68 | Power up the board and the new updated U-Boot should boot from eMMC. |
Fabio Estevam | a159ffa | 2019-09-11 14:29:52 -0300 | [diff] [blame] | 69 | |
| 70 | Booting in Falcon mode |
| 71 | ====================== |
| 72 | |
| 73 | Generate a uImage kernel: |
| 74 | |
| 75 | $ make imx_v6_v7_defconfig (Using the default imx_v6_v7_defconfig configuration |
| 76 | just for an example. In order to boot faster the user should customize the |
| 77 | defconfig by only enabling the minimal required drivers). |
| 78 | |
| 79 | $ make -j4 uImage LOADADDR=0x80008000 |
| 80 | |
| 81 | $ cp arch/arm/boot/uImage /tftpboot |
| 82 | $ cp arch/arm/boot/dts/imx7d-pico-pi.dtb /tftpboot |
| 83 | |
| 84 | In the U-Boot prompt: |
| 85 | |
| 86 | Setup the server and board IP addresses: |
| 87 | => setenv serverip 192.168.0.10 |
| 88 | => setenv ipaddr 192.168.0.11 |
| 89 | |
| 90 | Get the dtb file: |
| 91 | => tftp ${fdt_addr} imx7d-pico-pi.dtb |
| 92 | |
| 93 | Get the kernel: |
| 94 | => tftp ${loadaddr} uImage |
| 95 | |
| 96 | Write the kernel at 2MB offset: |
| 97 | => mmc write ${loadaddr} 0x1000 0x5000 |
| 98 | |
| 99 | Setup the bootargs: |
| 100 | => setenv bootargs 'console=ttymxc4,115200 root=/dev/mmcblk2p1 rootfstype=ext4 rootwait rw' |
| 101 | |
| 102 | Prepare args: |
| 103 | => spl export fdt ${loadaddr} - ${fdt_addr} |
| 104 | ## Booting kernel from Legacy Image at 80800000 ... |
| 105 | Image Name: Linux-5.2.14 |
| 106 | Image Type: ARM Linux Kernel Image (uncompressed) |
| 107 | Data Size: 9077544 Bytes = 8.7 MiB |
| 108 | Load Address: 80008000 |
| 109 | Entry Point: 80008000 |
| 110 | Verifying Checksum ... OK |
| 111 | ## Flattened Device Tree blob at 83000000 |
| 112 | Booting using the fdt blob at 0x83000000 |
| 113 | Loading Kernel Image |
| 114 | Using Device Tree in place at 83000000, end 8300b615 |
| 115 | subcommand not supported |
| 116 | subcommand not supported |
| 117 | Using Device Tree in place at 83000000, end 8300e615 |
| 118 | Argument image is now in RAM: 0x83000000 |
| 119 | => |
| 120 | |
| 121 | Write 1MB of args data (0x800 sectors) to 1MB offset (0x800 sectors): |
| 122 | |
| 123 | => mmc write ${fdt_addr} 0x800 0x800 |
| 124 | |
| 125 | In order to boot with Falcon mode, activate the CONFIG_SPL_OS_BOOT |
| 126 | option in the defconfig |
| 127 | |
| 128 | --- a/configs/pico-imx7d_defconfig |
| 129 | +++ b/configs/pico-imx7d_defconfig |
| 130 | @@ -67,3 +67,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 |
| 131 | CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 |
| 132 | CONFIG_CI_UDC=y |
| 133 | CONFIG_VIDEO=y |
| 134 | +CONFIG_SPL_OS_BOOT=y |
| 135 | |
| 136 | Then rebuild U-Boot: |
| 137 | |
| 138 | $ make pico-imx7d_defconfig |
| 139 | $ make -j4 |
| 140 | |
| 141 | Launch UMS: |
| 142 | => ums 0 mmc 0 |
| 143 | |
| 144 | Flash the new binaries: |
| 145 | |
| 146 | $ sudo dd if=SPL of=/dev/sdX bs=1k seek=1; sync |
| 147 | $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1k seek=69; sync |
| 148 | |
| 149 | And then SPL binary will load and jump directly to the kernel: |
| 150 | |
| 151 | U-Boot SPL 2019.10-rc3-00284-g001c8ea94a-dirty (Sep 10 2019 - 12:46:01 -0300) |
| 152 | Trying to boot from MMC1 |
| 153 | [ 0.000000] Booting Linux on physical CPU 0x0 |
| 154 | [ 0.000000] Linux version 5.2.14 (fabio@fabio-OptiPlex-7010) (gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #30 SMP Wed Sep 10 12:36:27 -03 2019 |
| 155 | [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d |
| 156 | [ 0.000000] CPU: div instructions available: patching division code |
| 157 | [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache |
| 158 | [ 0.000000] OF: fdt: Machine model: TechNexion PICO-IMX7D Board and PI baseboard |
| 159 | ... |