All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow
@ 2018-04-13 15:31 Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 01/17] imximage: Specify default IVT offset in IMX image Bryan O'Donoghue
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

https://git.linaro.org/landing-teams/working/mbl/u-boot.git/log/?h=linaro-mbl%2bbod

v3:
- Reword commit message of patch #16 - Breno

- This patchset now relies on five in-flight patch-sets the first four of
  which should be applied first
 
1. [PATCH v3 0/3] NXP WaARP7 set serial# from OTP fuses for USB iSerial
   Already has a Reviewed-by from Fabio

2. [PATCH v3 0/2] imx: hab: Add helper functions for scripted HAB auth
   Has a Reviewed-by: from Breno

3. [PATCH v3 0/2] WaRP7 unify secure and non-secure defconfigs

4. Pierre-Jean's generic load patches

   [U-Boot] [PATCH v3 1/2] warp7: include/configs: use generic fs commands
   in CONFIG_EXTRA_ENV_SETTINGS

   [U-Boot] [PATCH v3 2/2] warp7: configs: enable CONFIG_CMD_FS_GENERIC

5. [PATCH] bootm: Align cache flush begin address
   This last patch can be applied in any order

v2:
- Ensure warp7_defconfig boots existing yocto with this change plus the
  automated HAB layer being added here following on from "[PATCH v3 0/2]
  WaRP7 unify secure and non-secure defconfigs"

- Fix reference to partition #1 versus partition #2 in select uuidpart
  patch

- Rebase on top of Pierre-Jean Texier generic load patches

- Drop my patch which did the same thing as Pierre-Jean's patch via
  ${loadcmd}

- Update example boot.scr from v1 to reflect use of generic 'load' command

- This patchset now relies on four in-flight patch-sets which all have the
  relevant Reviewed-by tags from the board Maintainer Fabio.
 
1. [PATCH v3 0/3] NXP WaARP7 set serial# from OTP fuses for USB iSerial
   Already has a Reviewed-by from Fabio

2. [PATCH v3 0/2] imx: hab: Add helper functions for scripted HAB auth
   Has a Reviewed-by: from Breno

3. [PATCH v3 0/2] WaRP7 unify secure and non-secure defconfigs

4. Pierre-Jean's generic load patches

   [U-Boot] [PATCH v3 1/2] warp7: include/configs: use generic fs commands
   in CONFIG_EXTRA_ENV_SETTINGS

   [U-Boot] [PATCH v3 2/2] warp7: configs: enable CONFIG_CMD_FS_GENERIC
 
v1:
This series enables an automated HAB verified secure boot which chain-loads
via OPTEE see `git show 5cf3251..c225e7c` for details.

This set depends on three in-flight patchsets

1. [PATCH v3 0/3] NXP WaARP7 set serial# from OTP fuses for USB iSerial
   Already has a Reviewed-by from Fabio

2. [PATCH v3 0/2] imx: hab: Add helper functions for scripted HAB auth
   Has a Reviewed-by: from Breno

3. [PATCH] configs: warp7: Fix CAAM on boot with tip-of-tree

I'm trying not to make this cover email too long. So - once this set is
applied it is possible to boot from the BootROM using HAB to verify

- u-boot
- boot.scr
- Kernel
- DTB

Chainload via OPTEE and boot up to Linux. If there is a HAB failure at any
stage of the process we force-drop down to the USB HID failover mode, from
which we can send up a recovery image to unblock.

I've run the WaRP7 default u-boot and this new version on NXP's reference
yocto image and verified that that yocto image boots with both versions of
the WaRP7 -> warp7_defconfig and warp7_secure_defconfig.

http://freescale.github.io/#download -> BoardsWaRPboard community - WaRP -
Wearable Reference PlatformFSL Community BSP 2.3fsl-image-multimediawayland

In addition the modifications targeting warp7_secure_defconfig mean it is
possible to chain-load via OPTEE using scripted HAB to verify images prior
to exiting the u-boot domain.

Here is an example of the scripting we are doing which shows further reuse
of shell functions introduced in previous patches.

#### Example secure-boot boot.scr.imx-signed ####

# This section is responsbile for loading a signed Linux kernel
setenv image_signed zImage.imx-signed
if test ${hab_enabled} -eq 1; then
	setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}
	load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${image_signed}
	run warp7_auth_or_fail
else
	run loadimage;
fi

# This section is responsbile for loading a signed FDT image
setenv fdt_file_signed imx7s-warp.dtb.imx-signed
if test ${hab_enabled} -eq 1; then
	setexpr hab_ivt_addr ${fdt_addr} - ${ivt_offset}
	load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr}
${fdt_file_signed}
	run warp7_auth_or_fail
else
	run loadfdt;
fi

# Boot from rootfs1 by default
setenv mmcpart 3

# But if the rootfs2 file exists in partition 2, boot from rootfs2
ext4size mmc 0:2 rootfs2 && setenv mmcpart 5

# This section is responsbile for loading a signed OPTEE image
setenv optee_file /lib/firmware/uTee.optee
setenv optee_file_signed /lib/firmware/uTee.optee.imx-signed
setenv loadoptee "load mmc ${mmcdev}:${mmcpart} ${optee_addr}
${optee_file}"
if test ${hab_enabled} -eq 1; then
	setexpr hab_ivt_addr ${optee_addr} - ${ivt_offset}
	load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr}
${optee_file_signed}
	run warp7_auth_or_fail
else
	run loadoptee;
fi

# Set UUID mmcpart will be used to pass root id to kernel
setenv rootpart ${mmcpart}
run finduuid;
run mmcargs;

# Now boot
echo Booting secure Linux/OPTEE OS from mmc ...;
bootm ${optee_addr} - ${fdt_addr};

# Failsafe if something goes wrong
hab_failsafe

Bryan O'Donoghue (17):
  imximage: Specify default IVT offset in IMX image
  warp7: hab: Add a CSF location definition
  warp7: hab: Set environment variable indicating HAB enable
  warp7: defconfig: Enable OPTEE for WaRP7
  warp7: Allocate specific region of memory to OPTEE
  warp7: Print out the OPTEE DRAM region
  warp7: Specify CONFIG_OPTEE_LOAD_ADDR
  warp7: defconfig: Enable CONFIG_SECURE_BOOT
  warp7: defconfig: Enable CONFIG_BOOTM_TEE
  warp7: Make CONFIG_SYS_FDT_ADDR a define
  warp7: Add Kconfig WARP7_ROOT_PART
  warp7: select uuid partition based on rootpart
  warp7: Define the name of a signed boot-script file
  warp7: add warp7_auth_or_fail
  warp7: hab: Set environment variable indicating IVT offset
  warp7: defconfig: Enable CMD_SETEXPR
  warp7: Add support for automated secure boot.scr verification

 board/warp7/Kconfig      | 14 ++++++++++++++
 board/warp7/imximage.cfg |  4 ++++
 board/warp7/warp7.c      | 23 +++++++++++++++++++++++
 configs/warp7_defconfig  |  6 +++++-
 include/configs/warp7.h  | 22 ++++++++++++++++++++--
 include/imximage.h       |  3 +++
 6 files changed, 69 insertions(+), 3 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 01/17] imximage: Specify default IVT offset in IMX image
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 02/17] warp7: hab: Add a CSF location definition Bryan O'Donoghue
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

This patch adds BOOTROM_IVT_HDR_OFFSET at 0xC00. The BootROM expects to
find the IVT header at a particular offset in an i.MX image.

Defining the expected offset of the IVT header in the first-stage BootROM
image format is of use of later stage authentication routines where those
routines continue to follow the first-stage authentication layout.

This patch defines the first stage offset which later patch make use of.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Utkarsh Gupta <utkarsh.gupta@nxp.com>
Cc: Breno Lima <breno.lima@nxp.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
---
 include/imximage.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/imximage.h b/include/imximage.h
index 553b852..800fd63 100644
--- a/include/imximage.h
+++ b/include/imximage.h
@@ -14,6 +14,9 @@
 #define APP_CODE_BARKER	0xB1
 #define DCD_BARKER	0xB17219E9
 
+/* Specify the offset of the IVT in the IMX header as expected by BootROM */
+#define BOOTROM_IVT_HDR_OFFSET	0xC00
+
 /*
  * NOTE: This file must be kept in sync with arch/arm/include/asm/\
  *       mach-imx/imximage.cfg because tools/imximage.c can not
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 02/17] warp7: hab: Add a CSF location definition
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 01/17] imximage: Specify default IVT offset in IMX image Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 03/17] warp7: hab: Set environment variable indicating HAB enable Bryan O'Donoghue
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

In order to correctly produce an image with a IVT/DCD header we need to
define a CSF in imximage.cfg. We just use the mx7 default here.

All we have to do with this option switched on is "make u-boot.imx" and we
then will get

- u-boot.imx
- u-boot.imx.log

The log file is really important because it gives the addresses for the HAB
that we will require to sign the u-boot image using the CST. Since the
addresses can change this logfile is a critical output.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 board/warp7/imximage.cfg | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/board/warp7/imximage.cfg b/board/warp7/imximage.cfg
index 5b42793..51a5bff 100644
--- a/board/warp7/imximage.cfg
+++ b/board/warp7/imximage.cfg
@@ -13,6 +13,10 @@
 #include <config.h>
 
 IMAGE_VERSION	2
+#ifdef CONFIG_SECURE_BOOT
+CSF CONFIG_CSF_SIZE
+#endif
+
 BOOT_FROM	sd
 
 /*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 03/17] warp7: hab: Set environment variable indicating HAB enable
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 01/17] imximage: Specify default IVT offset in IMX image Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 02/17] warp7: hab: Add a CSF location definition Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 04/17] warp7: defconfig: Enable OPTEE for WaRP7 Bryan O'Donoghue
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

This patch adds an environment variable called "hab_enabled" which gets set
to a boolean status indicating whether HAB is enabled or not.

Subsequent patches can use this environment variable to determine if its
necessary to run a given binary through the hab_auth_img console command.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 board/warp7/warp7.c     | 8 ++++++++
 include/configs/warp7.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index 327f656..0d3d324 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -10,6 +10,7 @@
 #include <asm/arch/mx7-pins.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
+#include <asm/mach-imx/hab.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
@@ -203,6 +204,13 @@ int board_late_init(void)
 	 */
 	clrsetbits_le16(&wdog->wcr, 0, 0x10);
 
+#ifdef CONFIG_SECURE_BOOT
+	/* Determine HAB state */
+	env_set_ulong(HAB_ENABLED_ENVNAME, imx_hab_is_enabled());
+#else
+	env_set_ulong(HAB_ENABLED_ENVNAME, 0);
+#endif
+
 #ifdef CONFIG_SERIAL_TAG
 	/* Set serial# standard environment variable based on OTP settings */
 	get_board_serial(&serialnr);
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 98fedb8..10db716 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -139,4 +139,7 @@
 
 #define CONFIG_USBNET_DEV_ADDR		"de:ad:be:af:00:01"
 
+/* Environment variable name to represent HAB enable state */
+#define HAB_ENABLED_ENVNAME		"hab_enabled"
+
 #endif
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 04/17] warp7: defconfig: Enable OPTEE for WaRP7
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (2 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 03/17] warp7: hab: Set environment variable indicating HAB enable Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 05/17] warp7: Allocate specific region of memory to OPTEE Bryan O'Donoghue
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Requires setting CONFIG_OPTEE=y and setting an OPTEE TrustZone DRAM base in
include/configs/warp7.h.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 configs/warp7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index d720bac..3dbcd69 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -44,3 +44,4 @@ CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
 CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
 CONFIG_OF_LIBFDT=y
+CONFIG_OPTEE=y
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 05/17] warp7: Allocate specific region of memory to OPTEE
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (3 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 04/17] warp7: defconfig: Enable OPTEE for WaRP7 Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 06/17] warp7: Print out the OPTEE DRAM region Bryan O'Donoghue
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Subtracts CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size.

On WaRP7 we simply define the OPTEE region as from the maximum DRAM address
minus CONFIG_OPTEE_TZDRAM_SIZE bytes.

Note the OPTEE boot process will itself subtract the DRAM region it lives
in from the memory map passed to Linux.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 board/warp7/warp7.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index 0d3d324..56f0cdd 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -58,6 +58,11 @@ int dram_init(void)
 {
 	gd->ram_size = PHYS_SDRAM_SIZE;
 
+	/* Subtract the defined OPTEE runtime firmware length */
+#ifdef CONFIG_OPTEE_TZDRAM_SIZE
+		gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
+#endif
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 06/17] warp7: Print out the OPTEE DRAM region
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (4 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 05/17] warp7: Allocate specific region of memory to OPTEE Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 07/17] warp7: Specify CONFIG_OPTEE_LOAD_ADDR Bryan O'Donoghue
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Right now a region of 0x300000 bytes is allocated at the end of DRAM for
the purposes of loading an OPTEE firmware inside of it. This patch adds the
printout of the relevant address ranges.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 board/warp7/warp7.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index 56f0cdd..da52b18 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -181,7 +181,17 @@ int checkboard(void)
 	else
 		mode = "non-secure";
 
+#ifdef CONFIG_OPTEE_TZDRAM_SIZE
+	unsigned long optee_start, optee_end;
+
+	optee_end = PHYS_SDRAM + PHYS_SDRAM_SIZE;
+	optee_start = optee_end - CONFIG_OPTEE_TZDRAM_SIZE;
+
+	printf("Board: WARP7 in %s mode OPTEE DRAM 0x%08lx-0x%08lx\n",
+	       mode, optee_start, optee_end);
+#else
 	printf("Board: WARP7 in %s mode\n", mode);
+#endif
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 07/17] warp7: Specify CONFIG_OPTEE_LOAD_ADDR
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (5 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 06/17] warp7: Print out the OPTEE DRAM region Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 08/17] warp7: defconfig: Enable CONFIG_SECURE_BOOT Bryan O'Donoghue
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

In order to sign images with the IMX code-signing-tool (CST) we need to
know the load address of a given image. The best way to derive this load
address is to make it into a define - so that u-boot.cfg contains the
address - which we can then parse when generating the IMX CST headers.

This patch makes the OPTEE_LOAD_ADDR available via u-boot.cfg for further
parsing by external tools.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
---
 configs/warp7_defconfig | 1 +
 include/configs/warp7.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 3dbcd69..c647cd0 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -45,3 +45,4 @@ CONFIG_USB_ETH_CDC=y
 CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
 CONFIG_OF_LIBFDT=y
 CONFIG_OPTEE=y
+CONFIG_OPTEE_LOAD_ADDR=0x84000000
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 10db716..e12b90b 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -40,6 +40,7 @@
 	"initrd_high=0xffffffff\0" \
 	"fdt_file=imx7s-warp.dtb\0" \
 	"fdt_addr=0x83000000\0" \
+	"optee_addr=" __stringify(CONFIG_OPTEE_LOAD_ADDR)"\0" \
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 08/17] warp7: defconfig: Enable CONFIG_SECURE_BOOT
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (6 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 07/17] warp7: Specify CONFIG_OPTEE_LOAD_ADDR Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 09/17] warp7: defconfig: Enable CONFIG_BOOTM_TEE Bryan O'Donoghue
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Various function associated with booting the WaRP7 in High Assurance Boot
(HAB) mode are enabled by switching on CONFIG_SECURE_BOOT.

This patch enables CONFIG_SECURE_BOOT for the WaRP7 defconfig.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 configs/warp7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index c647cd0..efb6f51 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX7=y
+CONFIG_SECURE_BOOT=y
 CONFIG_SYS_TEXT_BASE=0x87800000
 CONFIG_TARGET_WARP7=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 09/17] warp7: defconfig: Enable CONFIG_BOOTM_TEE
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (7 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 08/17] warp7: defconfig: Enable CONFIG_SECURE_BOOT Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 10/17] warp7: Make CONFIG_SYS_FDT_ADDR a define Bryan O'Donoghue
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

This patch enables CONFIG_BOOTM_TEE. Once enabled its possible to
chain-load Linux through OPTEE.

Loading kernel to 0x80800000
=> run loadimage

Load FDT to 0x83000000
=> run loadfdt

Load OPTEE to 0x84000000
=> fatload mmc 0:5 0x84000000 /lib/firmware/uTee.optee

Then chain-load to the kernel via OPTEE

=> bootm 0x84000000 - 0x83000000

   Image Name:
   Image Type:   ARM Trusted Execution Environment Kernel Image (uncompressed)
   Data Size:    249844 Bytes = 244 KiB
   Load Address: 9dffffe4
   Entry Point:  9e000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 configs/warp7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index efb6f51..d5dc009 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -47,3 +47,4 @@ CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
 CONFIG_OF_LIBFDT=y
 CONFIG_OPTEE=y
 CONFIG_OPTEE_LOAD_ADDR=0x84000000
+CONFIG_BOOTM_OPTEE=y
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 10/17] warp7: Make CONFIG_SYS_FDT_ADDR a define
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (8 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 09/17] warp7: defconfig: Enable CONFIG_BOOTM_TEE Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 11/17] warp7: Add Kconfig WARP7_ROOT_PART Bryan O'Donoghue
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

In order to sign images with the IMX code-signing-tool (CST) we need to
know the load address of a given image. The best way to derive this load
address is to make it into a define - so that u-boot.cfg contains the
address - which we can then parse when generating the IMX CST headers.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
---
 board/warp7/Kconfig     | 6 ++++++
 include/configs/warp7.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/board/warp7/Kconfig b/board/warp7/Kconfig
index 61c33fb..00df19d 100644
--- a/board/warp7/Kconfig
+++ b/board/warp7/Kconfig
@@ -6,4 +6,10 @@ config SYS_BOARD
 config SYS_CONFIG_NAME
 	default "warp7"
 
+config SYS_FDT_ADDR
+	hex "FDT load address"
+	default 0x83000000
+	help
+	  The address the FDT file should be loaded to.
+
 endif
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index e12b90b..344042c 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -39,7 +39,7 @@
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
 	"fdt_file=imx7s-warp.dtb\0" \
-	"fdt_addr=0x83000000\0" \
+	"fdt_addr=" __stringify(CONFIG_SYS_FDT_ADDR)"\0" \
 	"optee_addr=" __stringify(CONFIG_OPTEE_LOAD_ADDR)"\0" \
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 11/17] warp7: Add Kconfig WARP7_ROOT_PART
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (9 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 10/17] warp7: Make CONFIG_SYS_FDT_ADDR a define Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 12/17] warp7: select uuid partition based on rootpart Bryan O'Donoghue
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Adding CONFIG_WARP7_ROOT_PART allows a defconfig to specify which partition
is use as the root partition on WaRP7, this is a desirable change in order
to support a different partitioning schemes. The default is the current
partition #2.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 board/warp7/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/warp7/Kconfig b/board/warp7/Kconfig
index 00df19d..c089bca 100644
--- a/board/warp7/Kconfig
+++ b/board/warp7/Kconfig
@@ -6,6 +6,14 @@ config SYS_BOARD
 config SYS_CONFIG_NAME
 	default "warp7"
 
+config WARP7_ROOT_PART
+	int "Partition number to use for root filesystem"
+	default 2
+	help
+	  The partition number to use for root filesystem this is the
+	  partition that is typically specified with root=/dev/sdaX or
+	  which gets converted into a root=PARTUUID=some_uuid.
+
 config SYS_FDT_ADDR
 	hex "FDT load address"
 	default 0x83000000
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 12/17] warp7: select uuid partition based on rootpart
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (10 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 11/17] warp7: Add Kconfig WARP7_ROOT_PART Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 13/17] warp7: Define the name of a signed boot-script file Bryan O'Donoghue
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Assigning the UUID discovery path to a tweakable environment variable means
that later steps in the boot process - particularly a boot script can
change the target root partition of a particular Linux boot.

Retargeting the rootfs is an important feature when doing ping/pong
upgrades allowing a boot script to select ping or pong as necessary without
reprogramming the bootloader.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/configs/warp7.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 344042c..54b3b31 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -45,7 +45,8 @@
 	"ip_dyn=yes\0" \
 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
-	"finduuid=part uuid mmc 0:2 uuid\0" \
+	"rootpart=" __stringify(CONFIG_WARP7_ROOT_PART) "\0" \
+	"finduuid=part uuid mmc 0:${rootpart} uuid\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=PARTUUID=${uuid} rootwait rw\0" \
 	"loadbootscript=" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 13/17] warp7: Define the name of a signed boot-script file
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (11 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 12/17] warp7: select uuid partition based on rootpart Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 14/17] warp7: add warp7_auth_or_fail Bryan O'Donoghue
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

We need to know the name of a signed boot-script, its better to have a
separate variable for this then to simply append some fixed string to an
existing image name.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/configs/warp7.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 54b3b31..0ed95d8 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -33,6 +33,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	CONFIG_DFU_ENV_SETTINGS \
 	"script=boot.scr\0" \
+	"script_signed=boot.scr.imx-signed\0" \
 	"image=zImage\0" \
 	"console=ttymxc0\0" \
 	"ethact=usb_ether\0" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 14/17] warp7: add warp7_auth_or_fail
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (12 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 13/17] warp7: Define the name of a signed boot-script file Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 15/17] warp7: hab: Set environment variable indicating IVT offset Bryan O'Donoghue
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

Doing secure boot on the WaRP7 using a common image format and the same
variable to represent the base address for each call means we can reduce
down the command to a single environment command.

This patch adds warp7_auth_or_fail as a wrapper around
"hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0".

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/configs/warp7.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 0ed95d8..454bc1c 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -50,6 +50,7 @@
 	"finduuid=part uuid mmc 0:${rootpart} uuid\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=PARTUUID=${uuid} rootwait rw\0" \
+	"warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
 	"loadbootscript=" \
 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 15/17] warp7: hab: Set environment variable indicating IVT offset
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (13 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 14/17] warp7: add warp7_auth_or_fail Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 16/17] warp7: defconfig: Enable CMD_SETEXPR Bryan O'Donoghue
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

This patch introduces the environment variable ivt_offset. When we define a
load address for Linux or DTB or any file the IVT associated with that file
is prepended. We extract the actual load addresses from u-boot.cfg and feed
these values into the code-signing process - hence we want u-boot to have
the real load addresses exported in uboot.cfg.

ivt_offset represents the addition or subtraction from the load address
that must happen to find an IVT header.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/configs/warp7.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 454bc1c..fe9b7d5 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -10,6 +10,7 @@
 #define __WARP7_CONFIG_H
 
 #include "mx7_common.h"
+#include <imximage.h>
 
 #define PHYS_SDRAM_SIZE			SZ_512M
 
@@ -50,6 +51,7 @@
 	"finduuid=part uuid mmc 0:${rootpart} uuid\0" \
 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 		"root=PARTUUID=${uuid} rootwait rw\0" \
+	"ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\
 	"warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
 	"loadbootscript=" \
 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 16/17] warp7: defconfig: Enable CMD_SETEXPR
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (14 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 15/17] warp7: hab: Set environment variable indicating IVT offset Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 17/17] warp7: Add support for automated secure boot.scr verification Bryan O'Donoghue
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

setexpr allows us to do arithmetic for env variables - something that is
both useful and required when doing HAB authentication without hard-coding
HAB load addresses.

This patch enables CMD_SETEXPR for the WaRP7 defconfig.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 configs/warp7_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index d5dc009..13c760d 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -21,7 +21,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
-# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_SETEXPR=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 17/17] warp7: Add support for automated secure boot.scr verification
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (15 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 16/17] warp7: defconfig: Enable CMD_SETEXPR Bryan O'Donoghue
@ 2018-04-13 15:31 ` Bryan O'Donoghue
  2018-04-16 18:12 ` [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Breno Matheus Lima
  2018-04-16 19:58 ` Fabio Estevam
  18 siblings, 0 replies; 20+ messages in thread
From: Bryan O'Donoghue @ 2018-04-13 15:31 UTC (permalink / raw)
  To: u-boot

This patch adds support for verifying a signed boot.scr. With this in place
it's possible for run-time Linux to update boot.scr to set different
variables such as switching between different boot partitions, pointing to
different kernels etc and for u-boot to verify these changes via the HAB
prior to executing the commands contained in boot.scr.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/configs/warp7.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index fe9b7d5..f340bff 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -53,6 +53,14 @@
 		"root=PARTUUID=${uuid} rootwait rw\0" \
 	"ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\
 	"warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
+	"do_bootscript_hab=" \
+		"if test ${hab_enabled} -eq 1; then " \
+			"setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+			"setenv script ${script_signed}; " \
+			"load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \
+			"run warp7_auth_or_fail; " \
+			"run bootscript; "\
+		"fi;\0" \
 	"loadbootscript=" \
 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
@@ -79,6 +87,7 @@
 #define CONFIG_BOOTCOMMAND \
 	   "mmc dev ${mmcdev};" \
 	   "mmc dev ${mmcdev}; if mmc rescan; then " \
+		   "run do_bootscript_hab;" \
 		   "if run loadbootscript; then " \
 			   "run bootscript; " \
 		   "else " \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (16 preceding siblings ...)
  2018-04-13 15:31 ` [U-Boot] [PATCH v3 17/17] warp7: Add support for automated secure boot.scr verification Bryan O'Donoghue
@ 2018-04-16 18:12 ` Breno Matheus Lima
  2018-04-16 19:58 ` Fabio Estevam
  18 siblings, 0 replies; 20+ messages in thread
From: Breno Matheus Lima @ 2018-04-16 18:12 UTC (permalink / raw)
  To: u-boot

Hi Bryan,

2018-04-13 12:31 GMT-03:00 Bryan O'Donoghue <bryan.odonoghue@linaro.org>:
> https://git.linaro.org/landing-teams/working/mbl/u-boot.git/log/?h=linaro-mbl%2bbod
>
> v3:
> - Reword commit message of patch #16 - Breno
>
> - This patchset now relies on five in-flight patch-sets the first four of
>   which should be applied first
>
> 1. [PATCH v3 0/3] NXP WaARP7 set serial# from OTP fuses for USB iSerial
>    Already has a Reviewed-by from Fabio
>
> 2. [PATCH v3 0/2] imx: hab: Add helper functions for scripted HAB auth
>    Has a Reviewed-by: from Breno
>
> 3. [PATCH v3 0/2] WaRP7 unify secure and non-secure defconfigs
>
> 4. Pierre-Jean's generic load patches
>
>    [U-Boot] [PATCH v3 1/2] warp7: include/configs: use generic fs commands
>    in CONFIG_EXTRA_ENV_SETTINGS
>
>    [U-Boot] [PATCH v3 2/2] warp7: configs: enable CONFIG_CMD_FS_GENERIC
>
> 5. [PATCH] bootm: Align cache flush begin address
>    This last patch can be applied in any order
>
> v2:
> - Ensure warp7_defconfig boots existing yocto with this change plus the
>   automated HAB layer being added here following on from "[PATCH v3 0/2]
>   WaRP7 unify secure and non-secure defconfigs"
>
> - Fix reference to partition #1 versus partition #2 in select uuidpart
>   patch
>
> - Rebase on top of Pierre-Jean Texier generic load patches
>
> - Drop my patch which did the same thing as Pierre-Jean's patch via
>   ${loadcmd}
>
> - Update example boot.scr from v1 to reflect use of generic 'load' command
>
> - This patchset now relies on four in-flight patch-sets which all have the
>   relevant Reviewed-by tags from the board Maintainer Fabio.
>
> 1. [PATCH v3 0/3] NXP WaARP7 set serial# from OTP fuses for USB iSerial
>    Already has a Reviewed-by from Fabio
>
> 2. [PATCH v3 0/2] imx: hab: Add helper functions for scripted HAB auth
>    Has a Reviewed-by: from Breno
>
> 3. [PATCH v3 0/2] WaRP7 unify secure and non-secure defconfigs
>
> 4. Pierre-Jean's generic load patches
>
>    [U-Boot] [PATCH v3 1/2] warp7: include/configs: use generic fs commands
>    in CONFIG_EXTRA_ENV_SETTINGS
>
>    [U-Boot] [PATCH v3 2/2] warp7: configs: enable CONFIG_CMD_FS_GENERIC
>
> v1:
> This series enables an automated HAB verified secure boot which chain-loads
> via OPTEE see `git show 5cf3251..c225e7c` for details.
>
> This set depends on three in-flight patchsets
>
> 1. [PATCH v3 0/3] NXP WaARP7 set serial# from OTP fuses for USB iSerial
>    Already has a Reviewed-by from Fabio
>
> 2. [PATCH v3 0/2] imx: hab: Add helper functions for scripted HAB auth
>    Has a Reviewed-by: from Breno
>
> 3. [PATCH] configs: warp7: Fix CAAM on boot with tip-of-tree
>
> I'm trying not to make this cover email too long. So - once this set is
> applied it is possible to boot from the BootROM using HAB to verify
>
> - u-boot
> - boot.scr
> - Kernel
> - DTB
>
> Chainload via OPTEE and boot up to Linux. If there is a HAB failure at any
> stage of the process we force-drop down to the USB HID failover mode, from
> which we can send up a recovery image to unblock.
>
> I've run the WaRP7 default u-boot and this new version on NXP's reference
> yocto image and verified that that yocto image boots with both versions of
> the WaRP7 -> warp7_defconfig and warp7_secure_defconfig.
>
> http://freescale.github.io/#download -> BoardsWaRPboard community - WaRP -
> Wearable Reference PlatformFSL Community BSP 2.3fsl-image-multimediawayland
>
> In addition the modifications targeting warp7_secure_defconfig mean it is
> possible to chain-load via OPTEE using scripted HAB to verify images prior
> to exiting the u-boot domain.
>
> Here is an example of the scripting we are doing which shows further reuse
> of shell functions introduced in previous patches.
>
> #### Example secure-boot boot.scr.imx-signed ####
>
> # This section is responsbile for loading a signed Linux kernel
> setenv image_signed zImage.imx-signed
> if test ${hab_enabled} -eq 1; then
>         setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}
>         load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${image_signed}
>         run warp7_auth_or_fail
> else
>         run loadimage;
> fi
>
> # This section is responsbile for loading a signed FDT image
> setenv fdt_file_signed imx7s-warp.dtb.imx-signed
> if test ${hab_enabled} -eq 1; then
>         setexpr hab_ivt_addr ${fdt_addr} - ${ivt_offset}
>         load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr}
> ${fdt_file_signed}
>         run warp7_auth_or_fail
> else
>         run loadfdt;
> fi
>
> # Boot from rootfs1 by default
> setenv mmcpart 3
>
> # But if the rootfs2 file exists in partition 2, boot from rootfs2
> ext4size mmc 0:2 rootfs2 && setenv mmcpart 5
>
> # This section is responsbile for loading a signed OPTEE image
> setenv optee_file /lib/firmware/uTee.optee
> setenv optee_file_signed /lib/firmware/uTee.optee.imx-signed
> setenv loadoptee "load mmc ${mmcdev}:${mmcpart} ${optee_addr}
> ${optee_file}"
> if test ${hab_enabled} -eq 1; then
>         setexpr hab_ivt_addr ${optee_addr} - ${ivt_offset}
>         load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr}
> ${optee_file_signed}
>         run warp7_auth_or_fail
> else
>         run loadoptee;
> fi
>
> # Set UUID mmcpart will be used to pass root id to kernel
> setenv rootpart ${mmcpart}
> run finduuid;
> run mmcargs;
>
> # Now boot
> echo Booting secure Linux/OPTEE OS from mmc ...;
> bootm ${optee_addr} - ${fdt_addr};
>
> # Failsafe if something goes wrong
> hab_failsafe
>
> Bryan O'Donoghue (17):
>   imximage: Specify default IVT offset in IMX image
>   warp7: hab: Add a CSF location definition
>   warp7: hab: Set environment variable indicating HAB enable
>   warp7: defconfig: Enable OPTEE for WaRP7
>   warp7: Allocate specific region of memory to OPTEE
>   warp7: Print out the OPTEE DRAM region
>   warp7: Specify CONFIG_OPTEE_LOAD_ADDR
>   warp7: defconfig: Enable CONFIG_SECURE_BOOT
>   warp7: defconfig: Enable CONFIG_BOOTM_TEE
>   warp7: Make CONFIG_SYS_FDT_ADDR a define
>   warp7: Add Kconfig WARP7_ROOT_PART
>   warp7: select uuid partition based on rootpart
>   warp7: Define the name of a signed boot-script file
>   warp7: add warp7_auth_or_fail
>   warp7: hab: Set environment variable indicating IVT offset
>   warp7: defconfig: Enable CMD_SETEXPR
>   warp7: Add support for automated secure boot.scr verification

For the entire series:

Tested-by: Breno Lima <breno.lima@nxp.com>

Thanks,
Breno Lima

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow
  2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
                   ` (17 preceding siblings ...)
  2018-04-16 18:12 ` [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Breno Matheus Lima
@ 2018-04-16 19:58 ` Fabio Estevam
  18 siblings, 0 replies; 20+ messages in thread
From: Fabio Estevam @ 2018-04-16 19:58 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 13, 2018 at 12:31 PM, Bryan O'Donoghue
<bryan.odonoghue@linaro.org> wrote:

> Bryan O'Donoghue (17):
>   imximage: Specify default IVT offset in IMX image
>   warp7: hab: Add a CSF location definition
>   warp7: hab: Set environment variable indicating HAB enable
>   warp7: defconfig: Enable OPTEE for WaRP7
>   warp7: Allocate specific region of memory to OPTEE
>   warp7: Print out the OPTEE DRAM region
>   warp7: Specify CONFIG_OPTEE_LOAD_ADDR
>   warp7: defconfig: Enable CONFIG_SECURE_BOOT
>   warp7: defconfig: Enable CONFIG_BOOTM_TEE
>   warp7: Make CONFIG_SYS_FDT_ADDR a define
>   warp7: Add Kconfig WARP7_ROOT_PART
>   warp7: select uuid partition based on rootpart
>   warp7: Define the name of a signed boot-script file
>   warp7: add warp7_auth_or_fail
>   warp7: hab: Set environment variable indicating IVT offset
>   warp7: defconfig: Enable CMD_SETEXPR
>   warp7: Add support for automated secure boot.scr verification

For the series:

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-04-16 19:58 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 15:31 [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 01/17] imximage: Specify default IVT offset in IMX image Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 02/17] warp7: hab: Add a CSF location definition Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 03/17] warp7: hab: Set environment variable indicating HAB enable Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 04/17] warp7: defconfig: Enable OPTEE for WaRP7 Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 05/17] warp7: Allocate specific region of memory to OPTEE Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 06/17] warp7: Print out the OPTEE DRAM region Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 07/17] warp7: Specify CONFIG_OPTEE_LOAD_ADDR Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 08/17] warp7: defconfig: Enable CONFIG_SECURE_BOOT Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 09/17] warp7: defconfig: Enable CONFIG_BOOTM_TEE Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 10/17] warp7: Make CONFIG_SYS_FDT_ADDR a define Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 11/17] warp7: Add Kconfig WARP7_ROOT_PART Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 12/17] warp7: select uuid partition based on rootpart Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 13/17] warp7: Define the name of a signed boot-script file Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 14/17] warp7: add warp7_auth_or_fail Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 15/17] warp7: hab: Set environment variable indicating IVT offset Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 16/17] warp7: defconfig: Enable CMD_SETEXPR Bryan O'Donoghue
2018-04-13 15:31 ` [U-Boot] [PATCH v3 17/17] warp7: Add support for automated secure boot.scr verification Bryan O'Donoghue
2018-04-16 18:12 ` [U-Boot] [PATCH v3 00/17] warp7: Enable automated OPTEE/HAB boot flow Breno Matheus Lima
2018-04-16 19:58 ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.