Running U-Boot

Running U-Boot

As explained in Installing U-Boot to the NXP i.MX RT1170 EVK Board and Installing U-Boot and Linux Images to the QSPI Flash / HyperFlash on IMXRT1170-EVK(B) or MaaXBoard-RT Boards, you have to install U-Boot to the boot media of the NXP i.MX RT1170 EVK/Avnet MaaXBoard-RT board in order to run Linux (uClinux). U-Boot runs as the primary firmware from the SD Card or QSPI/Hyperbus Flash on each power-on / reset.

U-Boot is probably the most popular firmware monitor for Linux. It is developed and maintained by DENX Software Engineering (www.denx.de). If you need detailed information on any aspects of U‑Boot operation, DENX publishes extensive U‑Boot user documentation at their web site.

As soon as the NXP i.MX RT1170 EVK/Avnet MaaXBoard-RT board is powered on or reset, the i.MX RT1170 proceeds to boot the U‑Boot firmware printing the following output to the serial console:

U-Boot SPL 2023.04 (Sep 01 2023 - 09:33:56 +0000) Trying to boot from MMC1 U-Boot 2023.04 (Sep 01 2023 - 09:33:56 +0000) Model: NXP imxrt1170-evk board DRAM: 960 KiB (effective 64.9 MiB) Core: 72 devices, 15 uclasses, devicetree: separate MMC: FSL_SDHC: 0 Loading Environment from MMC... OK In: serial@4007c000 Out: serial@4007c000 Err: serial@4007c000 Net: eth0: ethernet@40424000 Hit any key to stop autoboot: 0 =>

If you hit any key on the serial console before the number of seconds defined by the U-Boot bootdelay variable has elapsed, you will enter the U-Boot interactive command monitor. From the command monitor you can run U‑Boot commands to examine memory, load an image from Ethernet, boot Linux from a loaded image or perform any other action supported by U-Boot.

U-Boot makes use of the so-called environment variables to define various aspects of the target functionality. On the NXP i.MX RT1170 EVK/Avnet MaaXBoard-RT board, the U-Boot environment is stored in the boot device and is persistent across power or reset cycles. Parameters defined by the U-Boot environment variables include: target IP address, target MAC address, location in RAM where a Linux bootable image will be loaded, and many others.

To manipulate the U-Boot environment the following commands are used:

  • printenv <var> - print the value of the variable <var>. Without arguments, prints all environment variables:

    => printenv addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off arch=arm baudrate=115200 board=imxrt1170-evk board_name=imxrt1170-evk bootcmd=run mmcboot bootdelay=2 cpu=armv7m ethaddr=aa:bb:cc:dd:ee:f0 fdtcontroladdr=20236c80 gatewayip=192.168.88.1 image=rootfs.uImage ipaddr=192.168.88.89 loadaddr=0x80007fc0 mmcboot=fatload mmc 0 ${loadaddr} ${image} && run addip && bootm ${loadaddr} netboot=tftp ${image} && run addip && bootm netmask=255.255.255.0 serverip=192.168.88.170 soc=imxrt stderr=serial@4007c000 stdin=serial@4007c000 stdout=serial@4007c000 vendor=freescale Environment size: 614/126972 bytes
  • setenv <var> <val> - set the variable <var> to the value <val>:

    => setenv image my.rootfs.uImage =>
  • saveenv - save the up-to-date U-Boot environment, possibly updated using setenv commands, into the SD Card. Running saveenv makes sure that any updates you have made to the U-Boot environment are persistent across power cycles and resets.

    => saveenv Saving Environment to MMC... Writing to MMC(0)... OK =>