DornerWorks

Booting Xen using a FIT image

Posted on December 3, 2019 by Robert VanVossen

We’ve been doing a lot with embedded Xen here at DornerWorks, and we’re continuing to improve our methods. Here’s one for the “tips and tricks” file…

U-Boot Flattened Image Tree (FIT) Image

U-Boot, a popular bootloader supporting numerous processor architectures, provides a method to generate a monolithic image, called a FIT image, that includes all the images needed to boot a system. The FIT image is beneficial because it allows for image hashing, multiple configurations, and improved support. This is useful for Xen as it allows a user of an embedded system to boot between Xen or native Linux more easily. It is also useful for Xen systems that are being used in production on embedded boards. With the hash checking, you can ensure that you have all the correct images for your Xen system at boot time. A FIT image is built from an Image Source File (*.its file) using the U-Boot mkimage utility.

Here is an example of an Image Source File for a Xen system running on the CubieTruck: https://raw.githubusercontent.com/dornerworks/xen-arm-builder/fit/FIT/cubietruck-xen.its

More information on the Image Source File format can be found here: http://git.denx.de/?p=u-boot.git;a=blob_plain;f=doc/uImage.FIT/source_file_format.txt;hb=HEAD

Building a FIT Image

Use the following steps to build a Xen FIT image:

  1. Create an Image Source file for your Xen System, based on the example referenced above
  2. Get the U-Boot source code at or after the tag “v2015.07”
  3. Build U-Boot, with FIT image support, for your platform (CONFIG_FIT=y)
  4. Build necessary kernels (Linux Dom0 and Xen)
  5. Build your Device Tree Blobs (DTB)
    1. Modify the Device Tree Source (DTS) for your platform with the Xen boot information
    2. Compile your DTBs from your DTSs using the dtc utility
  6. Place all of the built images in the location specified in your Image Source File
  7. Build the output FIT image using the mkimage utility built along with your U-Boot binary
      $ mkimage -f cubietruck-xen.its xen.itb

Booting a FIT Image

Use the following steps to boot your FIT Image on your board:

  1. Prepare your board for booting
    1. Move your U-Boot binary to a location from which your board boots
    2. Move your FIT image to a location that U-Boot can access
  2. Power on your board and stop the U-Boot autoboot
  3. Load the FIT Image into memory at a non-conflicting location
    1. SD Card Example:
      fatload mmc 0 0x80000000 /xen.itb
  4. Boot one of your predefined configurations
    1. Config@1 Example:
      bootm 0x80000000#config@1

After the bootm command, U-Boot will check any hashes specified for the images in the configuration. If all of the hashes are verified correctly, U-Boot loads the images into their specified load addresses and then executes the kernel. Now you have booted a Xen system using a FIT image.

More Information

The following link has slides from a presentation that we gave at this year’s Xen Developer’s Summit on booting Xen using a FIT image. http://events.linuxfoundation.org/sites/events/files/slides/U-Boot%20FIT%20for%20Xen.pdf

Robert VanVossen
by Robert VanVossen
Embedded Engineer
Robbie VanVossen is an embedded engineer at DornerWorks.