Configuring the Bootloader

Change the Device Tree

By default, U-Boot loads a device tree binary (dtb) file named oftree during boot. The oftree file is a copy of k3-am642-phyboard-electra-rdk.dts. This portion of the guide will instruct how to change U-boot to load different device trees.

  • Power on the board and press any key to stop autoboot when prompted by the Bootloader.

  • Use the following command to list the available file’s within the boot media’s Boot partition (this is typically where binaries used for boot are stored):

sh-uboot:~# ls mmc 1:1
           EFI/
21336576   Image
     361   k3-am6xx-phycore-disable-eth-phy.dtbo
     234   k3-am6xx-phycore-disable-rtc.dtbo
     235   k3-am6xx-phycore-disable-spi-nor.dtbo
    1627   k3-am64x-phyboard-electra-gpio-fan.dtbo
    1715   k3-am64-phyboard-electra-pcie-usb2.dtbo
    1356   k3-am64-phyboard-electra-x27-uart3-spi1.dtbo
   61269   k3-am642-phyboard-electra-rdk.dtb
   61269   oftree
  508394   tiboot3.bin
  907823   tispl.bin
  961379   u-boot.img
  • We can check which file is the active device tree like so:

    sh-uboot:~# printenv fdtfile
    
  • Change the default device tree.

    sh-uboot:~# setenv fdtfile <dtb name>
    sh-uboot:~# saveenv
    sh-uboot:~# boot
    

U-boot will now load the dtb file named <dtb name> automatically during subsequent boots (just replace it with the appropriate file name when you run the command).

Working with Overlays

The PHYTEC BSP also comes with some device tree overlays to help evaluate certain interfaces and accessory hardware. Table Linux Device Tree Summary in the BSP-Yocto-Ampliphy-AM64x-PD24.1.1 Release Notes shows an overview of all available overlays.

Enable an Overlay

  • U-boot has an extra environment variable called “overlays” to apply device tree overlay files. We can enable device tree overlays with it like so:

sh-uboot:~# setenv overlays k3-am64x-phyboard-electra-gpio-fan.dtbo
sh-uboot:~# saveenv
sh-uboot:~# boot
  • Moreover, it’s possible to enable multiple overlays by separating them with a space.

sh-uboot:~# setenv overlays k3-am64x-phyboard-electra-gpio-fan.dtbo k3-am64-phyboard-electra-x27-uart3-spi1.dtbo
sh-uboot:~# saveenv
sh-uboot:~# boot

The saveenv command stores the boot environment to non-volatile memory. If you would like temporarily adjust the boot environment, you can omit the saveenv command and the boot environment will go back to the previously saved settings on the next boot.

Reset the U-Boot Environment to Default Settings

  • In order to revert the U-Boot environment back to its original settings, run the following:

sh-uboot:~# env default -f -a
sh-uboot:~# saveenv
sh-uboot:~# boot

Note

When booting from the SD card, if you have saved changes to the environment using saveenv, the changes may persist across flashes of the SD card. It is a good idea to default your environment after flashing.