From patchwork Tue Apr 24 17:46:33 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: 903741 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="hkYojgCo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40VrcP0N1Kz9s0v for ; Wed, 25 Apr 2018 03:56:36 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ACB74C21F3E; Tue, 24 Apr 2018 17:53:53 +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 74AABC21F21; Tue, 24 Apr 2018 17:47:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AA6A9C21FA1; Tue, 24 Apr 2018 17:46:56 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by lists.denx.de (Postfix) with ESMTPS id 5E535C21ED6 for ; Tue, 24 Apr 2018 17:46:56 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id t67so2684938wmt.0 for ; Tue, 24 Apr 2018 10:46:56 -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=vJEKqyilK/IAJXVyPhPTBOvlJZRypoCnJv8RPkg6BxU=; b=hkYojgCoa9Ellbwle+r1RFy1lzsV8B5t5A6FApc8JWYA4EZPbEn6v0ausj/0ZzZqlJ kAcXqQLcD1C1sfZCvlaNxvEVJ6SckxGfltz4fvM1jM18pOxi40FDEq8FgNJYi2ak8svO OKbG34r2A+GBFpuH2ILZaDJ1LNJeq08B6n5RU= 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=vJEKqyilK/IAJXVyPhPTBOvlJZRypoCnJv8RPkg6BxU=; b=gznxQ2LxX+wbTBsELyJ2HleLpKOnIlwTZ4aLaWSbZ/QLwelqZpDyZPwPmFcbSybY0r KMlsxKvtPfwJT8n/NcuFGPM9R4PO86srUC4cToDxp22a7u+sWWOiIcbDw3It6U0TfWA9 YoJuWa0jRRzJ3OwKjFwUiub7uTJA/VQ83lh74Aoe2TXMV1cJ9+1iMjHQAARKM66JmO+A bNB+VwJM6cjoaPnsgUwOFdXScuzXiT2m4RvW0kN3LWuXq1y78ZTzwzQQolpQ3fDqQhPk BqyGaO3HRZsoVmcs9OomTzsHkM2ttdWnpDvT/ra+8+DNPFcgUYC1XxhuWGWqAMwngmX2 gYlQ== X-Gm-Message-State: ALQs6tA4jdYI4s4omE6bH7Pe6hrHSR6vuiYed4MTUtVjO/J3oTxkcFgB W44Z2L9RxpsV3pMEYxniN6/g2s6986E= X-Google-Smtp-Source: AIpwx4/hEP9zZQyKO94N5K1WDubq0EqBFo+N8mLlYFCZ+YOhtyw5X1CgP4eWWYL4ogCNwO/TSHkgnw== X-Received: by 10.167.211.78 with SMTP id m14mr24316606edr.108.1524592015833; Tue, 24 Apr 2018 10:46:55 -0700 (PDT) Received: from event-horizon.net ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id e6sm6443087eds.20.2018.04.24.10.46.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 10:46:55 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, sbabic@denx.de, fabio.estevam@nxp.com, breno.lima@nxp.com Date: Tue, 24 Apr 2018 18:46:33 +0100 Message-Id: <20180424174647.11840-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180424174647.11840-1-bryan.odonoghue@linaro.org> References: <20180424174647.11840-1-bryan.odonoghue@linaro.org> Subject: [U-Boot] [PATCH v4 04/18] warp7: hab: Set environment variable indicating HAB enable 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 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 Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- 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 327f656c44..0d3d324571 100644 --- a/board/warp7/warp7.c +++ b/board/warp7/warp7.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -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 0c3b605de3..c6ab29a831 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