Bitbake-env utility

From Crashcourse Wiki

(Redirected from OE bitbake-env utility)
Jump to: navigation, search

Chris Larson has graciously cobbled together a terrifically useful utility called bitbake-env, which you can get here:

$ git clone git://gist.github.com/4133101.git

and whose home page is here.

The purpose is to be able to selectively print variables (and other neat stuff) from your BitBake environment, which I plan on using in my OE/Yocto classes. Install the utility anywhere and add its location to your search path, then:

$ bitbake-env -h

Usage: bitbake-env [options] [variable...]

If no variables are specified, all are shown.

Options:
  -h, --help            show this help message and exit
  -r RECIPE, --recipe=RECIPE
                        operate against this recipe
  -f, --flags           also show variable flags
  -d, --dependencies    also show function dependencies
$

Some sample usage from my qemuarm configuration:

$ bitbake-env TOPDIR TMPDIR DL_DIR
# DL_DIR="${TOPDIR}/downloads"
DL_DIR="/home/rpjday/OE/builds/oe/qemuarm/downloads"
# TMPDIR="${TOPDIR}/tmp${TCLIBCAPPEND}"
TMPDIR="/home/rpjday/OE/builds/oe/qemuarm/tmp-eglibc"
TOPDIR="/home/rpjday/OE/builds/oe/qemuarm"
$

Print specifically for the strace recipe:

$ bitbake-env -r strace SRC_URI
Parsing recipes..done.
# SRC_URI="${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.xz            file://0003-util-fix-building-when-glibc-has-a-stub-process_vm_r.patch            file://0014-x32-update-syscall-table.patch            file://0018-x32-update-g-s-etsockopt-syscall-numbers.patch            file://0024-x32-add-64bit-annotation-too.patch            file://0025-Add-e-trace-memory-option.patch            file://0026-linux-add-new-errno-values-for-EPROBE_DEFER-and-EOPE.patch            file://0027-Add-AArch64-support-to-strace.patch            file://0028-Enhance-quotactl-decoding.patch            file://0029-Filter-out-redundant-32-ioctl-entries.patch            file://0030-Move-asm-generic-ioctl-definitions-to-linux-ioctlent.patch            file://0031-Add-support-for-tracing-32-bit-ARM-EABI-binaries-on-.patch           "
SRC_URI="http://downloads.sourceforge.net/strace/strace-4.7.tar.xz            file://0003-util-fix-building-when-glibc-has-a-stub-process_vm_r.patch            file://0014-x32-update-syscall-table.patch            file://0018-x32-update-g-s-etsockopt-syscall-numbers.patch            file://0024-x32-add-64bit-annotation-too.patch            file://0025-Add-e-trace-memory-option.patch            file://0026-linux-add-new-errno-values-for-EPROBE_DEFER-and-EOPE.patch            file://0027-Add-AArch64-support-to-strace.patch            file://0028-Enhance-quotactl-decoding.patch            file://0029-Filter-out-redundant-32-ioctl-entries.patch            file://0030-Move-asm-generic-ioctl-definitions-to-linux-ioctlent.patch            file://0031-Add-support-for-tracing-32-bit-ARM-EABI-binaries-on-.patch           "
$

Also good for printing tasks themselves:

$ bitbake-env -r u-boot do_compile
Parsing recipes..done.
do_compile () {
    unset LDFLAGS
    unset CFLAGS
    unset CPPFLAGS

    rm   -rf _dm8148-mpu
    mkdir -p _dm8148-mpu

    bbnote "Building first stage SD card loader (MLO) ti814x"
    oe_runmake distclean
    oe_runmake ti8148_evm_min_sd
    oe_runmake -j 8 u-boot.ti TI_IMAGE=MLO
    mv MLO _dm8148-mpu/
    mv u-boot _dm8148-mpu/MLO.sd.elf

    bbnote "Building second stage SD card loader (u-boot-2nd.sd) ti814x"
    oe_runmake distclean
    oe_runmake ti8148_evm_config_sd
    oe_runmake -j 8 u-boot.ti TI_IMAGE=u-boot-2nd.sd
    mv u-boot-2nd.sd _dm8148-mpu/
    mv u-boot _dm8148-mpu/u-boot.sd.elf

    if [ "dm8148-mpu" == "dm8148-mpu" ] ; then
        bbnote "Building first stage SPI loader (MLO.spi) ti814x"
        oe_runmake distclean
        oe_runmake ti8148_evm_min_spi
        oe_runmake -j 8 u-boot.ti TI_IMAGE=MLO.spi
        mv MLO.spi _dm8148-mpu/
	mv u-boot _dm8148-mpu/MLO.spi.elf

        bbnote "Building second stage SPI loader (u-boot-2nd.spi) ti814x"
        oe_runmake distclean
        oe_runmake ti8148_evm_config_spi
        oe_runmake -j 8 u-boot.ti TI_IMAGE=u-boot-2nd.spi
        mv u-boot-2nd.spi _dm8148-mpu/
	mv u-boot _dm8148-mpu/u-boot.spi.elf
    fi
}

Chris tells me that it's still a work in progress, and I already have some ideas as to what I want added; specifically, that it would be useful to me for the variable values to be printed in the same order they're specified as parameters. So stay tuned ...


(Back to OE Yocto pages.)

Personal tools