Search code examples
linuxembedded-linuxyoctobitbakeopenembedded

Read the final value of the MACHINEOVERRIDES variable


During the porting of the layer for my SoM from the pyro branch to the dunfell one, I've encountered some problems related to the COMPATIBLE_MACHINE list in my recipes (BitBake says that there is no recipe compatible with my machine).

In order to further investigate this issue, I tried to read the actual value of the MACHINEOVERRIDES variable using the bitbake -e command. However, I don't think this list is complete, because watching the bitbake -e output I can see that there are other variable expansions which are used to form the value of the general OVERRIDES variable.

This is the output of the bitbake -e | grep OVERRIDES command run from my build environment:

# $DISTROOVERRIDES [3 operations]
DISTROOVERRIDES="fslc"
# $FILESOVERRIDES [2 operations]
#     "${TRANSLATED_TARGET_ARCH}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}"
#     [doc] "A subset of OVERRIDES used by the OpenEmbedded build system for creating FILESPATH."
#   "${TRANSLATED_TARGET_ARCH}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}"
FILESOVERRIDES="arm:isiot:armv7ve:use-mainline-bsp:isiot-geamx6ul:fslc"
# $MACHINEOVERRIDES [14 operations]
#     "PRISTINE_MACHINEOVERRIDES"
MACHINEOVERRIDES="isiot:armv7ve:use-mainline-bsp:isiot-geamx6ul"
# $MACHINEOVERRIDES_EXTENDER_FILTER_OUT
MACHINEOVERRIDES_EXTENDER_FILTER_OUT="     imx         mx6     mx6q     mx6dl     mx6sx     mx6sl     mx6sll     mx6ul     mx6ull         mx7     mx7d     mx7ulp         mx8     mx8qm     mx8mm     mx8mn     mx8mq     mx8qxp "
# $MACHINEOVERRIDES_EXTENDER_FILTER_OUT_use-mainline-bsp
MACHINEOVERRIDES_EXTENDER_FILTER_OUT_use-mainline-bsp="     imx         mx6     mx6q     mx6dl     mx6sx     mx6sl     mx6sll     mx6ul     mx6ull         mx7     mx7d     mx7ulp         mx8     mx8qm     mx8mm     mx8mn     mx8mq     mx8qxp "
# $MACHINEOVERRIDES_EXTENDER_mx25
MACHINEOVERRIDES_EXTENDER_mx25="use-mainline-bsp"
# $MACHINEOVERRIDES_EXTENDER_mx6dl
MACHINEOVERRIDES_EXTENDER_mx6dl="imxfbdev:imxpxp:imxipu:imxvpu:imxgpu:imxgpu2d:imxgpu3d:imxepdc"
# $MACHINEOVERRIDES_EXTENDER_mx6q
MACHINEOVERRIDES_EXTENDER_mx6q="imxfbdev:imxipu:imxvpu:imxgpu:imxgpu2d:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx6sl
MACHINEOVERRIDES_EXTENDER_mx6sl="imxfbdev:imxpxp:imxgpu:imxgpu2d:imxepdc"
# $MACHINEOVERRIDES_EXTENDER_mx6sll
MACHINEOVERRIDES_EXTENDER_mx6sll="imxfbdev:imxpxp:imxepdc"
# $MACHINEOVERRIDES_EXTENDER_mx6sx
MACHINEOVERRIDES_EXTENDER_mx6sx="imxfbdev:imxpxp:imxgpu:imxgpu2d:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx6ul
MACHINEOVERRIDES_EXTENDER_mx6ul="imxfbdev:imxpxp"
# $MACHINEOVERRIDES_EXTENDER_mx6ull
MACHINEOVERRIDES_EXTENDER_mx6ull="imxfbdev:imxpxp:imxepdc"
# $MACHINEOVERRIDES_EXTENDER_mx7d
MACHINEOVERRIDES_EXTENDER_mx7d="imxfbdev:imxpxp:imxepdc"
# $MACHINEOVERRIDES_EXTENDER_mx7ulp
MACHINEOVERRIDES_EXTENDER_mx7ulp="imxfbdev:imxpxp:imxgpu:imxgpu2d:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx8mm
MACHINEOVERRIDES_EXTENDER_mx8mm="imxdrm:imxvpu:imxgpu:imxgpu2d:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx8mn
MACHINEOVERRIDES_EXTENDER_mx8mn="imxdrm:imxgpu:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx8mq
MACHINEOVERRIDES_EXTENDER_mx8mq="imxdrm:imxvpu:imxgpu:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx8qm
MACHINEOVERRIDES_EXTENDER_mx8qm="imxdrm:imxdpu:imxgpu:imxgpu2d:imxgpu3d"
# $MACHINEOVERRIDES_EXTENDER_mx8qxp
MACHINEOVERRIDES_EXTENDER_mx8qxp="imxdrm:imxdpu:imxgpu:imxgpu2d:imxgpu3d"
# $OVERRIDES [2 operations]
#     "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}${LIBCOVERRIDE}:forcevariable"
#     [doc] "BitBake uses OVERRIDES to control what variables are overridden after BitBake parses recipes and configuration files."
#   "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}${LIBCOVERRIDE}:forcevariable"
OVERRIDES="linux-gnueabi:arm:pn-defaultpkgname:isiot:armv7ve:use-mainline-bsp:isiot-geamx6ul:fslc:class-target:libc-glibc:forcevariable"
# $PRISTINE_MACHINEOVERRIDES [13 operations]
#   rename from MACHINEOVERRIDES machine-overrides-extender.bbclass:49 [machine_overrides_extender_handler]
PRISTINE_MACHINEOVERRIDES="mx6:mx6ul:isiot:armv7ve:imx:use-mainline-bsp:isiot-geamx6ul"
# $SRC_URI_OVERRIDES_PACKAGE_ARCH
    overrides = d.getVar('OVERRIDES').split(':')
        msg = 'Recipe %s has PN of "%s" which is in OVERRIDES, this can result in unexpected behaviour.' % (d.getVar("FILE"), pn)
        compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")
    # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0
    override = d.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH')
    overrides = (":" + (d.getVar("FILESOVERRIDES") or "")).split(":")
        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + multilib
        localdata.setVar("OVERRIDES", overrides)
    overrides = d.getVar("OVERRIDES").split(":")
    machine_overrides = (d.getVar('PRISTINE_MACHINEOVERRIDES') or '').split(':')
        machine_overrides_filter_out += (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT_%s' % override) or '').split()
        extender = d.getVar('MACHINEOVERRIDES_EXTENDER_%s' % override)
    # so we can reprocess OVERRIDES if/as/when needed.
    d.renameVar("MACHINEOVERRIDES", "PRISTINE_MACHINEOVERRIDES")
    d.setVar("MACHINEOVERRIDES", "${@machine_overrides_extender(d)}")
    localdata.setVar('OVERRIDES', pkg)
        localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES') + ':' + pkg)
        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
        localdata.setVar("OVERRIDES", overrides)
        localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)

Is there a way to get the value of MACHINEOVERRIDES and OVERRIDES variables after those operations occur?

    # so we can reprocess OVERRIDES if/as/when needed.
    d.renameVar("MACHINEOVERRIDES", "PRISTINE_MACHINEOVERRIDES")
    d.setVar("MACHINEOVERRIDES", "${@machine_overrides_extender(d)}")
    localdata.setVar('OVERRIDES', pkg)
        localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES') + ':' + pkg)
        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
        localdata.setVar("OVERRIDES", overrides)
        localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg)

Thanks.


Solution

  • bitbake -e already shows you the variables after the operations.

    MACHINEOVERRIDES="isiot:armv7ve:use-mainline-bsp:isiot-geamx6ul" and OVERRIDES="linux-gnueabi:arm:pn-defaultpkgname:isiot:armv7ve:use-mainline-bsp:isiot-geamx6ul:fslc:class-target:libc-glibc:forcevariable"

    bitbake -e first shows you how many operations act on a variable e.g. # $MACHINEOVERRIDES [14 operations] and where they are coming from and after that the expanded value.

    You could use bitbake -e | less to browse the output instead of grepping it.