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

From KoanSoftware Wiki
Jump to: navigation, search
(new syntax)
(Creating Add build information into a Yocto image)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
== Creating Add build information into a Yocto image ==
 
== Creating Add build information into a Yocto image ==
  
Importing variables into the device with buildinfo
+
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.
+
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  
 
To enable buildinfo, open conf/local.conf and append  
Line 15: 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 file is shown below.
+
A sample resulting '''/etc/build''' file is shown below.
  
 
  -----------------------
 
  -----------------------
Line 21: Line 23:
 
  -----------------------
 
  -----------------------
 
  DISTRO = poky
 
  DISTRO = poky
  DISTRO_VERSION = 3.1.5
+
  DISTRO_VERSION = 4.0.19
  DATETIME = 20210312175409
+
  DATETIME = 20240626102217
 
  DISTRO_NAME = Poky (Yocto Project Reference Distro)
 
  DISTRO_NAME = Poky (Yocto Project Reference Distro)
 
  IMAGE_BASENAME = core-image-minimal
 
  IMAGE_BASENAME = core-image-minimal
 
  MACHINE = qemuarm
 
  MACHINE = qemuarm
  TUNE_PKGARCH = armv7vet2hf-neon
+
  TUNE_PKGARCH = cortexa15t2hf-neon
 
  MACHINE_FEATURES = alsa bluetooth usbgadget screen vfat rtc qemu-usermode
 
  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
+
  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 =  
 
  COMMON_FEATURES =  
 
  IMAGE_FEATURES = debug-tweaks package-management ssh-server-openssh
 
  IMAGE_FEATURES = debug-tweaks package-management ssh-server-openssh
  TUNE_FEATURES = arm armv7ve vfp thumb neon callconvention-hard
+
  TUNE_FEATURES = arm vfp cortexa15 neon thumb callconvention-hard
 
  TARGET_FPU = hard
 
  TARGET_FPU = hard
 
  -----------------------
 
  -----------------------
 
  Layer Revisions:      |
 
  Layer Revisions:      |
 
  -----------------------
 
  -----------------------
  meta              = dunfell:dc38d5e494e53a7a03d5bd8d2429d0ef54cfbbbc
+
  meta              = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df
  meta-poky        = dunfell:dc38d5e494e53a7a03d5bd8d2429d0ef54cfbbbc
+
  meta-poky        = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df
  meta-yocto-bsp    = dunfell:dc38d5e494e53a7a03d5bd8d2429d0ef54cfbbbc
+
  meta-yocto-bsp    = kirkstone:e139e9d0ce343ba77a09601a976c92acd562c9df
  meta-oe          = dunfell:de37512b25c1f8c6bb6ab2b3782ac0fe01443483
+
  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

Latest revision as of 10:31, 26 June 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 /etc/build file 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