From patchwork Mon Apr 2 22:41:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 132677 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3097430ljb; Mon, 2 Apr 2018 15:42:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx486/DBbLKcBfG+N48BQqal7IJ8OXOvlVDkXF1T1CsZJXc1VqRqWPfIeRAxL62LNMJmNhhA5 X-Received: by 10.80.165.164 with SMTP id a33mr14013140edc.289.1522708949130; Mon, 02 Apr 2018 15:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522708949; cv=none; d=google.com; s=arc-20160816; b=a5/U5rsy3pxkQuiZTfFiEXaVbW2NZskfVk8aMKWbae/+F+OjnBQEkFf2+CMeiyVxU/ p87k2hrrbNQKEsGEC5rY46/TO13xSIMEMcaBnDEPs3DKhHbwP9ApcRCBPI1rWvr5iQKq yDjNw3bVunTydi8ocyoHSrQfBsL3WNYGFCgUjllhvUoGg5nz8uj6ajB9qdIoHNUDZX8O i3hM9Bue+TRAvydenIc0gr1LSKJVNqpAheOjgUEZi0O9Xt5R3QnO9gYuhA85UxxzKxGp OaIIZuOSSObUjEoFt3RgoKE/t96HN4ZCxKYRMdWF+ZIzcFpDxcL8zs1riFI41PbOGQBt UlTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=zW1JhL5tUrvSkazre3sdLP+IcjAkK9Gzquo3LfaREtE=; b=ad8z0yndseOnuag/cz1ALzUQErNpzWxD500qd8BrmCfRjO7k3eBH8B4+IPad5j+9cs 6u68RUqp+Wy5ATQfvpgh3SmpAt0xE5UtHrmSAed5QgOAqL8BvmIiWLzZqP9M+A5HiN5j 5W9rwzmme2Q3ZfOgt0J07D5OcLWhEvA/y8dYCsvjr9480ABAay5eswRmIBFRDX4iiM2v q9BFUPsnk8Pgdl/UnrHC+xdja3ilem9bke35ltMFgsBh4VvE2LMEQLhgcky/7uTw1Lj3 dJzlMlBovczH/YOxWxJUaLIUvMLZlWYU2hvFlf5b2uRnyyAzLrk+u2MhpZ/8sfNyXDVY yMMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YELoSSBK; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id e2si1284894edj.156.2018.04.02.15.42.27; Mon, 02 Apr 2018 15:42:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YELoSSBK; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id A09C5C21EA6; Mon, 2 Apr 2018 22:42:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5CD69C21DB3; Mon, 2 Apr 2018 22:42:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1EB09C21DB3; Mon, 2 Apr 2018 22:42:20 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id 884BBC21CB1 for ; Mon, 2 Apr 2018 22:42:19 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id f125so30445830wme.4 for ; Mon, 02 Apr 2018 15:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=VU4quj7M8xMxt+cs/BCihOhvsWmuBpv2e79OULHXUEE=; b=YELoSSBKynRv87ZHdDHGtEiB/H31a6YHtv8/BRy6ym0D7PDKmZW5139DwWtWBRychu MNudjpmuQqFDH1AmO2CG/mhmTO67Cov69Oye3Zfl12iYjjQa7b6ywdTXSBTY5baxDtJb wu4dNyubsHNioxIDqrmkvlMixX4avmKo+rzgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VU4quj7M8xMxt+cs/BCihOhvsWmuBpv2e79OULHXUEE=; b=sNHjlSsqRt1k+dk0qIHnolxhTSZBPEep7Lk37k5ulDwrH7vSnnkZ0RtprZ/lN1qYxT rDDSQ6P6Y0vucCl/mfMz8uGstUtsI+8MbEMmAiKgQ10cGeaRO8+hIIDDE7GrxyYHqAid TyG0A+ZQ56pVp/nylSBry9m5bsJIBoysezjWqbb51NF9HFFKl1NPcO88lZ5gxuEgykX5 Qk5No86Qos1AFkeoiPZ5O1vK4zTU5bgTBPa478S4hryLztsc/83hqt80pxHotIxbLKCb LYtYB4a+6blf+W4S5e8A3Gi/Ami3Xw8DOBuA0UB4tWFgGx7+k8UFl/I8bxtyfFYzyNCM 6Jxg== X-Gm-Message-State: AElRT7GXpZN+tr9C6fdtt32ZAn5PK103n5NdOY0IK2k4g7Lq+HYAdQ+y lXmvxG4bLhpePkpx/S80tqkePazuFpw= X-Received: by 10.80.214.86 with SMTP id c22mr14333856edj.80.1522708938806; Mon, 02 Apr 2018 15:42:18 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id s8sm842086edk.76.2018.04.02.15.42.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Apr 2018 15:42:17 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, fabio.estevam@nxp.com, sbabic@denx.de Date: Mon, 2 Apr 2018 23:41:59 +0100 Message-Id: <1522708936-7603-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: breno.lima@nxp.com, rui.silva@linaro.org, paul.liu@linaro.org Subject: [U-Boot] [PATCH v2 00/17] warp7: Enable automated OPTEE/HAB boot flow X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" https://git.linaro.org/landing-teams/working/mbl/u-boot.git/log/?h=linaro-mbl%2bbod 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(-)