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 am5728-phytec-pcm-948-40300111I.dtb. 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.

    Note

    help is a useful tool in U-Boot to show available commands and usage.

  • Use the following command to verify that all of the environment variables are set as intended:

    Target (U-Boot)
    printenv
    
  • Use the following command to list the available file’s within the root filesystem’s /boot directory:

    Target (U-Boot)
    ls mmc 0:2 boot
    
    Example Output
    => ls mmc 0:2 boot
    <DIR>       4096 .
    <DIR>       4096 ..
              214503 am5728-phytec-pcm-948-40300111I.dtb
              214503 am5728-phytec-pcm-948-50500111I.dtb
              214503 am5729-phytec-pcm-948-10306111I.dtb
              208683 am5749-phytec-pcm-948-32302111I.dtb
                1538 am57xx-phytec-pcm-948-gpio-fan.dtbo
                3409 am57xx-phytec-pcm-948-lcd-017.dtbo
                3924 am57xx-phytec-pcm-948-lcd-018.dtbo
                3755 am57xx-phytec-pcm-948-vm-009.dtbo
                3235 am57xx-phytec-pcm-948-vm-011.dtbo
                3615 am57xx-phytec-pcm-948-vm-016.dtbo
                3454 am57xx-phytec-pcm-948-wlan-wilink8.dtbo
                 370 am57xx-phytec-pcm-948-x28-spidev.dtbo
              205388 am57xx-phytec-pcm-948.dtb
              205388 oftree
    <SYM>         15 zImage
             5366272 zImage-5.10.168
    
  • We can check which file is the active device tree like so:

    Target (U-Boot)
    printenv fdtfile
    
  • Change the default device tree.

    Target (U-Boot)
    setenv fdtfile <dtb name>
    saveenv
    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. The table “Linux Device Tree Summary in the 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:

Target (U-boot)
setenv overlays am57xx-phytec-pcm-948-vm-016.dtbo
saveenv
boot
  • Moreover, it’s possible to enable multiple overlays by separating them with a space.

Target (U-boot)
setenv overlays am57xx-phytec-pcm-948-vm-016.dtbo am57xx-phytec-pcm-948-x28-spidev.dtbo
saveenv
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:

Target (U-Boot)
env default -f -a
saveenv
boot