From patchwork Mon Mar 26 14:11:43 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: 132408 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3894585ljb; Mon, 26 Mar 2018 07:13:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx48oDa6b5Xb5eihV5y8uyuy5sxzirI3iNrwwj/OOYzpNyICdqLPGSv322B2Q953zRNPIlg/u X-Received: by 10.80.243.21 with SMTP id p21mr5757157edm.153.1522073584851; Mon, 26 Mar 2018 07:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522073584; cv=none; d=google.com; s=arc-20160816; b=sLeLp/MLo+dY4peADmAEICoxOpbjOa48IKaFe0vLqA8yqe0VpDEk/yJR8bhfdP0u6w 9uuMGMYY8eBAxHH3+O0+RKx5+YgBAwxLpkF9nMvUXhx1T27QqUroeGtGTMp/hMSWMomG 8EmrmXJLlrMm0yHI3jv6UoChQq1bOU12y4a0hRvK4SgGxlOd/T7IrwEcL0usF7Kw8B8U Hlfob9d2rjpbMu8pr373oUBRcKClad2iJ1Xx2XWNrTYpfKYl8ssgWWzt3SORoI+g9ehK tCcu9RpOTle7rPQEQD6SdlXNS5Mi1kagwiHZ166GTHXaDROSBobqK3CDLeRW3KUquYFQ ld1A== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=7YSwblQY0zJgFRUFSYOOLIrONIzx1YlgN+lgRkGMeQQ=; b=faAtcVZ83xLb8s7N+D/lMmiJScW7zwMhJ0VGd8hSKerJlr8xc4Yvqin4T4YyotW+JO rlucpOuPRZ6zoHf/HpFJemVovdvxnwlyLrojaM6h7vzSCAjrXqjK25dzYlS0YiZ2mu6N qfU/YiuoZpCRKeJgm6Ps2dRlTSmqdka/GQH9a+gHU+uItMgOezX9v+SthWy6frh2elhw dejqk6w0CgYbYDVVMtri2Yym/kB4hdvdEIyVTc2sO/jUa2X2dwSEKEg8NNwaJRq+PkoM JjzwKE9Ey6vyYk6YDQZ90PLhWsGFIFWb1zFCSk9+Iw+xPHhA5opo1eCHC/jNp1DQ6IkD 0/BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=etO9b9Ku; 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 a56si8192511edc.11.2018.03.26.07.13.04; Mon, 26 Mar 2018 07:13:04 -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=etO9b9Ku; 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 64B39C21F35; Mon, 26 Mar 2018 14:12:08 +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_H3, RCVD_IN_MSPIKE_WL, 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 C20DDC21F32; Mon, 26 Mar 2018 14:11:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 80B65C21E7E; Mon, 26 Mar 2018 14:11:49 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id F3029C21E26 for ; Mon, 26 Mar 2018 14:11:48 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id l16so15819744wmh.3 for ; Mon, 26 Mar 2018 07:11:48 -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:in-reply-to:references; bh=rzoIKHhhWd2qWMFKQ+oYI8u1CUjNVZwwjeZrLbeB7os=; b=etO9b9Kuyosd/YokslTFo1XKLUTxWqayBNsNMZB1OjpPaxQVjR0+qWWXX85ezq7w/z BdEVfB9Tb5oA/MKygcDoGjdRArSiAP+/504YaBh/jeDhCxiSdHEVW80etAnR60WBSiBd doFgIDwOy4SlZ9HhzQ0qgmaxXDrFgqcgeNPR0= 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:in-reply-to :references; bh=rzoIKHhhWd2qWMFKQ+oYI8u1CUjNVZwwjeZrLbeB7os=; b=cirAzAKbE4WLl2o6kmbH6HlvNHNz0h2Wp9ZQDBa4GDYOpdeLykS2e/MU7yV/AgwtQE wX78xbhIt0F3nTowQ/JKG/QI4jwK/TgfuvjKqPWOoIqCC3z1jZLYvkG9FaoRSf0++zUV zR8CURA9t5LmsuSyTfL3Dac4D3EZGW3jPqSQZ85s6deVCiLUJUpykPh4tLrdg3qDORQM d0JrpjCtpN+Z4jpv46WRQ67Qn7J7Cogd0FFF1+gs9ntTtgICFKVB0c8P2BgDHRja5fZZ mBE0/3fSmPh8VC7SlCX7Y7z6gBDIvMRzPfQlK/IHgKxE2/iv+z5lOtGXYVLrxn1exv3j ziIg== X-Gm-Message-State: AElRT7GcWNc9fwoHe0AVOsKTIWShNwodHLuSXNtJLRbX4SdPu5Yg5bha cKxgM5ox/6XAA1TQP5le/9dhGOCSeiM= X-Received: by 10.80.247.4 with SMTP id g4mr15917189edn.121.1522073508370; Mon, 26 Mar 2018 07:11:48 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a10sm10714045eda.71.2018.03.26.07.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Mar 2018 07:11:47 -0700 (PDT) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Mon, 26 Mar 2018 15:11:43 +0100 Message-Id: <1522073505-13066-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522073505-13066-1-git-send-email-bryan.odonoghue@linaro.org> References: <1522073505-13066-1-git-send-email-bryan.odonoghue@linaro.org> Cc: breno.lima@nxp.com, fabio.estevam@nxp.com, utkarsh.gupta@nxp.com Subject: [U-Boot] [PATCH v2 1/3] imximage: Encase majority of header in __ASSEMBLY__ declaration 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" Subsequent patches will want to include imageimage.h but in doing so include it on an assembly compile path causing a range of compile errors. Fix the errors pre-emptively by encasing the majority of the declarations in imximage.h inside an ifdef __ASSEMBLY__ block. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam --- include/imximage.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/imximage.h b/include/imximage.h index de1ea8f..553b852 100644 --- a/include/imximage.h +++ b/include/imximage.h @@ -56,6 +56,7 @@ #define DCD_CHECK_BITS_SET_PARAM 0x14 #define DCD_CHECK_BITS_CLR_PARAM 0x04 +#ifndef __ASSEMBLY__ enum imximage_cmd { CMD_INVALID, CMD_IMAGE_VERSION, @@ -197,4 +198,5 @@ typedef void (*set_dcd_rst_t)(struct imx_header *imxhdr, typedef void (*set_imx_hdr_t)(struct imx_header *imxhdr, uint32_t dcd_len, uint32_t entry_point, uint32_t flash_offset); +#endif /* __ASSEMBLY__ */ #endif /* _IMXIMAGE_H_ */ From patchwork Mon Mar 26 14:11:44 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: 132407 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3894552ljb; Mon, 26 Mar 2018 07:13:03 -0700 (PDT) X-Google-Smtp-Source: AG47ELvgNGP40vyXiZ3WpmLmuXCI1B7K6AcSM55h+3LHeR7aspZVbLPlURboMen9ClZi+WRAVw5N X-Received: by 10.80.212.44 with SMTP id t44mr40926920edh.12.1522073583375; Mon, 26 Mar 2018 07:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522073583; cv=none; d=google.com; s=arc-20160816; b=XtkOR87VC58KRUR/mqUiG0s+yZbG+kdPD60VVtOpy/oFBO3BAs3X9G7JDmctNNG8AG du+auDgAISPajdhK8pufi5Ph8e/c0GBCkVpQvzntMKAM9xxkFkWgltTARnQuSTwGuJDM b2ID62u36hEfTXjYcPV56bjbZe4cgdnx61IZStT5PKwl2id48OD1fZBDVEDkiGTxWkHJ lKbcP3IvMDiZxJ2oiGeODKya1HW4Jp9hgIcuTdjiWH5s6BIWdk4Jmqsy42buQO/z4nOI sFfbo593m/ihV27mjh0gJ6hReo3hAfe5Yi0RHEet+0Slm7DLDWEguoniiBfeeRFi3Rjc ThZg== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=03CqWXyFB9YkD0lJD/TPcU4K3JCcNRg/+Qekm1d4C5U=; b=T1b0SvkBbhZnyumzJbqxUd2N2nhsV5jv0N+nsSYjMj55i591Ckjrt9m/x6bCMLYKFF 0b6fOSjAfg5BACcJr2unauydO0NrtmvYCpELoyqSvvqOuxOEBhwnBZcD2Z+5ePr6uhsN T1VEUfNtHjV6K4hLh4ncG7B3sLFrqmZEtWic6fYaB3BYRxrf+Yghio7QUW/YlM6McgQz W5nqpvIvBcmX/4sjBAgzXRiATxc7Gyl6X+MF4kAkTz2SgcU56R026ey6adsoLkfq6cor LDkfDi3iZ2i+v50b4QlKH25oQFOMcnyXR/TOnVXqk2ne/pRH/xwzvfMmqhS2jK/Ny4en 9vFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FDT4yCEp; 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 q15si1461485edd.343.2018.03.26.07.13.03; Mon, 26 Mar 2018 07:13:03 -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=FDT4yCEp; 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 D2D13C21F00; Mon, 26 Mar 2018 14:12:25 +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_H3, RCVD_IN_MSPIKE_WL, 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 A57C8C21F4A; Mon, 26 Mar 2018 14:12:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 844DCC21F52; Mon, 26 Mar 2018 14:11:53 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 322CEC21EE7 for ; Mon, 26 Mar 2018 14:11:50 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id r82so15865156wme.0 for ; Mon, 26 Mar 2018 07:11:50 -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:in-reply-to:references; bh=FTY450W573+LAOAxsd6pMkGZOtoltz0Gr3RUeQrcG04=; b=FDT4yCEpXaFhwnG2Erj0hSBqGHlrCE2u86o6AWDnPpzC3Es597Ld/aC+Qw0vTa6VWu aJw3QAoAuWLFrtLYOvRJMsUfEIL/tL6fHL5Erx3WOzjtzZXp6/C96tc/IGyhRZaMl1qq C1CBZmHFMuO4wMKhq2EHpdWUeVL4EMhUzLADE= 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:in-reply-to :references; bh=FTY450W573+LAOAxsd6pMkGZOtoltz0Gr3RUeQrcG04=; b=LPALAAzPEmf+58sWtV0XLFi8UjIoe42uYb7JXoo94cFauczgo1oBji+GykuxCkitxt mM7qrQ/G+fUR70mYBUqKErMJyz4DAeAHNTTdwlaTDml1zy1xBPcrFUMDzvVtkT2CDJz1 lDN8b7qciapWweQv5dXckXNCIWKOu+VvSi0ZZH2zDhELayAhL0S4uIRhAznkhus5ngjj wl6/haC8b6rzt4kXx3EKl1OH97lCV/L5cjq//AWXPRDK5RKITivTaqjz4FD4LelijRBl zJQZxGHWLLDtCPZXpHjMtHothOr2b1rfse74zzqo/l8cX/VgvRhCNaZk++/vf/4YAxzq dM6g== X-Gm-Message-State: AElRT7F1WwQAF27NlK6D4h1OOrjTl/H7a3AlEc6K7GDR1MI02Oc2CgEM bYNqBqoQiB9G5XHXZxLt+FPhWSUqtqk= X-Received: by 10.80.137.13 with SMTP id e13mr33029808ede.292.1522073509578; Mon, 26 Mar 2018 07:11:49 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a10sm10714045eda.71.2018.03.26.07.11.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Mar 2018 07:11:48 -0700 (PDT) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Mon, 26 Mar 2018 15:11:44 +0100 Message-Id: <1522073505-13066-3-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522073505-13066-1-git-send-email-bryan.odonoghue@linaro.org> References: <1522073505-13066-1-git-send-email-bryan.odonoghue@linaro.org> Cc: breno.lima@nxp.com, fabio.estevam@nxp.com, utkarsh.gupta@nxp.com Subject: [U-Boot] [PATCH v2 2/3] imximage: Specify default IVT offset in IMX image 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" 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 with an upcoming set of BSP patches making use of that offset subsequently. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam --- 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 From patchwork Mon Mar 26 14:11:45 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: 132410 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3895555ljb; Mon, 26 Mar 2018 07:13:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELuKLGilSJLCAY4f/LvNbatmI+xdNastaso1T51zkzgeHrvSGoVACSHTAoQmLUtdtGNrHxhF X-Received: by 10.80.217.68 with SMTP id u4mr40463384edj.241.1522073626666; Mon, 26 Mar 2018 07:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522073626; cv=none; d=google.com; s=arc-20160816; b=QZPUqnRUwQtE1M+++4lqYxIAysg/A5kcH4I+SabgGegDpYK/vi1KDOUrcvQdBcbml0 NeZGiPIDwEdBoO7o79M9Hn02JbRnceqZnBXgBpVWXrFK1uEzGlO10xYBbJIM8VocfDVu brb9mEcS4EaDHpe4vqfDr/1CZ5tzbYtHu15fIJxRHhfUJB0NFHd+VvJrxIQk9AALNYn5 7T7uLEPz5ocSU+EKjB+zO1+sJykhrzT2iqCfa5Q5e0SpR0ElkRjC+PKswT5CPV/glmPw DNfdgW8XFvWRdBzRK1bwEgQT9maKhSeP+HO3SylGZq6HzhvBrCgLqU3zQipDTe+aNNl5 IhKg== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=4m3BmWai9uA61JCaA2zQwxoLszE6KxK7WQh1SVgqwLg=; b=ELvY6Fkr3t56L5Wn56tASTh9ldmtsFT7YqtV7/UlRktha6f/yXJWTqef7Jqe23Nah7 MulVGQq6YlvVLA/pFXLWdDHWFeLw+OGQ8C6dxx3/gQQkDKabv66r5zOdqMa13OKORZuI A34GW3bNJJ4bN9Y4uHAwkXFI6F9OCvhU8uSIFx22/plLfL0gJ7vJUKSSf5vJ/DWUm8pT u33NjZhramo/k5I6zm0PAGg0imTiCJ22NcYZ4wLE4oMII876mFXhx52GXVWxZ1ej4wGD FjP1I7wRgF5O10Y9hqcy5/04fNjRLDez6AZuHj2jsmfup7iAsnKX9cO/B8BNONaFKV23 8qAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gJKgqZgh; 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 f58si4396838eda.62.2018.03.26.07.13.45; Mon, 26 Mar 2018 07:13:46 -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=gJKgqZgh; 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 A0159C21F58; Mon, 26 Mar 2018 14:12:41 +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_H3, RCVD_IN_MSPIKE_WL, 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 6F131C21F5B; Mon, 26 Mar 2018 14:12:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 978E3C21F3A; Mon, 26 Mar 2018 14:11:55 +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 41109C21F47 for ; Mon, 26 Mar 2018 14:11:51 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id t7so15725904wmh.5 for ; Mon, 26 Mar 2018 07:11:51 -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:in-reply-to:references; bh=Rn8td2mpFzHPshW3xP1CDBr/cWifBNZl0TdWk46pT9s=; b=gJKgqZghHNLSZ0RcSDcnZxvd36eZDzfc8ppn0QORxCvwVetHmFcEExVyF1gVRo4/O/ CBDoDEs3EApWsa24aF85sl7o8bQgonqp8gUcpRbqdFeThNuqONHerCmrQ/BYCCwuRDuH YybkRNdsIhYbiUqiVelu5ob4/cW4e1YERUgtY= 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:in-reply-to :references; bh=Rn8td2mpFzHPshW3xP1CDBr/cWifBNZl0TdWk46pT9s=; b=LLCkcZ0cP/fZUJKHOcxowLhIht9UsNJy/Ya19yKxP+KI1ucJc3z33hmn40VKA+rBTY Xs73tsCCqG/+kK9m9V7Eu0N7GZ3OxktBATEbAdA1QF5J8tH58xMghPnTF8DIdJfUniSn cZSPR4Rup/P5HwuM5zg7MMYvLOqwhMH5GRPZd04gFAZ0ejLm6fTf9UVPrzR0b2yzQVqs Ip1Qaj3zY9y40+y1tBQ4stj5bAmrLPNgKAnz+Wv1ryBPrSdUM1CfnWaFiJZ1bWXCmVuS HyYIKMGgI7GrLCI9WJGHD+eriDQVj9pLz3sJOWNPeEtvX3gr/WzfM/GqNnPcYw/RYXYS LHjA== X-Gm-Message-State: AElRT7Ed1J5nnI/f+64qkr3ywZC2ezbrUjjw/j/42FzgDtruhJX12Yko 7XN4DxrTPzL+DMBMWNJh1GhlJckhPWU= X-Received: by 10.80.214.206 with SMTP id l14mr40793690edj.44.1522073510610; Mon, 26 Mar 2018 07:11:50 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a10sm10714045eda.71.2018.03.26.07.11.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Mar 2018 07:11:50 -0700 (PDT) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, sbabic@denx.de Date: Mon, 26 Mar 2018 15:11:45 +0100 Message-Id: <1522073505-13066-4-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522073505-13066-1-git-send-email-bryan.odonoghue@linaro.org> References: <1522073505-13066-1-git-send-email-bryan.odonoghue@linaro.org> Cc: breno.lima@nxp.com, fabio.estevam@nxp.com, utkarsh.gupta@nxp.com Subject: [U-Boot] [PATCH v2 3/3] imx: hab: Provide hab_auth_img_or_fail command 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" This patch adds hab_auth_img_or_fail() a command line function that encapsulates a common usage of authenticate and failover, namely if authenticate image fails, then drop to BootROM USB recovery mode. For secure-boot systems, this type of locked down behavior is important to ensure no unsigned images can be run. It's possible to script this logic but, when done over and over again the environment starts get very complex and repetitive, reducing that script repetition down to a command line function makes sense. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam Tested-by: Breno Lima --- arch/arm/mach-imx/hab.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index c730c8f..9ca7bad 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -341,6 +341,31 @@ static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc, return 0; } +static int do_authenticate_image_or_failover(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + int ret = CMD_RET_FAILURE; + + if (argc != 4) { + ret = CMD_RET_USAGE; + goto error; + } + + if (!imx_hab_is_enabled()) { + printf("error: secure boot disabled\n"); + goto error; + } + + if (do_authenticate_image(NULL, flag, argc, argv) != CMD_RET_SUCCESS) { + fprintf(stderr, "authentication fail -> %s %s %s %s\n", + argv[0], argv[1], argv[2], argv[3]); + do_hab_failsafe(0, 0, 1, NULL); + }; + ret = CMD_RET_SUCCESS; +error: + return ret; +} + U_BOOT_CMD( hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status, "display HAB status", @@ -362,6 +387,16 @@ U_BOOT_CMD( "" ); +U_BOOT_CMD( + hab_auth_img_or_fail, 4, 0, + do_authenticate_image_or_failover, + "authenticate image via HAB on failure drop to USB BootROM mode", + "addr length ivt_offset\n" + "addr - image hex address\n" + "length - image hex length\n" + "ivt_offset - hex offset of IVT in the image" + ); + #endif /* !defined(CONFIG_SPL_BUILD) */ /* Get CSF Header length */