From patchwork Fri Apr 13 15:31:04 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: 133385 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp846755ljb; Fri, 13 Apr 2018 08:31:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx49KEA6rtNSou2MrbBwQaAwOckFkBVdYaQ64QHrHVwTisHnQmEb35tqCAJ/ln/VX4bl1AeQE X-Received: by 10.80.193.153 with SMTP id m25mr16463340edf.151.1523633491494; Fri, 13 Apr 2018 08:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523633491; cv=none; d=google.com; s=arc-20160816; b=QviNGvaxyqp+Htl3y10wjn2HRH/bQ4nepbNAVxbm86sSBoUR42qdgoYEnTYIakhpAH fNPgqFotzNKQFBKD0XaaXSA7QnG3KEjf7Y1p2deL2ISY2FInE7NMx+Ok6ltNlcred8vs WQqyi2rRCseCIWECMJRZ1jGJxSYlmzbPWXwznV16l6sdKfqirPiOp1LBlrr1x9XFEun0 IizNoBhxlZLOXCTzRBcoExRhfx282XXvV5D8KXzQnj54Wk5DCuIDWFz1LsuKQwwfVLUx FkQq8O62kTbV/BjcgfMx2sl6t0LemAVMwar09ud6pFhzX/XCaeXRJdKxNrVz0u/3rp5z bA7w== 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=mm5k1qYozi91IgIVOB1hZ18A4Z2z0an4/sFj5sVgG6c=; b=n8J4bsR7XMyh+qEWjT/9elCVDbWJK86MyolCm5txgO+T8wP1F1/0cNEJYhKQFhKo7e Vi9FY0c1h/y0KBx5myieJK3Xs8/mre/N0ttEipG3SPpL6hpJsi6Vcede4l4BqVwSTSWa y0FocjPZqn2+1WLKEgJWMaP6rl8qS0HuWrEO1eJyLoi/aQ2AfUymCE825JHWO0s/KSmf 1ltayD+tmW5ajeg3arwKV59bSftjiqOLwikWRisBWqwCvtS282XzYA2qt4Ru8LEED10b smyR36/U7W0FbiplWHiNTE29U21aWJiFISGH4oghlKbzjxMYLPwJCzDeHeQHnG4YVdBe NiNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EophzsZa; 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 l48si3908238edb.260.2018.04.13.08.31.30; Fri, 13 Apr 2018 08:31:31 -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=EophzsZa; 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 91026C21DD4; Fri, 13 Apr 2018 15:31:28 +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_DNSWL_BLOCKED, 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 C0197C21C38; Fri, 13 Apr 2018 15:31:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6CBC1C21C38; Fri, 13 Apr 2018 15:31:24 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by lists.denx.de (Postfix) with ESMTPS id 13B26C21C2F for ; Fri, 13 Apr 2018 15:31:24 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id d1so9151032wrj.13 for ; Fri, 13 Apr 2018 08:31:24 -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=gSL3vmgYrlhhr6OtEjQButBV9xlvahezMPD63E0kpqM=; b=EophzsZaWy9U7P+wNddw0yUvSF94uBkC4TLVz9ZxJLpSPh12TM3gUsLyxlEBsLdKKC 33m58Mx/lYrJIXT/v408fFNhyOLOJUf0Pb0XbZNka5iVYdIDzgC0QayJeYDs4VdH6ncl XCfppu+UMKVzItqq4ySxnD5MZqkV6h8ld5y4M= 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=gSL3vmgYrlhhr6OtEjQButBV9xlvahezMPD63E0kpqM=; b=nOWABKj0IyXO6adGqpWuf31z71IibMHQgzczPzPMj0+Z63in800QSugxqql9BsAN8A vnj2bDfOBwYHZdWBp0FZiSgu2rJfVMZ6pVJdxjzLBF+QjEDRKMc7P8s97XI4rQ7HV9A+ MTQk4gCWL2ksLQOaXDZnxxsdB5i4HVIEhhmt6FKjnMfMjh4kH3yM8ENsWCCMhP0HNQ6U R3IsPbsObVb6BrOf63v68JvQJfKuZyvcQdsPuD06g0K/mVhea52d/Zh6CP9lg8iiSeER Ok2Qb6DFQu/dOyCGQWTYLr4xWdC4gTzLow4Gi9nYb3y0tdtNdDRU0CbOoblWXtnCfvOG JuBw== X-Gm-Message-State: ALQs6tBGH3fFkEK0GcxcQqDdzimDwBcccP/Wg7ecAqcpolaaHfSByCGF ApeR791oFWXyBWropd+/U2mmQeRfajg= X-Received: by 10.80.162.6 with SMTP id 6mr8498909edl.281.1523633483402; Fri, 13 Apr 2018 08:31:23 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x35sm3516008edx.86.2018.04.13.08.31.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Apr 2018 08:31:22 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, fabio.estevam@nxp.com, sbabic@denx.de Date: Fri, 13 Apr 2018 16:31:04 +0100 Message-Id: <1523633481-20914-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 v3 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 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(-) Tested-by: Breno Lima Reviewed-by: Fabio Estevam