aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-bsp/firmware/firmware-qcom-adreno.inc
blob: 2fad318154fac51ef128196c918f57f688c174d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Handle Adreno firmware unpacking in a generic way
# Include the file to be able to dissect the archive.
# If ADRENO_URI is defined, the image will be dissected automatically
# Handle fwpath=... as a path to Adreno firmware inside the archive

ADRENO_URI ??= ""

# Conditionally populate SRC_URI. We have to do it here rather than in python
# script to let base.bbclass to pick up dependencies
SRC_URI += "${@['', '${ADRENO_URI};subdir=adreno;name=adreno'][d.getVar('ADRENO_URI') != ''] }"

# the file is unpacked to this dir, clean it up
do_unpack[cleandirs] = "${WORKDIR}/adreno"

DEPENDS += "pil-squasher-native"

python () {
    uri = d.getVar("ADRENO_URI")
    if uri == "":
        bb.warn("%s: not packaging ADRENO firmware. Please provide ADRENO_URI" % d.getVar("PN"))
    else:
        urldata = bb.fetch2.FetchData(d.getVar("ADRENO_URI"), d)
        if "fwpath" in urldata.parm:
            d.setVar("ADRENO_PATH", urldata.parm["fwpath"])
        else:
            d.setVar("ADRENO_PATH", "")
}

do_compile:append() {
    if [ -n "${ADRENO_URI}" ] ; then
        for fw in ${WORKDIR}/adreno/${ADRENO_PATH}/*_zap.mdt ; do
            pil-squasher ${B}/`basename $fw mdt`mbn $fw || exit 1
        done
        for fw in ${FW_QCOM_LIST} ; do
            if [ -r ${WORKDIR}/adreno/${ADRENO_PATH}/$fw ] ; then
                cp ${WORKDIR}/adreno/${ADRENO_PATH}/$fw ${B}/
            fi
        done
    fi
}