1

i try to implement /etc/os-release in my beaglebone yocto after some attempt in my google. i added following in my configuration files

local.conf

INHERIT += "image-buildinfo"

BUILD_ID = "${@time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())}"

IMAGE_BUILDINFO_VARS = "DISTRO DISTRO_VERSION MACHINE IMAGE_NAME USER"

in os-release.bb

INHERIT += "image-buildinfo"

BUILD_ID = "${@time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())}"

IMAGE_BUILDINFO_VARS = "DISTRO DISTRO_VERSION MACHINE IMAGE_NAME USER"

I was expecting /etc/os-release or /usr/lib/os-release build successfully upon bitbake run completely , but i don't see both of them in my images.

Am i missing anything?or i misinterpret on any concept? Sorry for the rookies question, i am trying to exploring yocto

KJ L
  • 115
  • 2
  • 14
  • 1
    Possible better way: https://stackoverflow.com/questions/52756726/best-approach-of-image-versioning-in-yocto/52760810#52760810 – Parthiban Jun 23 '20 at 17:00

3 Answers3

2

Could it be you still have to tell Yocto to use the os-release recipe?

With a os-release.bbappend you can modify the recipe that is part of openembedded-core. There are a few examples how to do at that webpage. A good one is e.g. the one used in meta-yoe.

But all this is just telling Yocto how to build the recipe. You still have to tell Yocto to add it to your image.
This can be done in the local.conf file or e.g. the recipes-images/images/your-image.bb file or in a packagegroup. The first solution is the quick and dirty one.

vermaete
  • 1,330
  • 1
  • 17
  • 28
  • After i try build some simple application using my own recipes i finally understand what you mean. Thanks – KJ L Jun 29 '20 at 13:28
  • 1
    @KJ Lau The best introduction to Yocto I could find are these: https://bootlin.com/doc/training/yocto/yocto-slides.pdf – vermaete Jun 29 '20 at 13:30
2

INHERIT += "image-buildinfo" generates a /etc/build file and not /etc/os-release that you're looking for

See this official section of mega-manual

amonthedeamon
  • 306
  • 3
  • 9
  • Hi i do added the following, kindly refer pastebin below https://pastebin.com/TNetLdkP . May i know how generate to /etc/os-release? – KJ L Jun 25 '20 at 01:28
  • you need to add "os-release" package to your image target or add to your `local.conf` the string `IMAGE_INSTALL_append = " os-release"` – amonthedeamon Jul 15 '20 at 12:50
1

You can add it by following method CORE_IMAGE_EXTRA_INSTALL += "os-release lsb-release"

  • Yup, i have done it. I am not sure why the moderator hided my answer. But yup the answer just configure it at local.conf. – KJ L Jul 09 '20 at 03:32