1SUMMARY = "Linux kernel firmware files from Raspbian distribution"
2DESCRIPTION = "Updated firmware files for RaspberryPi hardware. \
3RPi-Distro obtains these directly from Cypress; they are not submitted \
4to linux-firmware for general use."
5HOMEPAGE = "https://github.com/RPi-Distro/firmware-nonfree"
6SECTION = "kernel"
7
8# In maintained upstream linux-firmware:
9# * brcmfmac43430-sdio falls under LICENCE.cypress
10# * brcmfmac43455-sdio falls under LICENCE.broadcom_bcm43xx
11# * brcmfmac43456-sdio falls under LICENCE.broadcom_bcm43xx
12#
13# It is likely[^1] that both of these should be under LICENCE.cypress.
14# Further, at this time the text of LICENCE.broadcom_bcm43xx is the same
15# in linux-firmware and RPi-Distro/firmware-nonfree, but this may
16# change.
17#
18# Rather than make assumptions about what's supposed to be what, we'll
19# use the license implied by the source of these files, named to avoid
20# conflicts with linux-firmware.
21#
22# [^1]: https://github.com/RPi-Distro/bluez-firmware/issues/1
23LICENSE = "\
24    Firmware-broadcom_bcm43xx-rpidistro \
25    & WHENCE \
26"
27LIC_FILES_CHKSUM = "\
28    file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc \
29    file://WHENCE;md5=7b12b2224438186e4c97c4c7f3a5cc28 \
30"
31
32# These are not common licenses, set NO_GENERIC_LICENSE for them
33# so that the license files will be copied from fetched source
34NO_GENERIC_LICENSE[Firmware-broadcom_bcm43xx-rpidistro] = "LICENCE.broadcom_bcm43xx"
35NO_GENERIC_LICENSE[WHENCE] = "WHENCE"
36
37SRC_URI = "git://github.com/RPi-Distro/firmware-nonfree"
38
39SRCREV = "83938f78ca2d5a0ffe0c223bb96d72ccc7b71ca5"
40PV = "20190114-1+rpt11"
41
42S = "${WORKDIR}/git"
43
44inherit allarch
45
46CLEANBROKEN = "1"
47
48do_compile() {
49    :
50}
51
52do_install() {
53    install -d ${D}${nonarch_base_libdir}/firmware/brcm
54
55    cp ./LICENCE.broadcom_bcm43xx ${D}${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx-rpidistro
56
57    # Replace outdated linux-firmware files with updated ones from
58    # raspbian firmware-nonfree. Raspbian adds blobs and nvram
59    # definitions that are also necessary so copy those too.
60    for fw in brcmfmac43430-sdio brcmfmac43455-sdio brcmfmac43456-sdio ; do
61        install -m 0644 brcm/${fw}.* ${D}${nonarch_base_libdir}/firmware/brcm/
62    done
63    # add compat links. Fixes errors like
64    # brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt failed with error -2
65    ln -s brcmfmac43455-sdio.txt ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
66    ln -s brcmfmac43455-sdio.txt ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
67    ln -s brcmfmac43430-sdio.txt ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
68    ln -s brcmfmac43430-sdio.txt ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt
69}
70
71PACKAGES = "\
72    ${PN}-broadcom-license \
73    ${PN}-bcm43430 \
74    ${PN}-bcm43455 \
75    ${PN}-bcm43456 \
76"
77
78LICENSE:${PN}-bcm43430 = "Firmware-broadcom_bcm43xx-rpidistro"
79LICENSE:${PN}-bcm43455 = "Firmware-broadcom_bcm43xx-rpidistro"
80LICENSE:${PN}-bcm43456 = "Firmware-broadcom_bcm43xx-rpidistro"
81LICENSE:${PN}-broadcom-license = "Firmware-broadcom_bcm43xx-rpidistro"
82FILES:${PN}-broadcom-license = "${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx-rpidistro"
83FILES:${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430*"
84FILES:${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455*"
85FILES:${PN}-bcm43456 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43456*"
86RDEPENDS:${PN}-bcm43430 += "${PN}-broadcom-license"
87RDEPENDS:${PN}-bcm43455 += "${PN}-broadcom-license"
88RDEPENDS:${PN}-bcm43456 += "${PN}-broadcom-license"
89RCONFLICTS:${PN}-bcm43430 = "\
90    linux-firmware-bcm43430 \
91    linux-firmware-raspbian-bcm43430 \
92"
93RREPLACES:${PN}-bcm43430 = "\
94    linux-firmware-bcm43430 \
95    linux-firmware-raspbian-bcm43430 \
96"
97RCONFLICTS:${PN}-bcm43455 = "\
98    linux-firmware-bcm43455 \
99    linux-firmware-raspbian-bcm43455 \
100"
101RREPLACES:${PN}-bcm43455 = "\
102    linux-firmware-bcm43455 \
103    linux-firmware-raspbian-bcm43455 \
104"
105RCONFLICTS:${PN}-bcm43456 = "\
106    linux-firmware-bcm43456 \
107    linux-firmware-raspbian-bcm43456 \
108"
109RREPLACES:${PN}-bcm43456 = "\
110    linux-firmware-bcm43456 \
111    linux-firmware-raspbian-bcm43456 \
112"
113
114# Firmware files are generally not run on the CPU, so they can be
115# allarch despite being architecture specific
116INSANE_SKIP = "arch"
117