From patchwork Wed Feb 10 17:54:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1439173 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=dzmjVcRm; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DbS885zdgz9sS8 for ; Thu, 11 Feb 2021 04:54:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C73882A35; Wed, 10 Feb 2021 18:54:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="dzmjVcRm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 343A582B78; Wed, 10 Feb 2021 18:54:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3DD4382B6F for ; Wed, 10 Feb 2021 18:54:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612979675; bh=MmM9RxSg/jIfeLjNp7Jsa+Xaqj6a0SjmsIc0pFgX294=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=dzmjVcRmXXdo2iL3D8QWrMv/yZKsq+i5WJlMJ9B2QRj64k2BPt1+i3oF6nMeOZqGD 987nREOBxJU9o8LtaPbmERdLkIip9AImnvC1wKJlMiUeFgsDLELlZ2VxtCwZQYNmIv Dkds0bH8tZNo7Z2SVxLFjW4rUpu82xFbi6+Gn/UY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([62.143.246.89]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1M9Wys-1lDAwp2Jmu-005ZGo; Wed, 10 Feb 2021 18:54:35 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: Bin Meng , Tom Rini , =?utf-8?q?Pali_Roh=C3=A1r?= , Chee Hong Ang , u-boot@lists.denx.de, AKASHI Takahiro , Heinrich Schuchardt Subject: [PATCH v2 1/1] sandbox: allow cross-compiling sandbox Date: Wed, 10 Feb 2021 18:54:25 +0100 Message-Id: <20210210175425.264251-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:C/0B6AoWg6jDoizZIhI2g5GR10V9t0kPcYbGQl3sFxZogcwW1ln 51NECapwfzxJc1ZPIBAiaTXEapIgT9my5NkNNFMD0YEqZlcyQhya23q75FhimBxHTG6d9A9 V2B9i1BgQEF3U9T1ySuBk0ha2qCnT82hGnZWDM5VcDd9shKol1DBtTjUWD96XdxiIzUPRZV /19pqYgDsWq2KSrR3UaTg== X-UI-Out-Filterresults: notjunk:1;V03:K0:nunopI+LcJM=:IQguBpalVFngtyQ+kJyEHm y13UYYFt3PgP/gjHsbvRNDGToH3peT74zsw+BIOyHOaNOu/x22rJ4dodiplbt7kWvL/4ebOUa EHp/Kf3o7dMNCA4bh6S2qUe9RmcEmfC57iefWMy0yilObsE6qLZDQXyhRdM6TD+/iqEV3KKR3 3ZGIsXosqeiy+cQqwz/3KHE4dgzx8vK/bB/JCerQCZ4ANziKBNKMhOKX3VNGh/VSZXe5avRgV jXMWqp8np4ppk0y8PPE9IxygNY2+Kf3LCkEFFr0kUN2Qi1dy2DodPT7omF2PMKqE0xapAyLys l6vqMbGMWdITU66KLRuzbyV6zD7udRTsautuf2W7dlAuWDAqPV1lE9cas1yN/VuPk6Peg/txA ern/2Cq2avrUb4VnMnKxaUkNr7iYJX+PprNP7N5OQVC3nVFQbxRZgDpUQ2v781Vk04HzO/BzS yBcbas+dv28CJitla9X2gHacXTiScUfSpPq3cyK/cxrh09sk+/32zeTaTA4/pA3gbjZbkiO+h 8LQAy6TTijCqJ7WPtMtM3LkDlTO0K9vPYQIQEXGFoHKsErtRs+vJwGsAniY2A+J+v10/FByFd sDGJkfePWBWpx4yshOvziYOj0bJ30DUIa+Jg50wovPKYozaG66puY+XROrCa3iFqOE0B0aCw1 cCEAOL01YgiAog5Kcebrhp45BuTExdcR4jEV6QRHWT3DhZr2fA9iE+1IhFcyeXahXHujmDFyI YUDv+l5/t/AlENYirBf0RluATwHChiqg4k3vgEqMGdUvVZOzEZYsgOjUtdA04Z7I/6OLa3W4u DtI6SIPs7ivlOGYyCIQQVY9ChlOqZo/xshslozp8PEtD5vKjHXJLwRS2CHX081EWU5IE7kQ89 cNitPWDc6wltqkWtKrYA== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean UEFI test files like helloworld.efi require an architecture specific PE-COFF header. Currently this does not work for cross compiling. If $CROSS_COMPILE is set, use the first part of the architecture triplet from the variable to choose the PE-COFF header. Now we can cross-compile the sandbox, e.g. make sandbox_defconfig NO_SDL=1 CROSS_COMPILE=/opt/bin/aarch64-linux-gnu- NO_SDL=1 MK_ARCH=aarch64 make Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- v2: use $CROSS_COMPILE instead of an extra environment variable --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.30.0 diff --git a/Makefile b/Makefile index ebbedb1fb1..6c256a23b6 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,13 @@ NAME = # o Look for make include files relative to root of kernel src MAKEFLAGS += -rR --include-dir=$(CURDIR) -# Determine host architecture +# Determine target architecture for the sandbox include include/host_arch.h -MK_ARCH="${shell uname -m}" +ifeq ("", "$(CROSS_COMPILE)") + MK_ARCH="${shell uname -m}" +else + MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^\s*\([^\/]*\/\)*\([^-]*\)-\S*/\2/p'}" +endif unexport HOST_ARCH ifeq ("x86_64", $(MK_ARCH)) export HOST_ARCH=$(HOST_ARCH_X86_64) @@ -27,7 +31,7 @@ else ifneq (,$(findstring $(MK_ARCH), "i386" "i486" "i586" "i686")) export HOST_ARCH=$(HOST_ARCH_X86) else ifneq (,$(findstring $(MK_ARCH), "aarch64" "armv8l")) export HOST_ARCH=$(HOST_ARCH_AARCH64) -else ifeq ("armv7l", $(MK_ARCH)) +else ifneq (,$(findstring $(MK_ARCH), "arm" "armv7" "armv7l")) export HOST_ARCH=$(HOST_ARCH_ARM) else ifeq ("riscv32", $(MK_ARCH)) export HOST_ARCH=$(HOST_ARCH_RISCV32)