From patchwork Sun Jul 11 16:32:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1503651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ZdZVIEAG; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=BGmtNjcO; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GNC9b5T81z9sRf for ; Mon, 12 Jul 2021 02:32:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=K+fbHD3w7rDOAvpxkDu4szST5fvyldNJfedM2kYGZ7U=; b=ZdZVIEAG1wenwd zivDBTESrHlKd4phWwzsKxvHhs56J8ar2XmL9+igoSGoeHhr+ESo/UbVnuizDTh2p75bZ8MiVlQ8v mOr7lOD2RmUIliKB7lRkLySI+ZcdhhLhL6k2WnAyybrGLoitIrlkBlaZxVo3vuabS5Azt9fBcQdBJ 8ZZ/piVOav4Tv/7wrm7+svnPV/CAmDw2xnbGuIm7kq/tmyRXEwJrQPQ8F/LM2ZOPl9ZtetQ0TqaSC UeQDyvpbZRNw7sOW4mprSlShWG2L5eCZNn3bkM8aL2GCUWcObA/H+q0H3/uZRymtne5JK/QpbuPjz +RAzpuI0Q6ThS0mSGxeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2cNb-005HhV-0c; Sun, 11 Jul 2021 16:32:31 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2cNY-005Hh5-Ge for opensbi@lists.infradead.org; Sun, 11 Jul 2021 16:32:29 +0000 Received: by mail-pg1-x536.google.com with SMTP id 37so15566909pgq.0 for ; Sun, 11 Jul 2021 09:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n8Phc20qgMvFqrVfVHlsGnqnYU7/9tIKrDdSqCtmcQ8=; b=BGmtNjcOxtXILOcVGIgp+Y8rSL6HAfK7EPlw7NAg4jrC28Tixz/ZV1a/6Jm4F8zphu 5wBrq3UofF5HXGqcv0xq7jny5vI0UfV9AmEM8xxQ67S9BJBVoMi5Lt9OQIN0tNowGcYl genKMcIanWdEz6RymAo2B2r0BlESL55Hq+7PMMpTqra5jIDpmnuVIPsE7m0aJJMMqYHT Ca8xl/R0k8SiqAj+ICvN/YKdMq1I5uQuyY0kIgnITaVSc23H8euGn1b2jO4/tCB0Zjak O3S9MzmUKyMluFBvaKVbp5UgFOWCfF929fTA/N/3Ttp9Mv+zYOL6Ebn9kxkWd7nKjY7F 1olg== 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:mime-version :content-transfer-encoding; bh=n8Phc20qgMvFqrVfVHlsGnqnYU7/9tIKrDdSqCtmcQ8=; b=FQDCUNIpwgGdohfjQmxTLJpH0VT+buRbu++dzBFOP6MC/VPdEMy15sefDf28QA9GAo dthwEvexil6XcqFjlni0DBIzRmUWHAwPoL4NLigHN93WKrhZpPiJ4jBnbM+nBraHK5Eb AOK3ZbIIQNjkzfwPVOXNn6/iaakPVvahMP6eFxHP+aJ8KWXpx5RnIVmIj+zGp+WW2rd8 aNbpSLPvJr8TTydXI6hPJD8DMKHTCIUbgcByuO+DMjhOM3/MW/GSTmjqwVOu65yB0ce1 0zOrLY4tdFSPosdUAaLZ14H4uwtoTWivtb5NgAbeLGfrvpB6X2fHOD4ucOVZeL23ycNS 0j7Q== X-Gm-Message-State: AOAM530hjuCZF7/jdJXV2/duiHQyf5p8q5nmSVKv/ax9N4YP2bLHVmmL zhu7Q/+DEH2aJbLT24/70ho= X-Google-Smtp-Source: ABdhPJx1dw8ZNj37n7eI0XN4vNLB6OPCUw8CrK/7ANpVEyqOiv1dX1a2o31vmBiHtW05sw4aiRi1sQ== X-Received: by 2002:aa7:97ab:0:b029:32c:30c0:85e5 with SMTP id d11-20020aa797ab0000b029032c30c085e5mr18387pfq.38.1626021146009; Sun, 11 Jul 2021 09:32:26 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id a6sm10834294pjq.27.2021.07.11.09.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 09:32:25 -0700 (PDT) From: Bin Meng To: Anup Patel , opensbi@lists.infradead.org Cc: Bin Meng Subject: [PATCH] README: Update toolchain information Date: Mon, 12 Jul 2021 00:32:18 +0800 Message-Id: <20210711163218.11422-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210711_093228_601545_879C6E29 X-CRM114-Status: GOOD ( 14.17 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Recent FW_PIC=y changes actually require toolchains with PIE support and it is on by default. Existing doc uses a bare-metal toolchain as examples but it does not support PIE. Replace references of bare-metal toolchain prefix with linux toolchain prefix everywhere in documentation. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:536 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [bmeng.cn[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Recent FW_PIC=y changes actually require toolchains with PIE support and it is on by default. Existing doc uses a bare-metal toolchain as examples but it does not support PIE. Replace references of bare-metal toolchain prefix with linux toolchain prefix everywhere in documentation. Signed-off-by: Bin Meng --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b296f00..b0246fc 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,12 @@ LLVM/Clang toolchain due to LLVM's ability to support multiple backends in the same binary, so is often an easy way to obtain a working cross-compilation toolchain. +Basically, we prefer toolchains with PIE support like *riscv64-linux-gcc* as +it generates Position Independent Executable firmware images that can run at +arbitrary address with appropriate alignment. If a bare-metal toolchain (e.g. +*riscv64-unknown-elf-gcc*) is used, static linked firmware images are generated +instead. + Please note that only a 64-bit version of the toolchain is available in the Bootlin toolchain repository for now. @@ -116,7 +122,7 @@ architecture than RISC-V. For cross-compiling, the environment variable *CROSS_COMPILE* must be defined to specify the name prefix of the RISC-V compiler toolchain executables, e.g. -*riscv64-unknown-elf-* if the gcc executable used is *riscv64-unknown-elf-gcc*. +*riscv64-linux-* if the gcc executable used is *riscv64-linux-gcc*. To build *libsbi.a* simply execute: ``` @@ -192,16 +198,16 @@ Building 32-bit / 64-bit OpenSBI Images --------------------------------------- By default, building OpenSBI generates 32-bit or 64-bit images based on the supplied RISC-V cross-compile toolchain. For example if *CROSS_COMPILE* is set -to *riscv64-unknown-elf-*, 64-bit OpenSBI images will be generated. If building +to *riscv64-linux-*, 64-bit OpenSBI images will be generated. If building 32-bit OpenSBI images, *CROSS_COMPILE* should be set to a toolchain that is -pre-configured to generate 32-bit RISC-V codes, like *riscv32-unknown-elf-*. +pre-configured to generate 32-bit RISC-V codes, like *riscv32-linux-*. However it's possible to explicitly specify the image bits we want to build with a given RISC-V toolchain. This can be done by setting the environment variable *PLATFORM_RISCV_XLEN* to the desired width, for example: ``` -export CROSS_COMPILE=riscv64-unknown-elf- +export CROSS_COMPILE=riscv64-linux- export PLATFORM_RISCV_XLEN=32 ``` @@ -235,7 +241,7 @@ valid triple. These can also be mixed; for example using a GCC cross-compiler but LLVM binutils would be: ``` -make CC=riscv64-unknown-elf-gcc LLVM=1 +make CC=riscv64-linux-gcc LLVM=1 ``` These variables must be passed for all the make invocations described in this