u-boot-nezha: Switch u-boot-spl to mainline format

This commit is contained in:
Andreas Cord-Landwehr
2022-12-20 11:56:53 +01:00
committed by Khem Raj
parent 39f1c2e9d0
commit 7b708ba969
3 changed files with 16 additions and 83 deletions

View File

@@ -1,28 +1,32 @@
require recipes-bsp/u-boot/u-boot-common.inc
require recipes-bsp/u-boot/u-boot.inc
LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI = " \
git://github.com/tekkamanninja/u-boot.git;protocol=https;branch=allwinner_d1 \
file://0001-sun20i-set-CONFIG_SYS_BOOTM_LEN.patch \
file://0001-riscv-fix-build-with-binutils-2.38.patch \
git://github.com/smaeul/u-boot.git;protocol=https;branch=d1-wip \
file://tftp-mmc-boot.txt \
file://uEnv-nezha.txt \
file://toc.cfg \
file://0001-sun20i-set-CONFIG_SYS_BOOTM_LEN.patch \
"
SRCREV = "6db9960b2443ef84b88a573cb5817f8e0ef3712e"
SRCREV = "528ae9bc6c55edd3ffe642734b4132a8246ea777"
DEPENDS:append = " u-boot-tools-native python3-setuptools-native"
DEPENDS:append = " \
u-boot-tools-native \
python3-setuptools-native \
"
UBOOT_MACHINE = "nezha_defconfig"
# Overwrite this for your server
TFTP_SERVER_IP ?= "127.0.0.1"
do_make_toc1_image[depends] = "opensbi:do_deploy"
do_compile[depends] = "opensbi:do_deploy"
do_configure:prepend() {
sed -i -e 's,@SERVERIP@,${TFTP_SERVER_IP},g' ${WORKDIR}/tftp-mmc-boot.txt
@@ -30,17 +34,13 @@ do_configure:prepend() {
-d ${WORKDIR}/tftp-mmc-boot.txt ${WORKDIR}/${UBOOT_ENV_BINARY}
}
# boot0 expects to load a TOC1 image containing OpenSBI and U-Boot
# (and a DTB). This is similar to, but incompatible with, mainline U-Boot
# SPL, which expects a FIT image.
do_make_toc1_image() {
cd ${B}
cp ${DEPLOY_DIR_IMAGE}/fw_dynamic.bin ${B}
${B}/tools/mkimage -T sunxi_toc1 -d ${WORKDIR}/toc.cfg ${B}/u-boot.toc1
do_compile:prepend() {
cp ${DEPLOY_DIR_IMAGE}/fw_dynamic.bin ${B}/fw_dynamic.bin
export OPENSBI=${B}/fw_dynamic.bin
}
do_deploy:append() {
install -m 644 ${B}/u-boot.toc1 ${DEPLOYDIR}
install -m 644 ${B}/u-boot-sunxi-with-spl.bin ${DEPLOYDIR}
install -m 644 ${WORKDIR}/uEnv-nezha.txt ${DEPLOYDIR}/uEnv.txt
}
@@ -48,4 +48,3 @@ COMPATIBLE_MACHINE = "(nezha-allwinner-d1)"
TOOLCHAIN = "gcc"
addtask do_make_toc1_image before do_deploy after do_compile

View File

@@ -1,57 +0,0 @@
From eb6f18cc6ee4a3902c373c4bb505c7fcc3450615 Mon Sep 17 00:00:00 2001
From: Cezary Sobczak <cezary.sobczak@3mdeb.com>
Date: Thu, 24 Mar 2022 00:23:14 +0100
Subject: [PATCH] riscv: fix build with binutils 2.38
Original patch:
https://lore.kernel.org/all/YhCvlHomlT2js3uO@ubuntu01/T/
From version 2.38, binutils default to ISA spec version 20191213. This
means that the csr read/write (csrr*/csrw*) instructions and fence.i
instruction has separated from the `I` extension, become two standalone
extensions: Zicsr and Zifencei.
The fix is to specify those extensions explicitely in -march. However as
older binutils version do not support this, we first need to detect
that.
Fixes:
| cache.c: Assembler messages:
| cache.c:12: Error: unrecognized opcode `fence.i'
| arch/riscv/cpu/mtrap.S: Assembler messages:
| arch/riscv/cpu/mtrap.S:65: Error: unrecognized opcode `csrr a0,scause'
| arch/riscv/cpu/mtrap.S:66: Error: unrecognized opcode `csrr a1,sepc'
| arch/riscv/cpu/mtrap.S:67: Error: unrecognized opcode `csrr a2,stval'
| arch/riscv/cpu/mtrap.S:70: Error: unrecognized opcode `csrw sepc,a0'
Signed-off-by: Cezary Sobczak <cezary.sobczak@3mdeb.com>
---
arch/riscv/Makefile | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 0b80eb8d8645..6b3dc6e514d8 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -24,8 +24,16 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
CMODEL = medany
endif
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
- -mcmodel=$(CMODEL)
+RISCV_MARCH = $(ARCH_BASE)$(ARCH_A)$(ARCH_C)
+
+# Newer binutils versions default to ISA spec version 20191213 which moves some
+# instructions from the I extension to the Zicsr and Zifencei extensions.
+toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei)
+ifeq ($(toolchain-need-zicsr-zifencei),y)
+ RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei
+endif
+
+ARCH_FLAGS = -march=$(RISCV_MARCH) -mabi=$(ABI) -mcmodel=$(CMODEL)
PLATFORM_CPPFLAGS += $(ARCH_FLAGS)
CFLAGS_EFI += $(ARCH_FLAGS)
--
2.25.1

View File

@@ -1,9 +0,0 @@
[opensbi]
file = fw_dynamic.bin
addr = 0x40000000
[dtb]
file = u-boot.dtb
addr = 0x44000000
[u-boot]
file = u-boot.bin
addr = 0x4a000000