From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web09.5313.1606968165915697120 for ; Wed, 02 Dec 2020 20:02:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=u6pXbSC/; spf=fail (domain: os.amperecomputing.com, ip: , mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WeIHloFDl441dZYi8N3Y5m6sjIoHp8Yh5xZimzwAlhaCKrZ6sXBOGG+OkgSOqrbTtlsQmyPkpoFMlj1Jfd5PPT/xSl0mT5LquCYrrpoG3uQRy952a4K+J26FIjBCKjmVzLhVBvKvPJ73QzdrAfJjJ5qha2PDbPDoxs3xg0imKcQ0hiAFB/bfRcaMjtR08lAneRXuIrralvQiHoURsSstO7Sb7nQBjVownvZXP53Bf6FRvhJT8k+GG3wQcw5gnha3wdDkSGJ3PWcy9X+Pdn6jXGTnUdCyzxwuhPuOpPyEo/LUKi0SRCxMdAtg4lGOeIGLqeu06n45rKOWwBkVsoKmXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WtrIOqxfOudhneGI6uFIrXSwqMgBHXEfFzQ3tDc/3/E=; b=DE1W67BQs7qe7Sm4bHXg4AaTJ7TBWu9wgKsuubpSsOxhYXR/GNLDBwEu6r4JHMNtf5BM+1odNsw7q/VUfbvElcSdoaa6tJZtYyRrvWwf/mQr2oNyFmSx938j9x2qQMmkinHb96z6dwZjHE/RUh+t5MJSjKmjOyYvSz74c+hwhm1A24b0aT06nQrvaIo+3Wkklgc+YtQG8God7YTYzOEpUTe/b3pP1fcirjZ0rFiuvHUlKw/cP1Wj7sqjjkI7fypj4zgS3Pv4LlDF+dFvnP5XIi2YLP4/2abg6UtEb0eylcQkp8QNGopNC9IgJe9pCCsF4rV/uV3LqbKq+oJ5v7TV3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WtrIOqxfOudhneGI6uFIrXSwqMgBHXEfFzQ3tDc/3/E=; b=u6pXbSC/Z+QzHWRJOsnXEWMeehlLef2Yc4He9Bl+MevMoMBE1PAFpGYRayTRSFh7+td8nEV5bU70iCaobB6HIoLA8Vz9mqLYF9+1hVZqXRVRoTlY3mCUhMX1bExLZPqNNOBVRpUyLlzN07CH3ZIWc2B522P7geHoZLakhtyqAy8= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2540.prod.exchangelabs.com (2603:10b6:3:3b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Thu, 3 Dec 2020 04:02:45 +0000 Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::c814:9a08:5c2e:4076]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::c814:9a08:5c2e:4076%5]) with mapi id 15.20.3611.034; Thu, 3 Dec 2020 04:02:45 +0000 From: "Nhi Pham" To: devel@edk2.groups.io Cc: patches@amperecomputing.com, Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-platforms][PATCH 1/3] Platform/Ampere: Add Readme.md Date: Thu, 3 Dec 2020 11:04:00 +0700 Message-Id: <20201203040402.1361-2-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201203040402.1361-1-nhi@os.amperecomputing.com> References: <20201203040402.1361-1-nhi@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR0302CA0007.apcprd03.prod.outlook.com (2603:1096:202::17) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0007.apcprd03.prod.outlook.com (2603:1096:202::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.8 via Frontend Transport; Thu, 3 Dec 2020 04:02:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: beacf99f-5165-4d7c-ba28-08d897404a14 X-MS-TrafficTypeDiagnostic: DM5PR01MB2540: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NvPdWvhIvbXWfv2rLIMtqWhnDjqzMSxik2DmvKQl9gxoBk1u+tbgN6HF4mpSbw1okUc792noSQrS3lf9c/tA0n4ZmR3CanIEKNqTfs5LaOdJQNrMsJb5jw9JwUmmT2NsTdEDCVjXyXJ7rQChDSXR6eLhZGexSaJqAGTXN5Zkgl9Yipp/BcIjkMc5gRRwQ4gSgIu0CET9Ivy4HpdTFAs/urkrqqK4vHdSnc/8CuCzA/nY795tMbCXXDrhO2jrqQD0yxaRRghL+qRbe6E7yzJpGJWq84yM7ygVlCYS9xdXCqqC3ABejD/kqhMILAW42x0X8bqdj6jFhIXUarC+uKKcHIwt+30/thxv88sGeMpapDk803sH3OkPoRJWVou+qd6R2XaxarzCsvzNtHneCy/3Vw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR01MB5849.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(366004)(136003)(39850400004)(346002)(396003)(66556008)(5660300002)(66476007)(54906003)(316002)(6506007)(86362001)(66946007)(186003)(956004)(6666004)(2616005)(26005)(2906002)(4326008)(83380400001)(8936002)(6916009)(6512007)(1076003)(16526019)(478600001)(52116002)(8676002)(966005)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?guCFNFkNc49AyuI124zJJdI8nERiHqUAkgvM/KDe9alVOMA/yCXCOTv25ufW?= =?us-ascii?Q?DbEKTgIC6x/3/icom7TQx3x4zIek2hkHYYGF0Fls5HyGcVTCHcRwJz0Tt2Sg?= =?us-ascii?Q?1Y3AK76gM4T8HtSgifGjZCOJVfQb3Cn0UQR8JtLmT+I1Ku3eIxDE+CCf3Ir2?= =?us-ascii?Q?AZsJmX1fNAsDcwIVVC9qzpV9JqrfCTYKXfHbW0ZcuxDqQwkWMOQyT9R/Ysdl?= =?us-ascii?Q?AlUmYVXuzmHZ415Tli+9KWTrzaStv4PWeo20A1Xtye9JGBbxtcFvLHbGrhLx?= =?us-ascii?Q?HrLJLb/YTxCYwCd5ngj7LOMdrKZDz59RAQgXaW9d3YBcmuRnlrtMNHWa9teT?= =?us-ascii?Q?My0+DTDWVtwsE6Wv+vKf81u7VifSAtYnjrR0usyMWScHGV3PbIbg3TRLelAa?= =?us-ascii?Q?t6aBdHIKjOLcWd99Rq55yc/m5ymbTKntWF6b4lJMQB9meLFXlyJSHSFJvMfn?= =?us-ascii?Q?YB7dyBLixGsqh9EwKX19G/PuLJd5HaqZOweNYJSOLD7Qd5lr/5Aq53ZoB2+P?= =?us-ascii?Q?t3O1dzxe1kmlm12QCjbf2SsSqlTKt0Eu8g6DXyRS9HFFTSI6xTY+lujCEQDw?= =?us-ascii?Q?GVmDnXpXHGIFhAVYWxCVWE2N54FDOfg/hNqWRw8nlygHz7X9pKVlBSoClEyp?= =?us-ascii?Q?mc/Zpty5VV6rsBMiXX9o2m79c0KyQWlv789W7WjwhvG8bRvLF0xuUuv1nyDH?= =?us-ascii?Q?/V5bVnUVGPPSJPVHnxJC+pJKjlab6Qmb2ybHlHElxDMIr2EGyG1FFhXOvfp4?= =?us-ascii?Q?iqEZdioUN2nI/A/nBNSzlLqH1VGEdExSlw1NmEqiDECetQsLvZpuV+TzUyMA?= =?us-ascii?Q?D5b6bUPnvbKOO0ozEkVm2IFp7GyC+1khu8NFblTDnQV5jtTmJYeP9DNfMoyz?= =?us-ascii?Q?w/mJdKysw/XirmJp+wH66VvABTVt2ZJlBvXOqUiozuzYnD90mpYONXszB080?= =?us-ascii?Q?jz7sU1yrujvQta9LGSmvG8+BSwrUymdGe+M7X5wa/AqI7qQzitdb6yfGUdhA?= =?us-ascii?Q?3Tfs?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: beacf99f-5165-4d7c-ba28-08d897404a14 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2020 04:02:45.2986 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UntUqrJOIbpohJRODz86bJ63oDpxQDGVSebv+pGMbxmnCgCJdl/Z6GNxsuTUSz3JVpsy5BzTq0Vnk93vvfYBKDBNhUtsHgPeg3W/2eQoZN4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2540 Content-Type: text/plain From: Phong Vo Add initial version of Readme.md for Ampere platform Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Phong Vo --- Platform/Ampere/Readme.md | 167 ++++++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/Platform/Ampere/Readme.md b/Platform/Ampere/Readme.md new file mode 100644 index 000000000000..c93b35a62e84 --- /dev/null +++ b/Platform/Ampere/Readme.md @@ -0,0 +1,167 @@ +# Overview + +This document provides the guideline to build UEFI firmware for Ampere Computing's arm64 reference platforms. + +Platform code is located under Platform/Ampere/{Platform Name}Pkg. + +Silicon code is located under Silicon/Ampere/Ampere{SoC Name}Pkg. + +# How to build (Linux Environment) + +## Build machines + +The build instructions provided in this document are supported on the following operating systems: + +- Ubuntu 18.04 (x86) +- CentOS 8.2 (x86) + +However, it does not mean this guideline is not applicable for other Ubuntu/CentOS versions, +or other Linux distributions. You may, at your own risk, try it on other Linux distributions +if all steps below are performed correctly. + +## Essential development tools + +The following is the list of tools needed for development: `bison, build-essential, bzip2, default-jre, flex +gawk, gpg, libc6:i386, libgcc1:i386, openssl, libssl-dev, m4, make, python, python3-distutils, tar, uuid-dev wget` + +They can be installed using standard OS distro's `apt-get` (for Ubuntu) or `yum` (for CentOS). + +## Toolchain + +### GCC for aarch64 + +Ampere provides GCC toolchains +[aarch64-ampere-linux-gnu](https://cdn.amperecomputing.com/tools/compilers/cross/8.3.0/ampere-8.3.0-20191025-dynamic-nosysroot-crosstools.tar.xz) + +Linaro provides GCC toolchains for +[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/) + +Throughout this document, Ampere toolchain is assumed to be installed at location /opt/toolchain/. + +When cross compiling, it is necessary to provide the appropriate compilation prefix depending on +whether Ampere toolchain or Linaro toolchain is used. + +Target architecture | Cross compilation prefix +--------------------|------------------------- +AARCH64 | aarch64-linux-gnu- (Linaro toolchain) +AARCH64 | aarch64-ampere-linux-gnu- (Ampere toolchain) + +### Intel ASL+ Optimizing Compiler/Disassembler + +Download and install the ISAL compiler as follows: + +```bash +$ wget https://acpica.org/sites/acpica/files/acpica-unix2-20200110.tar.gz +$ tar xzf acpica-unix2-20200110.tar.gz +$ cd acpica-unix2-20200110 +$ make && sudo make install +$ iasl -v +``` + +## Obtaining source code + +1. Create a new folder (directory) on your local development machine +for use as your workspace. This example uses `/work/git/tianocore`, modify as +appropriate for your needs. + + ```bash + $ export WORKSPACE=/work/git/tianocore + $ mkdir -p $WORKSPACE + $ cd $WORKSPACE + ``` + +2. Into that folder, clone: + + ```bash + $ git clone --recurse-submodules https://github.com/AmpereComputing/edk2.git + $ git clone --recurse-submodules https://github.com/AmpereComputing/edk2-platforms.git + ``` + +Set up a PACKAGES_PATH to point to the locations of these three repositories: +`$ export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms` + +## Manual building + +### Additional environment setup + +```bash +$ export CROSS_COMPILER_PATH=/opt/toolchain/ampere-8.3.0-20191025-dynamic-nosysroot/bin +$ export PATH=${CROSS_COMPILER_PATH}:${PATH} +$ export CROSS_COMPILE=aarch64-ampere-linux-gnu- +$ export GCC5_AARCH64_PREFIX=${CROSS_COMPILE} +``` + +1. Set up the build environment (this will modify your environment variables) + + `$ . edk2/edksetup.sh` + + (This step _depends_ on **WORKSPACE** being set as per above.) + +2. Build BaseTools + + `make -C edk2/BaseTools` + + (BaseTools can currently not be built in parallel, so do not specify any `-j` + option, either on the command line or in a **MAKEFLAGS** environment + variable.) + +### Build options + +There are a number of options that can (or must) be specified at the point of +building. Their default values are set in `edk2/Conf/target.txt`. If we are +working only on a single platform, it makes sense to just update this file. + +target.txt option | command line | Description +------------------|--------------|------------ +ACTIVE_PLATFORM | `-p` | Description file (.dsc) of platform +TARGET | `-b` | One of DEBUG, RELEASE or NOOPT. +TARGET_ARCH | `-a` | Architecture to build for. In our case, use AARCH64. +TOOL_CHAIN_TAG | `-t` | Toolchain profile to use for building. In our case, use GCC5. + +There is also MAX_CONCURRENT_THREAD_NUMBER (`-n`), roughly equivalent to +`make -j`. + +When specified on command line, `-b` can be repeated multiple times in order to +build multiple targets sequentially. + +After a successful build, the resulting images can be found in +`Build/{Platform Name}/{TARGET}_{TOOL_CHAIN_TAG}/FV`. + +For example, +`Build/Jade/RELEASE_GCC5/FV` + +### Build a platform + +The main build process _can_ run in parallel - so figure out how many threads we +have available. + +```bash +$ getconf _NPROCESSORS_ONLN +8 +``` + +Set up the build to use a little more than that: + +```bash +$ NUM_CPUS=$((`getconf _NPROCESSORS_ONLN` + 2)) +``` + +Now build the UEFI image: + +```bash +$ cd edk2-platforms && build -a AARCH64 -t GCC5 -b RELEASE -D SECURE_BOOT_ENABLE -p Platform/Ampere/JadePkg/Jade.dsc +``` + +(Note that the description file gets resolved by the build command through +searching in all locations specified in **PACKAGES_PATH**.) + +## Additional build tools + +Ampere provides additional tools and documentation for automating the manual process described above, +and for building a final Tianocore UEFI image that can be flashed on the target system. + +To use these tools, clone the following to the **WORKSPACE** location: + +```bash +$ git clone https://github.com/AmpereComputing/edk2-ampere-tools.git +``` -- 2.17.1