Difference between revisions of "Add build information into a Yocto image"

From KoanSoftware Wiki
Jump to: navigation, search
(Created page with "== Creating Add build information into a Yocto image == Importing variables into the device with buildinfo There is a little known image feature in Yocto called buildinfo th...")
(No difference)

Revision as of 18:00, 12 March 2021

Creating Add build information into a Yocto image

Importing variables into the device with buildinfo

There is a little known image feature in Yocto called buildinfo that will help us get the required information. Buildinfo is available in Yocto 1.8 and later versions. This image feature will write a set of OpenEmbedded variables to a file /etc/build in the image, which in turn gets written to the target device.

To enable buildinfo, open conf/local.conf and append

INHERIT += "image-buildinfo"
IMAGE_BUILDINFO_VARS_append = " DATETIME DISTRO_NAME IMAGE_BASENAME MACHINE TUNE_PKGARCH" 
IMAGE_BUILDINFO_VARS_append = " MACHINE_FEATURES DISTRO_FEATURES COMMON_FEATURES IMAGE_FEATURES"
IMAGE_BUILDINFO_VARS_append = " TUNE_FEATURES TARGET_FPU"
IMAGE_BUILDINFO_VARS_append = " APP_URI_PREFIX APP_URI_BRANCH"

Then build the desired image, e.g. with bitbake -k core-image-minimal. And run the image, e.g. with runqemu qemuarm nographic, and look at the file generated in /etc/build.

A sample resulting /etc/build file is shown below.

-----------------------
Build Configuration:  |
-----------------------
DISTRO = poky
DISTRO_VERSION = 3.1.5
DATETIME = 20210312175409
DISTRO_NAME = Poky (Yocto Project Reference Distro)
IMAGE_BASENAME = core-image-minimal
MACHINE = qemuarm
TUNE_PKGARCH = armv7vet2hf-neon
MACHINE_FEATURES = alsa bluetooth usbgadget screen vfat rtc qemu-usermode
DISTRO_FEATURES = acl alsa argp bluetooth ext2 ipv4 ipv6 largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11  vfat largefile opengl ptest multiarch wayland vulkan pulseaudio sysvinit gobject-introspection-data ldconfig
COMMON_FEATURES = 
IMAGE_FEATURES = debug-tweaks package-management ssh-server-openssh
TUNE_FEATURES = arm armv7ve vfp thumb neon callconvention-hard
TARGET_FPU = hard
APP_URI_PREFIX = 
APP_URI_BRANCH = 
-----------------------
Layer Revisions:      |
-----------------------
meta              = dunfell:dc38d5e494e53a7a03d5bd8d2429d0ef54cfbbbc 
meta-poky         = dunfell:dc38d5e494e53a7a03d5bd8d2429d0ef54cfbbbc 
meta-yocto-bsp    = dunfell:dc38d5e494e53a7a03d5bd8d2429d0ef54cfbbbc 
meta-oe           = dunfell:de37512b25c1f8c6bb6ab2b3782ac0fe01443483