Debian Edit Modify Build and Flash U-Boot

From Variscite Wiki
Revision as of 21:26, 27 April 2023 by Alex (talk | contribs) (Flashing using recovery SD card: fix varlink)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release RELEASE_BUSTER_V1.0_DART-MX8M-MINI.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit
  2. Select your SoM
  3. Select the software release
DART-MX8M-MINI - Debian U-Boot Customization

Making changes to U-Boot

$ cd ~/var_mx8mm_dart_debian_buster/src/uboot-imx
$ gedit board/variscite/mx8mm_var_dart/mx8mm_var_dart.c
$ gedit include/configs/mx8mm_var_dart.h

For example, we want to change the default environment variable,

"netargs=setenv bootargs ${jh_clk} console=${console} " \
		"root=/dev/nfs ${cma_size} " \
		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \


"netargs=setenv bootargs ${jh_clk} console=${console} " \
		"root=/dev/nfs ${cma_size} " \
		"ip=dhcp serverip= nfsroot=${serverip}:${nfsroot},v3,tcp\0" \

Here above example sets the serverip to

Building bootloader

To build a bootloader run below commands on host machine.

$ cd ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./ -c bootloader

Flashing new bootloader to target

Flashing new bootloader to target eMMC via network

Transfer the newly created bootloader file imx-boot-sd.bin


~/var_mx8mm_dart_debian_buster/output/ to running target to flash it on the eMMC. 

For example:

$ scp ~/var_mx8mm_dart_debian_buster/output/imx-boot-sd.bin root@ 

Change to your target board IP.

Login via ssh on the target with the user 'root', and run the below commands':

$ dd if=/tmp/imx-boot-sd.bin  of=/dev/mmcblk2 bs=1K seek=33 conv=fsync

Flashing new bootloader to SD card

To flash the newly created bootloader on the SD card if you are running your entire OS from SD card.

$ sudo dd if=imx-boot-sd.bin of=/dev/sdX bs=1K seek=33 conv=fsync

Flashing using recovery SD card

If you want to use our recovery SD card to flash the built U-Boot to NAND flash/eMMC, then copy it to the appropriate location in the SD card:

$ sudo cp imx-boot-sd.bin /media/rootfs/opt/images/Debian/

Eject the SD card gracefully from the host machine, and flash the internal on-SOM storage using the recovery SD card.

Note: If you manually upgrade an existing U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see Environment handling commands)