linux-firmware-beaglev-bcm43430: Add recipe

This packages bluetooth/Wifi firmware blobs into a package

Help lld linker
Use -mno-relax to compile the kernel with clang
when using lld for linker ( with LLVM=1 )

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2021-05-14 00:26:11 -07:00
parent c168aab9f1
commit 7828a18b90
4 changed files with 106 additions and 13 deletions

View File

@@ -0,0 +1,51 @@
# Copyright (C) 2021 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "WIFI/BT Binary Blobs"
HOMEPAGE = "https://github.com/esmil/linux/blob/starlight/firmware/brcm"
LICENSE = "\
Firmware-broadcom_bcm43xx \
"
LICENSE_${PN} = "Firmware-broadcom_bcm43xx"
LIC_FILES_CHKSUM = "\
file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc \
"
# These are not common licenses, set NO_GENERIC_LICENSE for them
# so that the license files will be copied from fetched source
NO_GENERIC_LICENSE[Firmware-broadcom_bcm43xx] = "LICENCE.broadcom_bcm43xx"
SRC_URI = "https://github.com/esmil/linux/raw/starlight/firmware/brcm/brcmfmac43430-sdio.bin;name=brcmfmac43430 \
https://github.com/esmil/linux/raw/starlight/firmware/brcm/brcmfmac43430-sdio.clm_blob;name=brcmfmac43430-clm \
https://raw.githubusercontent.com/esmil/linux/starlight/firmware/brcm/nvram_ap6236.txt;name=nvram \
https://raw.githubusercontent.com/esmil/linux/starlight/firmware/brcm/brcmfmac43430-sdio.AP6212.txt;name=AP6212 \
https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/LICENCE.broadcom_bcm43xx;name=license \
"
SRC_URI[brcmfmac43430.sha256sum] = "ffbb2dbf135a4c22fdb00716088c556ff6b43fcff1503a59c3f2097992b18b96"
SRC_URI[brcmfmac43430-clm.sha256sum] = "3ce2e8884dbd37d63ca8bae07bf7ea17c110070f41a87c9832eac57f201e2e5d"
SRC_URI[AP6212.sha256sum] = "fdef0603345dd023ad28c0eff2d5167915c617bee2d6944da9a6da1c4ac87ca5"
SRC_URI[nvram.sha256sum] = "ed5d5509c9eff922dc55ddffa654d6fb54ae3f391ff60dd3c50be5b63bc64152"
SRC_URI[license.sha256sum] = "b16056fc91b82a0e3e8de8f86c2dac98201aa9dc3cbd33e8d38f1b087fcec30d"
S = "${WORKDIR}"
inherit allarch
CLEANBROKEN = "1"
do_configure () {
:
}
do_install () {
for f in brcmfmac43430-sdio.AP6212.txt brcmfmac43430-sdio.bin brcmfmac43430-sdio.clm_blob nvram_ap6236.txt
do
install -Dm 0644 ${S}/$f ${D}${nonarch_base_libdir}/firmware/brcm/$f
done
ln -s brcmfmac43430-sdio.AP6212.txt ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100.txt
}
FILES_${PN} = "${nonarch_base_libdir}/firmware/brcm/"
INSANE_SKIP = "arch"

View File

@@ -8,6 +8,7 @@ KERNEL_VERSION_SANITY_SKIP = "1"
SRCREV = "${AUTOREV}"
BRANCH = "starlight"
SRC_URI = "git://github.com/esmil/linux.git;protocol=git;branch=${BRANCH} \
file://0001-riscv-Use-mno-relax-when-using-lld-linker.patch \
file://extra.cfg \
file://modules.cfg \
"
@@ -17,17 +18,4 @@ LINUX_VERSION_EXTENSION_append = "-starlight"
KBUILD_DEFCONFIG_beaglev-starlight-jh7100 = "starlight_defconfig"
# Install firmwate blobs for wifi/bt
do_install_append() {
for f in brcmfmac43430-sdio.AP6212.txt brcmfmac43430-sdio.bin brcmfmac43430-sdio.clm_blob nvram_ap6236.txt
do
install -Dm 0644 ${S}/firmware/brcm/$f ${D}${nonarch_base_libdir}/firmware/brcm/$f
done
ln -s brcmfmac43430-sdio.AP6212.txt ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100.txt
}
PACKAGES += "linux-firmware-beaglev-bcm43430"
FILES_linux-firmware-beaglev-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/"
COMPATIBLE_MACHINE = "(beaglev-starlight-jh7100)"

View File

@@ -0,0 +1,51 @@
From b49fbbed96b6e5d898377020d6b717a21aad6282 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 14 May 2021 00:23:05 -0700
Subject: [PATCH v2] riscv: Use -mno-relax when using lld linker
lld does not implement the RISCV relaxation optimizations like GNU ld
therefore disable it when building with lld, Also pass it to
assembler when using external GNU assembler ( LLVM_IAS != 1 ), this
ensures that relevant assembler option is also enabled along. if these
options are not used then we see following relocations in objects
0000000000000000 R_RISCV_ALIGN *ABS*+0x0000000000000002
These are then rejected by lld
ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
---
v2: Use CONFIG_LD_IS_LLD instead of LLVM check
arch/riscv/Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 3eb9590a0775..4be020695428 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -38,6 +38,15 @@ else
KBUILD_LDFLAGS += -melf32lriscv
endif
+ifeq ($(CONFIG_LD_IS_LLD),y)
+ KBUILD_CFLAGS += -mno-relax
+ KBUILD_AFLAGS += -mno-relax
+ifneq ($(LLVM_IAS),1)
+ KBUILD_CFLAGS += -Wa,-mno-relax
+ KBUILD_AFLAGS += -Wa,-mno-relax
+endif
+endif
+
# ISA string setting
riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
--
2.31.1

View File

@@ -4,6 +4,9 @@ inherit kernel
require recipes-kernel/linux/linux-yocto.inc
SRC_URI = "git://github.com/starfive-tech/linux.git;protocol=git;branch=esmil_starlight \
file://0001-riscv-Use-mno-relax-when-using-lld-linker.patch \
file://extra.cfg \
file://modules.cfg \
"
LINUX_VERSION ?= "5.12.3"