3. Flashing Images

3.1. Copy files

From <build-dir>/tmp/deploy/images copy what you want to use to a folder of your choice. Normally you will need U-Boot, Kernel, DTB and RootFS.

An example, using the symlink name and de-referencing it:

cp -H tmp/deploy/images/tx8m-1610/imx-boot-tx8m-1610-default.bin ~/<super-project>/
cp -H tmp/deploy/images/tx8m-1610/Image-tx8m-1610.bin ~/<super-project>/
cp tmp/deploy/images/tx8m-1610/imx-boot-tools/imx8mm-tx8m-1610-mipi-mb.dtb ~/<super-project>/
cp -H tmp/deploy/images/tx8m-1610/core-image-minimal-tx8m-1610.rootfs.tar.bz2 ~/<super-project>/

3.2. Getting uuu

The Universal Update Utility is used to program your board.

  1. Get uuu, uuu.exe and libusb-1.0.dll from NXP’s official repository here.
  2. Put these three files inside the folder with your images.

3.3. uuu examples [1]

Hint

The following sections describe the detailed steps of writing the uuu.auto script. You can just download this uuu.auto file, eventually check the filenames, and you should be fine running uuu, to program your module with the Yocto images built before. Make sure to read the Booting an initram section.

3.3.1. Booting U-Boot from uuu

  1. In the folder, where uuu and the image files are, create an empty file named uuu.auto. Add the following lines to it:
uuu_version 1.0.1
# Boot fastboot-uboot
SDP: boot -f imx-boot-tx8m-1610-mfg.bin-flash_tx8m
SDPU: write -f imx-boot-tx8m-1610-mfg.bin-flash_tx8m -offset 0x57c00
SDPU: jump

Note

The version-tag at the beginning of the uuu-script is very important. Instead of mfg U-Boot you can also boot the default U-Boot. For further programming with uuu it is recommended to use the fastboot supporting mfg U-Boot.

3.3.2. Editing environment for future boot

Once booted U-Boot you can edit it’s environment. To do so, append your uuu.auto file from above. The following lines are just some examples:

# Setting u-boot environment
FB: ucmd setenv append_bootargs 'clk_ignore_unused quiet'
FB: ucmd setenv baseboard 'mipi-mb'
FB: ucmd setenv baudrate '115200'
FB: ucmd setenv board 'imx8mm-tx8m-1610'
FB: ucmd setenv board_name 'tx8mm'
FB: ucmd setenv boot_mode 'mmc'
FB: ucmd setenv bootargs_mmc 'run default_bootargs; setenv bootargs ${bootargs} root=PARTUUID=${uuid_rootfs} ${append_bootargs}'
FB: ucmd setenv bootargs_nfs 'run default_bootargs; setenv bootargs root=/dev/nfs nfsroot=${nfs_server}:${nfsroot},nolock ${append_bootargs}'
FB: ucmd setenv bootcmd 'run bootcmd_${boot_mode} bootm_cmd'
FB: ucmd setenv bootcmd_mmc 'run loadkernel loadfdt bootargs_mmc'
FB: ucmd setenv bootcmd_nfs 'run loadkernel loadfdt bootargs_nfs'
FB: ucmd setenv bootdelay '3'
FB: ucmd setenv bootm_cmd 'booti ${loadaddr} ${initrd_addr} ${fdt_addr}'
FB: ucmd setenv console 'ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200'
FB: ucmd setenv default_bootargs 'setenv bootargs console=${console} panic=-1 ro'
FB: ucmd setenv emmc_boot_ack '1'
FB: ucmd setenv emmc_boot_part '1'
FB: ucmd setenv fdt_addr '43000000'
FB: ucmd setenv fdt_file 'imx8mm-tx8m-1610-mipi-mb.dtb'
FB: ucmd setenv fdt_high '63000000'
FB: ucmd setenv fdt_size 'b000'
FB: ucmd setenv fdtaddr '43000000'
FB: ucmd setenv fdtsave 'save mmc ${mmcdev} ${fdt_addr} ${fdt_file} ${fdt_size}'
FB: ucmd setenv initrd_addr '-'
FB: ucmd setenv initrd_high '63800000'
FB: ucmd setenv linux_image 'Image-tx8m-1610.bin'
FB: ucmd setenv loadaddr '40480000'
FB: ucmd setenv loadfdt 'load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}'
FB: ucmd setenv loadkernel 'load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${linux_image}'
FB: ucmd setenv mmcdev '0'
FB: ucmd setenv mmcpart '1'
FB: ucmd setenv panel 'MIPI2LVDS'
FB: ucmd setenv uuid_rootfs '0cc66cc0-5458-384d-1610-726f6f746673'
FB: ucmd saveenv

3.3.3. Writing U-Boot to eMMC

If you saved the environment, the normal U-Boot we will write to eMMC will use this. So, to write the normal U-Boot to eMMC append your uuu.auto file:

# Writing default u-boot to emmc
FB: ucmd setenv fastboot_dev mmc
FB: ucmd mmc dev 0
FB: flash bootloader imx-boot-tx8m-1610-default.bin-flash_tx8m
FB: ucmd mmc partconf 0 0 1 0

3.3.4. Partitioning with uuu

When started a fastboot U-Boot you can partition your eMMC in U-Boot. See the following lines on how it works:

# Partitioning
FB: ucmd setenv partitions 'uuid_disk=${uuid_gpt_disk};name=boot,size=32M,start=1MiB,uuid=${uuid_boot};name=swap,size=512M,uuid=${uuid_swap};name=rootfs,size=MAX,uuid=0cc66cc0-5458-384d-1610-726f6f746673;'
FB: ucmd gpt write mmc 0 ${partitions}

See more about partitioning in the official README.

3.3.5. Booting an initram

To use the created partitions they have to be formatted. To do this, you have to start an initram Linux. You can take an own one, or use the one we use for our Debian installation. It can be found on GitHub: https://github.com/karo-electronics/debian-tx8m/raw/master/initram/fsl-nxp.cpio.gz.u-boot.

To boot it with uuu append the following lines to uuu.auto:

# Setup for booting an initram
FB: ucmd setenv fdt_addr 0x43000000
FB: ucmd setenv emmc_dev 0
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}
FB: ucmd mmc dev ${emmc_dev}
FB: ucmd setenv console ttymxc0,115200
FB: ucmd setenv bootargs init=/linuxrc console=${console} panic=-1 ro ${append_bootargs}
FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f Image-tx8m-1610.bin
FB: ucmd setenv fastboot_buffer ${fdt_addr}
FB: download -f imx8mm-tx8m-1610-mipi-mb.dtb
FB: ucmd fdt addr ${fdt_addr}
FB: ucmd setenv initram_addr 0x50000000
FB: ucmd setenv fastboot_buffer ${initram_addr}
FB: download -f initram/fsl-nxp.cpio.gz.u-boot
# Booting initram
FB: acmd booti ${loadaddr} ${initram_addr} ${fdt_addr}

3.3.6. Formatting partitions with initram

To format your before created partitions, use the started initram and send the following fastboot commands (append to uuu.auto):

# Formatting partitions
FBK: ucmd mkfs.vfat -F 32 /dev/mmcblk0p1
FBK: ucmd mkswap /dev/mmcblk0p2
FBK: ucmd mkfs.ext4 -L rfs /dev/mmcblk0p3

3.3.7. Copying kernel and DTB

Now you can copy kernel and devicetree to the boot partition. These lines go to uuu.auto:

# Copy kernel and dtb (to first partition mmcblk0p1, mounted as /boot)
FBK: ucmd mount /dev/mmcblk0p1 /mnt
FBK: acmd cat - > /mnt/Image-tx8m-1610.bin
FBK: ucp Image-tx8m-1610.bin t:-
FBK: acmd cat - > /mnt/imx8mm-tx8m-1610-mipi-mb.dtb
FBK: ucp imx8mm-tx8m-1610-mipi-mb.dtb t:-
FBK: ucmd sync && umount /mnt

3.3.8. Extracting RootFS

At least the rootfile system has to be extracted and copied to our root partition.

# Copy rootfs (unpack the tar and put it to mmcblk0p3 mounted as rootfs)
FBK: ucmd mount /dev/mmcblk0p3 /mnt
FBK: acmd EXTRACT_UNSAFE_SYMLINKS=1 tar -jxv -C /mnt
FBK: ucp core-image-minimal-tx8m-1610.rootfs.tar.bz2 t:-
FBK: ucmd sync && umount /mnt

3.3.9. End uuu

To tell uuu that you’re finished, simply add this to uuu.auto:

# done
FBK: done

3.4. Running uuu

  1. Put the bootmode jumper in place and connect your module via OTG-programming port of the baseboard and the USB to UART cable to get terminal access. If you need help for this see PuTTY Terminal Connection.
  2. Open a command line inside the folder where uuu is and run the following command to use the before created uuu.auto script:
uuu -v

Inside your putty terminal you should now see some information while uuu is programming your module.

3.5. Booting

You can now remove the bootmode jumper.

If your uuu.auto file was correct, and everything worked, pressing the reset button should boot your module into a simple Linux. The login here is also root.

[1]Further information about uuu, and the official documentation can be found in uuu.pdf