Skip to contentSkip to conversation

FIT verification

PATCH Superseded Joel Stanley 2 participants 6 messages Jan 25, 2021 – Jan 27, 2021

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover FIT verification

As part of our effort to enable secure boot in openbmc, this turns on FIT verification in the SPL and u-boot.

It adjusts the SRAM layout to accommodate the extra code size, moving the heap to the non-parity checked 24KB of SRAM.

Joel Stanley (2):
ast2600: Modify SPL SRAM layout
config: ast2600: Enable FIT signature verification

 configs/ast2600_openbmc_spl_emmc_defconfig | 3 +++
 include/configs/evb_ast2600a1_spl.h        | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/2 ast2600: Modify SPL SRAM layout

The SRAM is 89KB on the A1 and beyond:

0x1000_0000 to 0x1000_ffff: 64KB, with parity check 0x1001_0000 to 0x1001_5fff: 24KB, w/o parity check 0x1001_6000 to 0x1001_63ff: 1KB, w/o parity check, each byte write once

Allow the image to fill the full 64KB payload size (max that secure boot supports) and plcae the stack at the top of the 24KB of SRAM.

---
 include/configs/evb_ast2600a1_spl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/evb_ast2600a1_spl.h +2 -2
index 69f3c32ce1d5..a39988820add 100644
@@ -25,8 +25,8 @@
 
 /* SPL */
 #define CONFIG_SPL_TEXT_BASE		0x00000000
-#define CONFIG_SPL_MAX_SIZE		0x0000E800
-#define CONFIG_SPL_STACK		0x10010000
+#define CONFIG_SPL_MAX_SIZE		0x00010000
+#define CONFIG_SPL_STACK		0x10016000
 #define CONFIG_SPL_BSS_START_ADDR	0x90000000
 #define CONFIG_SPL_BSS_MAX_SIZE		0x00100000
 
Signature · 1 line
2.29.2
#2 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] ast2600: Modify SPL SRAM layout

Hi Joel,

Quoted 1 line · Joel Stanley

The SRAM is 89KB on the A1 and beyond:

I guess I'll have to trust you on that one.

Quoted 7 lines

0x1000_0000 to 0x1000_ffff: 64KB, with parity check 0x1001_0000 to 0x1001_5fff: 24KB, w/o parity check 0x1001_6000 to 0x1001_63ff: 1KB, w/o parity check, each byte write once

Allow the image to fill the full 64KB payload size (max that secure boot supports) and plcae the stack at the top of the 24KB of SRAM.

typo

include/configs/evb_ast2600a1_spl.h line 32

Quoted 11 lines
include/configs/evb_ast2600a1_spl.h +2 -2
@@ -25,8 +25,8 @@
 
  /* SPL */
  #define CONFIG_SPL_TEXT_BASE		0x00000000
-#define CONFIG_SPL_MAX_SIZE		0x0000E800
-#define CONFIG_SPL_STACK		0x10010000
+#define CONFIG_SPL_MAX_SIZE		0x00010000
+#define CONFIG_SPL_STACK		0x10016000
  #define CONFIG_SPL_BSS_START_ADDR	0x90000000
  #define CONFIG_SPL_BSS_MAX_SIZE		0x00100000
 

Got the following when I tried this patch (Ubuntu 18.04.5, gcc 7.5.0, binutils 2.30). Am I missing something?

LD spl/u-boot-spl
arm-linux-gnueabihf-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region flash' arm-linux-gnueabihf-ld.bfd: region `flash' overflowed by 1612 bytes scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1663: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Signature · 1 line
Klaus Heinrich Kiwi <[email protected]>
#3 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] ast2600: Modify SPL SRAM layout

Quoted 7 lines · Klaus Heinrich Kiwi

Hi Joel,

Quoted 1 line · Joel Stanley

The SRAM is 89KB on the A1 and beyond:

I guess I'll have to trust you on that one.

You have access to the datasheet and can verify this.

Quoted 12 lines
Quoted 8 lines

0x1000_0000 to 0x1000_ffff: 64KB, with parity check 0x1001_0000 to 0x1001_5fff: 24KB, w/o parity check 0x1001_6000 to 0x1001_63ff: 1KB, w/o parity check, each byte write once

Allow the image to fill the full 64KB payload size (max that secure boot supports) and plcae the stack at the top of the 24KB of SRAM.

typo

Quoted 2 lines
(quoted diff) +0 -0
@@ -25,8 +25,8 @@
 
Quoted 11 lines

include/configs/evb_ast2600a1_spl.h line 32

Quoted 9 lines
include/configs/evb_ast2600a1_spl.h +2 -2
  /* SPL */
  #define CONFIG_SPL_TEXT_BASE                0x00000000
-#define CONFIG_SPL_MAX_SIZE          0x0000E800
-#define CONFIG_SPL_STACK             0x10010000
+#define CONFIG_SPL_MAX_SIZE          0x00010000
+#define CONFIG_SPL_STACK             0x10016000
  #define CONFIG_SPL_BSS_START_ADDR   0x90000000
  #define CONFIG_SPL_BSS_MAX_SIZE             0x00100000
 

Got the following when I tried this patch (Ubuntu 18.04.5, gcc 7.5.0, binutils 2.30). Am I missing something?

This is a very out of date compiler. We use GCC 10 for openbmc.

I will submit a v2 with some new features for reducing the image size.

Quoted 12 lines

LD spl/u-boot-spl
arm-linux-gnueabihf-ld.bfd: u-boot-spl section .u_boot_list' will not fit in region flash' arm-linux-gnueabihf-ld.bfd: region `flash' overflowed by 1612 bytes scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1663: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

--
Klaus Heinrich Kiwi <[email protected]>

#4 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] ast2600: Modify SPL SRAM layout

Quoted 11 lines · Joel Stanley
Quoted 7 lines · Klaus Heinrich Kiwi

Hi Joel,

Quoted 1 line · Joel Stanley

The SRAM is 89KB on the A1 and beyond:

I guess I'll have to trust you on that one.

You have access to the datasheet and can verify this.

I'm not sure where to find it. Is that published somewhere?

Quoted 24 lines
Quoted 12 lines
Quoted 8 lines

   0x1000_0000 to 0x1000_ffff: 64KB, with parity check
   0x1001_0000 to 0x1001_5fff: 24KB, w/o parity check
   0x1001_6000 to 0x1001_63ff: 1KB, w/o parity check, each byte write once

Allow the image to fill the full 64KB payload size (max that secure boot supports) and plcae the stack at the top of the 24KB of SRAM.

typo

Quoted 2 lines
(quoted diff) +0 -0
@@ -25,8 +25,8 @@
 
Quoted 11 lines

include/configs/evb_ast2600a1_spl.h line 32

Quoted 9 lines
include/configs/evb_ast2600a1_spl.h +2 -2
   /* SPL */
   #define CONFIG_SPL_TEXT_BASE                0x00000000
-#define CONFIG_SPL_MAX_SIZE          0x0000E800
-#define CONFIG_SPL_STACK             0x10010000
+#define CONFIG_SPL_MAX_SIZE          0x00010000
+#define CONFIG_SPL_STACK             0x10016000
   #define CONFIG_SPL_BSS_START_ADDR   0x90000000
   #define CONFIG_SPL_BSS_MAX_SIZE             0x00100000
 

Got the following when I tried this patch (Ubuntu 18.04.5, gcc 7.5.0, binutils 2.30). Am I missing something?

Quoted 1 line

This is a very out of date compiler. We use GCC 10 for openbmc.

What compiler version did you test this on?

|   (cd spl && arm-openbmc-linux-gnueabi-ld.bfd   -T u-boot-spl.lds  --gc-sections -Bstatic --gc-sections -pie  --no-dynamic-linker -Ttext 0x00000000 arch/arm/cpu/armv7/start.o --start-group arch/arm/mach-aspeed/built-in.o arch/arm/cpu/armv7/built-in.o arch/arm/cpu/built-in.o arch/arm/lib/built-in.o board/aspeed/evb_ast2600a1/built-in.o common/spl/built-in.o common/init/built-in.o common/built-in.o cmd/built-in.o env/built-in.o lib/built-in.o disk/built-in.o drivers/built-in.o dts/built-in.o fs/built-in.o  --end-group arch/arm/lib/eabi_compat.o arch/arm/lib/lib.a -Map u-boot-spl.map -o u-boot-spl)
| arm-openbmc-linux-gnueabi-ld.bfd: u-boot-spl section `.u_boot_list' will not fit in region `flash'
| arm-openbmc-linux-gnueabi-ld.bfd: region `flash' overflowed by 1736 bytes
$ ./arm-openbmc-linux-gnueabi-gcc --version
arm-openbmc-linux-gnueabi-gcc (GCC) 10.2.0
Quoted 2 lines

I will submit a v2 with some new features for reducing the image size.

Thank you.

Signature · 1 line
Klaus Heinrich Kiwi <[email protected]>
#5 lore raw

PATCH 2/2 config: ast2600: Enable FIT signature verification

In reply to Joel Stanley

This turns on FIT signature verification for the OpenBMC SPL configuration, for both the SPL and u-boot.

---
 configs/ast2600_openbmc_spl_emmc_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/ast2600_openbmc_spl_emmc_defconfig +3 -0
index 68d18652c980..20f2e7019cb3 100644
@@ -35,6 +35,9 @@ CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_ARMV7_PSCI_NR_CPUS=2
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS4,115200n8 root=/dev/ram rw"
 CONFIG_USE_BOOTCOMMAND=y
Signature · 1 line
2.29.2