From bfc35b773ff405394d066d7d8efb32ced3ac0410 Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Tue, 13 Nov 2018 14:44:21 -0600 Subject: [PATCH] linux-firmware: replace machine override with new recipes Raspberry Pi hardware requires firmware that supersedes or is not present in the standard linux-firmware distribution. These files are maintained in the RPi-Distro project on github. Several attempts have been made to reconcile conflicts between what's in linux-firmware and what the hardware needs. The existing approach is functional but not maintainable since it combines material from three repositories into a single package that claims to be linux-firmware. Remove the appends that change the content of linux-firmware for rpi hardware. Add two new recipes that follow the RPi-Distro repositories: * firmware-nonfree which forked from linux-firmware and replaces content is provided as linux-firmware-rpidistro; * bluez-firmware which forked from (very old) bluez and adds content is provided as bluez-firmware-rpidistro. The packages are named to make clear that these come from RPi-Distro, rather than generic sources. Licensing attempts to record the state of licensing as documented in RPi-Distro. Resolves: #298 Signed-off-by: Peter A. Bigot --- conf/machine/raspberrypi0-wifi.conf | 4 +- conf/machine/raspberrypi3-64.conf | 8 +- conf/machine/raspberrypi3.conf | 8 +- .../bluez-firmware-rpidistro_git.bb | 84 ++++++++++++++++ .../linux-firmware-rpidistro_git.bb | 96 +++++++++++++++++++ .../linux-firmware/linux-firmware_%.bbappend | 69 ------------- 6 files changed, 190 insertions(+), 79 deletions(-) create mode 100644 recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb create mode 100644 recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb delete mode 100644 recipes-kernel/linux-firmware/linux-firmware_%.bbappend diff --git a/conf/machine/raspberrypi0-wifi.conf b/conf/machine/raspberrypi0-wifi.conf index 7d7f1da..2c4f760 100644 --- a/conf/machine/raspberrypi0-wifi.conf +++ b/conf/machine/raspberrypi0-wifi.conf @@ -7,8 +7,8 @@ require conf/machine/include/tune-arm1176jzf-s.inc include conf/machine/include/rpi-base.inc MACHINE_EXTRA_RRECOMMENDS += "\ - linux-firmware-bcm43430 \ - linux-firmware-bcm43430a1-hcd \ + linux-firmware-rpidistro-bcm43430 \ + bluez-firmware-rpidistro-bcm43430a1-hcd \ " SDIMG_KERNELIMAGE ?= "kernel.img" diff --git a/conf/machine/raspberrypi3-64.conf b/conf/machine/raspberrypi3-64.conf index 456373d..635e4f6 100644 --- a/conf/machine/raspberrypi3-64.conf +++ b/conf/machine/raspberrypi3-64.conf @@ -5,10 +5,10 @@ MACHINEOVERRIDES = "raspberrypi3:${MACHINE}" MACHINE_EXTRA_RRECOMMENDS += "\ - linux-firmware-bcm43430 \ - linux-firmware-bcm43455 \ - linux-firmware-bcm43430a1-hcd \ - linux-firmware-bcm4345c0-hcd \ + linux-firmware-rpidistro-bcm43430 \ + linux-firmware-rpidistro-bcm43455 \ + bluez-firmware-rpidistro-bcm43430a1-hcd \ + bluez-firmware-rpidistro-bcm4345c0-hcd \ " require conf/machine/include/arm/arch-armv8.inc diff --git a/conf/machine/raspberrypi3.conf b/conf/machine/raspberrypi3.conf index 4fcff18..df64cbb 100644 --- a/conf/machine/raspberrypi3.conf +++ b/conf/machine/raspberrypi3.conf @@ -7,10 +7,10 @@ require conf/machine/include/tune-cortexa7.inc include conf/machine/include/rpi-base.inc MACHINE_EXTRA_RRECOMMENDS += "\ - linux-firmware-bcm43430 \ - linux-firmware-bcm43455 \ - linux-firmware-bcm43430a1-hcd \ - linux-firmware-bcm4345c0-hcd \ + linux-firmware-rpidistro-bcm43430 \ + linux-firmware-rpidistro-bcm43455 \ + bluez-firmware-rpidistro-bcm43430a1-hcd \ + bluez-firmware-rpidistro-bcm4345c0-hcd \ " SDIMG_KERNELIMAGE ?= "kernel7.img" diff --git a/recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb b/recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb new file mode 100644 index 0000000..b16b2c1 --- /dev/null +++ b/recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb @@ -0,0 +1,84 @@ +SUMMARY = "Linux kernel Bluetooth firmware files from Raspbian distribution" +DESCRIPTION = "Updated Bluetooth firmware files for RaspberryPi hardware. \ +RPi-Distro obtains these directly from Cypress; they are not submitted \ +to linux-firmware for general use." +HOMEPAGE = "https://github.com/RPi-Distro/bluez-firmware" +SECTION = "kernel" + +# Upstream has provided[^1] licensing information in the Debian +# copyright file. The wording of the Cypress license subsequently +# changed in linux-firmware. +# +# Rather than make assumptions about what's supposed to be what, we'll +# use the license implied by the source of these files, named to avoid +# conflicts with linux-firmware. +# +# [^1]: https://github.com/RPi-Distro/bluez-firmware/issues/1 +LICENSE = "Firmware-cypress-rpidistro" +LIC_FILES_CHKSUM = "\ + file://LICENCE.cypress-rpidistro;md5=852f9d10cbedba1f6c439729bd0617b4 \ +" + +# 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-cypress-rpidistro] = "LICENCE.cypress-rpidistro" + +SRC_URI = "git://github.com/RPi-Distro/bluez-firmware" +SRCREV = "ade2bae1aaaebede09abb8fb546f767a0e4c7804" +PV = "0.0+git${SRCPV}" + +S = "${WORKDIR}/git" + +inherit allarch + +CLEANBROKEN = "1" + +do_extract_lic() { + # Extract the license from the Debian copyright file + sed -e '1,23d' ${S}/debian/copyright > ${S}/LICENCE.cypress-rpidistro +} +# Must be before both do_install and do_populate_lic. Putting it before +# their common ancestor works; other approaches do not. +addtask extract_lic after do_unpack before do_patch + +do_compile() { + : +} + +do_install() { + install -d ${D}${nonarch_base_libdir}/firmware/brcm + + cp LICENCE.cypress-rpidistro ${D}${nonarch_base_libdir}/firmware + install -m 0644 broadcom/BCM434*.hcd ${D}${nonarch_base_libdir}/firmware/brcm/ +} + +PACKAGES = "\ + ${PN}-cypress-license \ + ${PN}-bcm43430a1-hcd \ + ${PN}-bcm4345c0-hcd \ +" + +LICENSE_${PN}-bcm43430a1-hcd = "Firmware-cypress-rpidistro" +LICENSE_${PN}-bcm4345c0-hcd = "Firmware-cypress-rpidistro" +LICENSE_${PN}-cypress-license = "Firmware-cypress-rpidistro" + +FILES_${PN}-cypress-license = "\ + ${nonarch_base_libdir}/firmware/LICENCE.cypress-rpidistro \ +" +FILES_${PN}-bcm43430a1-hcd = "\ + ${nonarch_base_libdir}/firmware/brcm/BCM43430A1.hcd \ +" +FILES_${PN}-bcm4345c0-hcd = "\ + ${nonarch_base_libdir}/firmware/brcm/BCM4345C0.hcd \ +" + +RDEPENDS_${PN}-bcm43430a1-hcd += "${PN}-cypress-license" +RDEPENDS_${PN}-bcm4345c0-hcd += "${PN}-cypress-license" +RCONFLICTS_${PN}-bcm43430a1-hcd = "linux-firmware-bcm43430a1-hcd" +RREPLACES_${PN}-bcm43430a1-hcd = "linux-firmware-bcm43430a1-hcd" +RCONFLICTS_${PN}-bcm43435c0-hcd = "linux-firmware-bcm4345c0-hcd" +RREPLACES_${PN}-bcm43435c0-hcd = "linux-firmware-bcm4345c0-hcd" + +# Firmware files are generally not run on the CPU, so they can be +# allarch despite being architecture specific +INSANE_SKIP = "arch" diff --git a/recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb b/recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb new file mode 100644 index 0000000..1f63c32 --- /dev/null +++ b/recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb @@ -0,0 +1,96 @@ +SUMMARY = "Linux kernel firmware files from Raspbian distribution" +DESCRIPTION = "Updated firmware files for RaspberryPi hardware. \ +RPi-Distro obtains these directly from Cypress; they are not submitted \ +to linux-firmware for general use." +HOMEPAGE = "https://github.com/RPi-Distro/firmware-nonfree" +SECTION = "kernel" + +# In maintained upstream linux-firmware: +# * brcmfmac43430-sdio falls under LICENCE.cypress +# * brcmfmac43455-sdio falls under LICENCE.broadcom_bcm43xx +# +# It is likely[^1] that both of these should be under LICENCE.cypress. +# Further, at this time the text of LICENCE.broadcom_bcm43xx is the same +# in linux-firmware and RPi-Distro/firmware-nonfree, but this may +# change. +# +# Rather than make assumptions about what's supposed to be what, we'll +# use the license implied by the source of these files, named to avoid +# conflicts with linux-firmware. +# +# [^1]: https://github.com/RPi-Distro/bluez-firmware/issues/1 +LICENSE = "\ + Firmware-broadcom_bcm43xx-rpidistro \ + & WHENCE \ +" +LIC_FILES_CHKSUM = "\ + file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc \ + file://WHENCE;md5=a9c2c217f513c20e1d16b384b3e2c12d \ +" + +# 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-rpidistro] = "LICENCE.broadcom_bcm43xx" +NO_GENERIC_LICENSE[WHENCE] = "WHENCE" + +SRC_URI = "git://github.com/RPi-Distro/firmware-nonfree" +SRCREV = "b518de45ced519e8f7a499f4778100173402ae43" +PV = "0.0+git${SRCPV}" + +S = "${WORKDIR}/git" + +inherit allarch + +CLEANBROKEN = "1" + +do_compile() { + : +} + +do_install() { + install -d ${D}${nonarch_base_libdir}/firmware/brcm + + cp ./LICENCE.broadcom_bcm43xx ${D}${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx-rpidistro + + # Replace outdated linux-firmware files with updated ones from + # raspbian firmware-nonfree. Raspbian adds blobs and nvram + # definitions that are also necessary so copy those too. + for fw in brcmfmac43430-sdio brcmfmac43455-sdio ; do + install -m 0644 brcm/${fw}.* ${D}${nonarch_base_libdir}/firmware/brcm/ + done +} + +PACKAGES = "\ + ${PN}-broadcom-license \ + ${PN}-bcm43430 \ + ${PN}-bcm43455 \ +" + +LICENSE_${PN}-bcm43430 = "Firmware-broadcom_bcm43xx-rpidistro" +LICENSE_${PN}-bcm43455 = "Firmware-broadcom_bcm43xx-rpidistro" +LICENSE_${PN}-broadcom-license = "Firmware-broadcom_bcm43xx-rpidistro" +FILES_${PN}-broadcom-license = "${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx-rpidistro" +FILES_${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430*" +FILES_${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455*" +RDEPENDS_${PN}-bcm43430 += "${PN}-broadcom-license" +RDEPENDS_${PN}-bcm43455 += "${PN}-broadcom-license" +RCONFLICTS_${PN}-bcm43430 = "\ + linux-firmware-bcm43430 \ + linux-firmware-raspbian-bcm43430 \ +" +RREPLACES_${PN}-bcm43430 = "\ + linux-firmware-bcm43430 \ + linux-firmware-raspbian-bcm43430 \ +" +RCONFLICTS_${PN}-bcm43455 = "\ + linux-firmware-bcm43455 \ + linux-firmware-raspbian-bcm43455 \ +" +RREPLACES_${PN}-bcm43455 = "\ + linux-firmware-bcm43455 \ + linux-firmware-raspbian-bcm43455 \ +" + +# Firmware files are generally not run on the CPU, so they can be +# allarch despite being architecture specific +INSANE_SKIP = "arch" diff --git a/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/recipes-kernel/linux-firmware/linux-firmware_%.bbappend deleted file mode 100644 index 4443736..0000000 --- a/recipes-kernel/linux-firmware/linux-firmware_%.bbappend +++ /dev/null @@ -1,69 +0,0 @@ -# Augments upstream linux-firmware with additional and updated images -# from Raspbian: -# https://github.com/RPi-Distro/firmware-nonfree -# https://github.com/RPi-Distro/bluez-firmware - -SRC_URI_append_rpi = " \ - git://github.com/RPi-Distro/firmware-nonfree;destsuffix=raspbian-nf;name=raspbian-nf \ - git://github.com/RPi-Distro/bluez-firmware;destsuffix=raspbian-bluez;name=raspbian-bluez \ -" - -SRCREV_raspbian-nf = "b518de45ced519e8f7a499f4778100173402ae43" -SRCREV_raspbian-bluez = "ade2bae1aaaebede09abb8fb546f767a0e4c7804" -SRCREV_FORMAT_rpi = "default+raspbian-nf+raspbian-bluez" - -do_install_append_rpi() { - install -d ${D}${nonarch_base_libdir}/firmware/brcm/ - - # Replace outdated linux-firmware files with updated ones from - # raspbian firmware-nonfree. Raspbian adds blobs and nvram - # definitions that are also necessary so copy those too. - for fw in brcmfmac43430-sdio brcmfmac43455-sdio ; do - install -m 0644 ${WORKDIR}/raspbian-nf/brcm/${fw}.* ${D}${nonarch_base_libdir}/firmware/brcm/ - done - - # Add missing Cypress Bluetooth files from raspbian bluez-firmware - for fw in BCM43430A1.hcd BCM4345C0.hcd ; do - install -m 0644 ${WORKDIR}/raspbian-bluez/broadcom/${fw} ${D}${nonarch_base_libdir}/firmware/brcm/ - done -} - -# NB: Must prepend, else these become empty and their content is left in -# the roll-up package which precedes them. -PACKAGES_prepend_rpi = "\ - ${PN}-bcm43430a1-hcd \ - ${PN}-bcm4345c0-hcd \ -" - -# ${PN}-bcm43455 package and brcmfmac43455-sdio from linux-firmware -# is already included in the oe-core recipe, so don't add it to PACKAGES -# again, the version from raspbian-nf seems a bit newer: -# $ strings ./1_0.0+gitAUTOINC+d114732723+86e88fbf03+e28cd7ee86-r0/git/brcm/brcmfmac43455-sdio.bin | grep Ver -# Version: 7.45.18.0 CRC: d7226371 Date: Sun 2015-03-01 07:31:57 PST Ucode Ver: 1026.2 FWID: 01-6a2c8ad4 -# $ strings ./1_0.0+gitAUTOINC+d114732723+86e88fbf03+e28cd7ee86-r0/raspbian-nf/brcm/brcmfmac43455-sdio.bin | grep Ver -# Version: 7.45.154 (r684107 CY) CRC: b1f79383 Date: Tue 2018-02-27 03:18:17 PST Ucode Ver: 1043.2105 FWID 01-4fbe0b04 - -# For additional Broadcom -LICENSE_${PN}-bcm43455 = "Firmware-broadcom_bcm43xx" - -FILES_${PN}-bcm43430_append_rpi = " \ - ${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.txt \ -" -FILES_${PN}-bcm43455 = " \ - ${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.* \ -" - -RDEPENDS_${PN}-bcm43455 += "${PN}-broadcom-license" - -LICENSE_${PN}-bcm43430a1-hcd = "Firmware-cypress" -LICENSE_${PN}-bcm4345c0-hcd = "Firmware-cypress" - -FILES_${PN}-bcm43430a1-hcd = " \ - ${nonarch_base_libdir}/firmware/brcm/BCM43430A1.hcd \ -" -FILES_${PN}-bcm4345c0-hcd = " \ - ${nonarch_base_libdir}/firmware/brcm/BCM4345C0.hcd \ -" - -RDEPENDS_${PN}-bcm43430a1-hcd += "${PN}-cypress-license" -RDEPENDS_${PN}-bcm4345c0-hcd += "${PN}-cypress-license"