Hi Fabio, Did you use the boot partition?
I mean, why don't we use "mmc partconf 0 0 1 0" So that we can flash u-boot to partition 1 and leave partition 0 for distro install. The following sequence should work. init setup 1. mmc dev 2 2. mmc partconf 0 0 1 0 flash u-boot 1. tftp ${loadaddr} flash.bin 2. setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200 3. mmc dev 2 1 4. mmc write $loadaddr 0x42 $blkcnt 5. tftp ${loadaddr} u-boot.itb 6. setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200 7. mmc dev 2 1 8. mmc write $loadaddr 0x300 $blkcnt Yours, Paul On Fri, 13 Aug 2021 at 08:59, Fabio Estevam <feste...@denx.de> wrote: > Add documentation for building and flashing mainline U-Boot > in the IOT-GATE-iMX8 board. > > Signed-off-by: Fabio Estevam <feste...@denx.de> > --- > doc/board/compulab/imx8mm-cl-iot-gate.rst | 84 +++++++++++++++++++++++ > doc/board/index.rst | 1 + > 2 files changed, 85 insertions(+) > create mode 100644 doc/board/compulab/imx8mm-cl-iot-gate.rst > > diff --git a/doc/board/compulab/imx8mm-cl-iot-gate.rst > b/doc/board/compulab/imx8mm-cl-iot-gate.rst > new file mode 100644 > index 000000000000..b63b8d61f13f > --- /dev/null > +++ b/doc/board/compulab/imx8mm-cl-iot-gate.rst > @@ -0,0 +1,83 @@ > +.. SPDX-License-Identifier: GPL-2.0+ > + > +IOT-GATE-iMX8 > +============= > + > +U-Boot for Compulab i.MX8MM IoT Gateway board. > + > +Quick Start > +----------- > + > +- Build the ARM Trusted firmware binary > +- Get the DDR firmwares > +- Build U-Boot > +- Flash U-Boot into the eMMC > + > +Get and build the ARM Trusted firmware > +-------------------------------------- > + > +Note: builddir is U-Boot build directory (source directory for in-tree > builds). > + > +Get mainline ATF: > + > +.. code-block:: bash > + > + $ git clone https://github.com/ARM-software/arm-trusted-firmware.git > + $ cd arm-trusted-firmware > + $ git checkout v2.5 > + > +Generate the bl31.bin ATF binary: > + > +.. code-block:: bash > + > + $ export CROSS_COMPILE=aarch64-poky-linux- > + $ make PLAT=imx8mm IMX_BOOT_UART_BASE=0x30880000 bl31 > + $ cp build/imx8mm/release/bl31.bin $(builddir) > + > +Get the DDR firmwares > +--------------------- > + > +.. code-block:: bash > + > + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin > + $ chmod +x firmware-imx-8.9.bin > + $ ./firmware-imx-8.9 > + $ cp firmware-imx-8.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir) > + > +Build U-Boot > +------------ > + > +.. code-block:: bash > + > + $ export CROSS_COMPILE=aarch64-poky-linux- > + $ make imx8mm-cl-iot-gate_defconfig > + $ export ATF_LOAD_ADDR=0x920000 > + $ make > + > +This will result in two binaries: flash.bin and u-boot.itb. > + > +Flash U-Boot into the eMMC > +-------------------------- > + > +Make sure to have access to the IOTG-ACC-M2SD adapter to recover > +the board in case something goes wrong. More details at: > + > https://mediawiki.compulab.com/w/index.php?title=IOT-GATE-iMX8_and_SBC-IOT-iMX8:_U-Boot:_Recovery > + > +The flash.bin and u-boot.itb binaries need to be flashed into the eMMC at > +offset 33K and 384K, respectively. > + > +These binaries can be transferred from the host PC to the board running > +U-Boot via TFTP: > + > +.. code-block:: bash > + > + => mmc dev 2 > + => mmc partconf 2 1 7 0 (This is only needed to be done for the first > time) > + > + => tftp $loadaddr flash.bin > + => setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200 > + => mmc write $loadaddr 0x42 $blkcnt > + > + => tftp $loadaddr u-boot.itb > + => setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200 > + => mmc write $loadaddr 0x300 $blkcnt > diff --git a/doc/board/index.rst b/doc/board/index.rst > index 9e9097889161..5c5420f3d75a 100644 > --- a/doc/board/index.rst > +++ b/doc/board/index.rst > @@ -11,6 +11,7 @@ Board-specific doc > AndesTech/index > amlogic/index > atmel/index > + compulab/index > congatec/index > coreboot/index > emulation/index > -- > 2.25.1 > >