From patchwork Fri May 17 08:45:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 1100888 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; 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" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mSIG7kCq"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45522J1PzYz9s55 for ; Fri, 17 May 2019 18:46:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B139D875F2; Fri, 17 May 2019 08:46:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T1FQlIVV3F9d; Fri, 17 May 2019 08:46:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id DDD92867C8; Fri, 17 May 2019 08:46:08 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A7AAB1BF327 for ; Fri, 17 May 2019 08:46:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A4C828685B for ; Fri, 17 May 2019 08:46:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RvVPrl3KKhSD for ; Fri, 17 May 2019 08:46:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id ABFEE85F98 for ; Fri, 17 May 2019 08:46:06 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id j187so5926544wmj.1 for ; Fri, 17 May 2019 01:46:06 -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=pncfSmV9qHHRHU2TjXoqKRXdNtOc4sJDO7SSICaz8WI=; b=mSIG7kCqBb1zt4SogfBrF7ydnNPhMFgNnaogU+NZ+H7zEqE+3PZfZlpXV9CkmhuNpe 8DLiooL0UIOFRvdzUJXOisazYqLDe/jNXFhZZ7rBkCXypVdOSD8fqjX75GqYgbud2St/ iLtk6s1VcCSAb26qBnbS1EYZVmD0LIPdG6N1c0HmjHL1cKxDB2/aHsnV46R89hHYXcc+ dQ3EzHcPQGW2DcOIZYrsYsMSU9FBpmhTSh8VLnt96eJ43gnwippvThOAeFN+EXm/1EZ5 xrhsorUL2sKnRbhMy8FcRiHdCVPofGWNt92ja0GCOF8eFycjcA7LrgMGyWfz7VPf2ufz 9xrQ== 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=pncfSmV9qHHRHU2TjXoqKRXdNtOc4sJDO7SSICaz8WI=; b=ltyJ4QF7eys5djDnHlUpOYKJqMHEgzhx9wplTshHSkdZmRwwu7+xEfU/4fBJA3Eg6g aVs0gIBE3h/jV9srLynqOAM4MgE9sZCEfl1BFMK9f1aakcFJ/OcboKXXFNsHY9qOhTud 5XTvcRPiztAowjVWZyyH4fB8UwxguA2hrfKFSivYrpquqgOz9vNZJ0klYv107avO2fxV tgHTJ8AqW0j6ja+fHVCEH+TLsjkNRyCwy361Wkmbbrm+Ijjsp5hX9MGnL7yfBD4U8on6 ufdFZmCGoOF+XWc/9Lf47tlrfiTYURiTA7sANJE1fgi8zSWtfHlP08eAnfcZ7JYJXrq7 snkA== X-Gm-Message-State: APjAAAX3rKTSWFyf/kltCFFyjDOKBrxG3PDYJrUl86UbcB/FJsVNWFvV ZQHcw+DcT2PuhhIkFfnFwFWpO/5nE3s= X-Google-Smtp-Source: APXvYqzKHCHuRvTX4IWKMXkSvSWzHuO/tzYvtyoWlFN/EmBDu5DPrf7EQ9rgOl+HSW0l9rkxzcEfpg== X-Received: by 2002:a1c:a745:: with SMTP id q66mr21205906wme.83.1558082765026; Fri, 17 May 2019 01:46:05 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([80.215.153.220]) by smtp.gmail.com with ESMTPSA id k30sm11657141wrd.0.2019.05.17.01.46.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 01:46:04 -0700 (PDT) From: Etienne Carriere To: buildroot@buildroot.org Date: Fri, 17 May 2019 10:45:53 +0200 Message-Id: <20190517084556.12242-1-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH 1/4] boot/optee-os: support external TA SDK X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Etienne Carriere MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" It happens that Buildroot is used to generate the embedded filesystem not not the boot images that which are built from another environment(s). In such case OP-TEE SDK get built outside of Buildroot. This SDK is needed by other OP-TEE packages in Buildroot to generate .ta files. This change introduces BR2_TARGET_OPTEE_OS_SDK_PATH for configuration to provide the path of an external OP-TEE SDK. This configuration is mandated when neither BR2_TARGET_OPTEE_OS_CORE nor BR2_TARGET_OPTEE_OS_SDK are enable while BR2_TARGET_OPTEE_OS=y. When BR2_TARGET_OPTEE_OS_SDK_PATH is defined, the build stage of optee-os copies the SDK file tree into optee-os build tree, for these to be installed during target/staging install. With this change BR2_TARGET_OPTEE_OS_SERVICES no more selects BR2_TARGET_OPTEE_OS_CORE as .ta files can be build from external SDK. Signed-off-by: Etienne Carriere --- boot/optee-os/Config.in | 13 ++++++++++++- boot/optee-os/optee-os.mk | 33 +++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/boot/optee-os/Config.in b/boot/optee-os/Config.in index 4cb05798e5..7efc1f596e 100644 --- a/boot/optee-os/Config.in +++ b/boot/optee-os/Config.in @@ -72,7 +72,6 @@ config BR2_TARGET_OPTEE_OS_SDK config BR2_TARGET_OPTEE_OS_SERVICES bool "Build service TAs and libs" default y - select BR2_TARGET_OPTEE_OS_CORE help This option installs the service trusted applications and trusted shared libraries built from OP-TEE OS source tree. @@ -81,6 +80,18 @@ config BR2_TARGET_OPTEE_OS_SERVICES load these from this non-secure filesystem/directory into the secure world for execution. + +if !BR2_TARGET_OPTEE_OS_CORE && !BR2_TARGET_OPTEE_OS_SDK + +config BR2_TARGET_OPTEE_OS_SDK_PATH + string "External SDK path" + depends on !BR2_TARGET_OPTEE_OS_CORE && !BR2_TARGET_OPTEE_OS_SDK + help + Path of the prebuilt OP-TEE SDK when one build the OP-TEE resources + based on an external TA developement kit. + +endif + config BR2_TARGET_OPTEE_OS_PLATFORM string "Target platform (mandatory)" help diff --git a/boot/optee-os/optee-os.mk b/boot/optee-os/optee-os.mk index bd415512c7..750516ad94 100644 --- a/boot/optee-os/optee-os.mk +++ b/boot/optee-os/optee-os.mk @@ -62,6 +62,8 @@ OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm32 OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32 endif +OPTEE_OS_EXTERNAL_SDK = $(call qstrip,$(BR2_TARGET_OPTEE_OS_SDK_PATH)) + ifeq ($(BR2_TARGET_OPTEE_OS_CORE),y) define OPTEE_OS_BUILD_CORE $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \ @@ -85,17 +87,38 @@ define OPTEE_OS_INSTALL_TARGET_CMDS endef endif # BR2_TARGET_OPTEE_OS_SERVICES +# SDK staging install is common the SDK staging install, used when +# either package builds SDK or package imports an external SDK. +define OPTEE_OS_INSTALL_STAGING_SDK + mkdir -p $(OPTEE_OS_SDK) + cp -ardpf $(@D)/$(OPTEE_OS_LOCAL_SDK)/* $(OPTEE_OS_SDK) +endef + ifeq ($(BR2_TARGET_OPTEE_OS_SDK),y) define OPTEE_OS_BUILD_SDK $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \ $(TARGET_CONFIGURE_OPTS) $(OPTEE_OS_MAKE_OPTS) ta_dev_kit endef define OPTEE_OS_INSTALL_STAGING_CMDS - mkdir -p $(OPTEE_OS_SDK) - cp -ardpf $(@D)/$(OPTEE_OS_LOCAL_SDK)/* $(OPTEE_OS_SDK) + $(OPTEE_OS_INSTALL_STAGING_SDK) endef endif # BR2_TARGET_OPTEE_OS_SDK +ifneq ($(BR2_TARGET_OPTEE_OS_SDK_PATH),) +ifeq (,$(wildcard $(OPTEE_OS_EXTERNAL_SDK))) +$(error Invalid external SDK path $(OPTEE_OS_EXTERNAL_SDK)) +endif +# SDK is not built from sources but imported from an external filetree +# BR2_TARGET_OPTEE_OS_SDK_PATH mandates !BR2_TARGET_OPTEE_OS_SDK +define OPTEE_OS_BUILD_SDK + mkdir -p $(@D)/$(OPTEE_OS_LOCAL_SDK) + cp -ardpf $(OPTEE_OS_EXTERNAL_SDK)/* $(@D)/$(OPTEE_OS_LOCAL_SDK) +endef +define OPTEE_OS_INSTALL_STAGING_CMDS + $(OPTEE_OS_INSTALL_STAGING_SDK) +endef +endif # BR2_TARGET_OPTEE_OS_SDK_PATH + define OPTEE_OS_BUILD_CMDS $(OPTEE_OS_BUILD_CORE) $(OPTEE_OS_BUILD_SDK) @@ -106,10 +129,12 @@ define OPTEE_OS_INSTALL_IMAGES_CMDS $(OPTEE_OS_INSTALL_IMAGES_SERVICES) endef -ifeq ($(BR2_TARGET_OPTEE_OS)$(BR_BUILDING),yy) +ifeq ($(BR_BUILDING),y) +ifneq (,$(filter y,$(BR2_TARGET_OPTEE_OS_CORE) $(BR2_TARGET_OPTEE_OS_SDK))) ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM)),) $(error No OP-TEE OS platform set. Check your BR2_TARGET_OPTEE_OS_PLATFORM setting) endif -endif # BR2_TARGET_OPTEE_OS && BR2_BUILDING +endif # BR2_TARGET_OPTEE_OS_CORE || BR2_TARGET_OPTEE_OS_SDK +endif # BR2_BUILDING $(eval $(generic-package))