5.2 Configuring U-Boot

Since U-Boot is extremely flexible, many features should be carefully evaluated to help ensure security. One configuration setting, CONFIG_FIT_SIGNATURE, allows image signature verification and is at the heart of U-Boot’s Verified Boot methodology. Without the CONFIG_FIT_SIGNATURE setting, it is not possible to verify or even generate a properly signed FIT file.

Buildroot provides an easy mechanism to configure packages using the following syntax:

$ make <package name>-menuconfig
To run menuconfig for U-Boot, simply type the following command:
$ make uboot-menuconfig

The following menuconfig screenshots show the various parameters that will be modified for Secure Boot mode.

  1. To set CONFIG_FIT_SIGNATURE, select Boot options > Boot images > Flattened Image Tree (FIT) > Enable signature verification of FIT uImages.

  2. Under Command Line Interface > Boot commands, make sure the bootm and Flattened Device Tree utility commands options are selected.

  3. Under Library routines > Security support, enable Use RSA Library.

  4. Select Save and press Enter.
  5. In the Save configuration window, click Ok.
  6. In the Configuration written to .config window, select Exit and press Enter.
  7. Select Exit and press Enter repeatedly until the uboot-menuconfig window closes.
  8. Launch the build with the command below:
    $ make
U-Boot can now check the signed FIT images, but some information is still missing. The default U-Boot control DTB does not contain the public key required to verify image signatures. As shown below, running without the correct U-Boot control DTB produces a message such as Verifying Hash Integrity … OK. Although this message appears correct, no signature testing is performed. The hash is verified, but for secure boot, an RSA verification step is also required. The Public Key Generation section describes how to add the correct keys to the U-Boot control DTB.
Hit any key to stop autoboot:  0
5687416 bytes read in 252 ms (21.5 MiB/s)
## Loading kernel from FIT Image at 24000000 ...
   Using 'kernel_dtb' configuration
   Verifying Hash Integrity ... OK
   Trying 'kernel' kernel subimage
     Description:  Linux4SAM Linux kernel
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x240000dc
     Data Size:    5585416 Bytes = 5.3 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x22000000
     Entry Point:  0x22000000
     Hash algo:    crc32
     Hash value:   4f0bcbe7
     Hash algo:    sha1
     Hash value:   00de2cecefac6b01395bb8ee4be44e51e44cfada
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 24000000 ...
   Using 'kernel_dtb' configuration
   Verifying Hash Integrity ... OK
   Trying 'base_fdt' fdt subimage
     Description:  SAM9X75-Curiosity Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x24553c24
     Data Size:    41552 Bytes = 40.6 KiB
     Architecture: ARM
     Load Address: 0x23000000
     Hash algo:    crc32
     Hash value:   80f013cd
     Hash algo:    sha1
     Hash value:   6adf457e9a4dfc8f3827a5b1f5fd6f654cbbd287
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Loading fdt from 0x24553c24 to 0x23000000
## Loading fdt from FIT Image at 24000000 ...
   Using 'lan8840' configuration
   Verifying Hash Integrity ... OK
   Trying 'fdt_gmac_lan8840' fdt subimage
     Description:  Device Tree blob for LAN8840 RGMII PHY overlay
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x24561d74
     Data Size:    2193 Bytes = 2.1 KiB
     Architecture: ARM
     Load Address: 0x23120000
     Hash algo:    crc32
     Hash value:   8fefe6b7
     Hash algo:    sha1
     Hash value:   6a06d90dc79fcdaddc7cddbad312b7a64f8d6b99
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 24000000 ...
   Using 'wilc' configuration
   Verifying Hash Integrity ... OK
   Trying 'fdt_wilcs02' fdt subimage
Description:  Device Tree blob WILCS02 overlay
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x2456bbac
     Data Size:    746 Bytes = 746 Bytes
     Architecture: ARM
     Load Address: 0x23170000
     Hash algo:    crc32
     Hash value:   fc2342dd
     Hash algo:    sha1
     Hash value:   2c3df54af7c89034bae25fe844b9cba036354feb
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x23000000
Working FDT set to 23000000
   Loading Kernel Image to 22000000
   Loading Device Tree to 2fee7000, end 2fef46d0 ... OK
Working FDT set to 2fee7000

Starting kernel ...