Difference between revisions of "Add build information into a Yocto image"
(→Creating Add build information into a Yocto image) |
|||
(One intermediate revision by the same user not shown) | |||
Line 17: | Line 17: | ||
And run the image, e.g. with runqemu qemuarm nographic, and look at the file generated in /etc/build. | And run the image, e.g. with runqemu qemuarm nographic, and look at the file generated in /etc/build. | ||
− | A sample resulting '''/etc/build''' | + | A sample resulting file '''/etc/build''' or '''/etc/buildinfo''' (depending on the Yocto vesion) is shown below. |
----------------------- | ----------------------- |
Latest revision as of 17:22, 10 December 2024
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"
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 file /etc/build or /etc/buildinfo (depending on the Yocto vesion) is shown below.
----------------------- Build Configuration: | ----------------------- DISTRO = poky DISTRO_VERSION = 4.0.19 DATETIME = 20240626102217 DISTRO_NAME = Poky (Yocto Project Reference Distro) IMAGE_BASENAME = core-image-minimal MACHINE = qemuarm TUNE_PKGARCH = cortexa15t2hf-neon MACHINE_FEATURES = alsa bluetooth usbgadget screen vfat rtc qemu-usermode DISTRO_FEATURES = acl alsa argp bluetooth debuginfod ext2 ipv4 ipv6 largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp 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 vfp cortexa15 neon thumb callconvention-hard TARGET_FPU = hard ----------------------- Layer Revisions: | ----------------------- meta = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df meta-poky = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df meta-yocto-bsp = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df meta-oe = kirkstone:0560b848996a0feb410a8cd8ca07c60fe2f3b5bc
Buildhistory
To enable buildhistory, open conf/local.conf and append
INHERIT += "buildhistory" BUILDHISTORY_COMMIT = "1"
The same details are registered on the HOST for every build when you enable buildhistory
commit 3c194a01ee722b94f474c7911ccb926ee2858639 (HEAD -> master) Author: buildhistory <buildhistory@poky> Date: Wed Jun 26 10:22:52 2024 +0000 Build 20240626102217 of poky 4.0.19 for machine qemuarm on koanserver cmd: bitbake core-image-minimal result: succeeded metadata revisions: meta = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df meta-poky = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df meta-yocto-bsp = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df meta-oe = kirkstone:0560b848996a0feb410a8cd8ca07c60fe2f3b5bc