From patchwork Thu Nov 30 01:25:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 842838 X-Patchwork-Delegate: trini@ti.com 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ynKhb39WXz9ryk for ; Thu, 30 Nov 2017 12:34:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1D5D5C21E8E; Thu, 30 Nov 2017 01:31:59 +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_DNSWL_BLOCKED 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 5EF5DC21E85; Thu, 30 Nov 2017 01:26:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D6EECC21ECC; Thu, 30 Nov 2017 01:26:16 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by lists.denx.de (Postfix) with ESMTP id E060DC21E18 for ; Thu, 30 Nov 2017 01:26:11 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4C8041596; Wed, 29 Nov 2017 17:26:11 -0800 (PST) Received: from slackpad.lan (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F9563F236; Wed, 29 Nov 2017 17:26:09 -0800 (PST) From: Andre Przywara To: Simon Glass , Tom Rini , Minkyu Kang Date: Thu, 30 Nov 2017 01:25:11 +0000 Message-Id: <20171130012511.16333-14-andre.przywara@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171130012511.16333-1-andre.przywara@arm.com> References: <20171130012511.16333-1-andre.przywara@arm.com> Cc: u-boot@lists.denx.de, rafaello7 , Metro Subject: [U-Boot] [RFC PATCH 13/13] arm: nexell: switch to 32-bit 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" The vendor provided SPL blob (called "secondboot") runs completely in AArch32, so expects U-Boot to be AArch32 as well. Also the lack of a working arch timer limits Linux to 32-bits, as the mainline arm64 kernel heavily relies on the arch timer. This commit switches the NanoPiM3 board over to generate an ARM(32) binary, to allow easy testing for now. Also this adds a README file to describe the generation of a bootable SD card image. Signed-off-by: Andre Przywara Reviewed-by: Simon Glass --- arch/arm/Kconfig | 2 +- arch/arm/mach-nexell/README | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-nexell/README diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5c52344ca6..3b72528019 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -654,7 +654,7 @@ config ARCH_MX5 config ARCH_NEXELL bool "Nexell S5P support" - select ARM64 + select CPU_V7 select ENABLE_ARM_SOC_BOOT0_HOOK select OF_CONTROL select DM diff --git a/arch/arm/mach-nexell/README b/arch/arm/mach-nexell/README new file mode 100644 index 0000000000..52bdb19b6b --- /dev/null +++ b/arch/arm/mach-nexell/README @@ -0,0 +1,49 @@ +Booting +------- + +U-Boot can be build as either a 32-bit binary (capable of loading 32-bit +ARM OS kernels) or as a 64-bit binary, to launch 64-bit AArch64 kernels. +The only difference in U-Boot is the selection of either CONFIG_ARM64 +or CONFIG_CPU_V7 in the ARCH_NEXELL Kconfig stanza in arch/arm/Kconfig. + +At the moment the U-Boot port does not support an SPL, so we need to rely +on external loaders to initialize the DRAM and load U-Boot proper. + +Quick start +----------- + +Download a GPLed version of the boot loader and compile it: +$ git clone https://github.com/rafaello7/bl1-nanopi-m3.git +$ cd bl1-nanopi-m3 +(edit config.mak to set OPMODE to "aarch32") +$ make +Make sure you have a 32-bit ARM (cross-)compiler installed, change the +triplet name in config.mak if necessary. + +Then copy the resulting binary to an SD card, starting at the second sector: +$ sudo dd if=out/bl1-nanopi.bin of=/dev/sdX bs=512 seek=1 + +Now configure and build U-Boot, then copy the binary to sector 64: +$ make nanopi_m3_defconfig +$ make +$ sudo dd if=u-boot.bin of=/dev/sdX bs=512 seek=64 + +This will build a 32-bit AArch64 version of both the bootloader and U-Boot. + +To load 64-bit kernels, change config.mak in the bl1-nanopi-m3 repository +to set the variable OPMODE back to "aarch64", then re-compile with an Aarch64 +cross compiler. To build a 64-bit version of U-Boot, revert the patch that +switches the Nexell port to 32-bit. That selects CONFIG_ARM64 instead +of CONFIG_CPU_V7. Then rebuild as "dd" to the SD card as described above. + +"secondboot" +------------ +There is an official, but proprietary loader ("secondboot"), provided by +Nexell. It can be found in "official" images, starting from sector 2 +(behind the MBR) and ranging until at most 32KB, though most versions seem +to be shorter. This loader only supports 32-bit payloads. Also the boot +protocol differs slightly, as the NSIH header (the first 512 byte of the +U-Boot image) is cut off and the actual payload is loaded to the load address. +This breaks U-Boot's assumption about its start address and will fail to boot. +Interested people might add 512 to the the launch and load address in boot0.h +to be able to use that boot loader.