33

thx for reading, I am working in a project where we create a secimage (linux yocto image).

I am not familiar with all the tools used there and neither am I familiar with the technical terms to use. So this question may be just really really stupid, but I cannot figure it out by the life of mine.

We have a YOCTO ...something... with all those recipes (debian packages) we need on our (resulting) Operating-System, we use (don't know if this is obvious) bitbake to build our Image.

I know that we have some ...targets... for the bitbake command (e.g. a target for building the image for production and a target for building the image for development purposes, they obviously differ in the packages installed, just to mention one: gdb-server).

Since I came into this project later on, I have no idea how they named those targets... so I just want to know:

How can I get a list of targets?

(I tried searching but since I am not even familiar with all the technical terms to use, cause I am not a developer for YOCTO, I may just did not search for the right terms)

I do not want to list the tasks, I just want to make a development image, which I know there is a target configured for it, I just don't know its name (and none of my colleges are here, nor will they be any time soon).

EDIT

Davids answer seems to be the closest, but there are some other ways in the comments ;-). THX all for your help, appreciated.

MDeero
  • 370
  • 1
  • 4
  • 11
  • Nevermind, I just did a `grep -rnw #theOneTargetNameIKnew#` and got a (lot of) result(s) pointing me to /#YOCTO#/#OurDistroMetaDirectory#/recipes-core/images/#target#.bb. Those seem to be the targets. If anyone has a bitbake command to get a list of these though, that would be nice. THX – MDeero Jun 10 '16 at 07:35
  • 4
    Check out the [Yocto Mega Manual - Chapter 27. Images](http://www.yoctoproject.org/docs/2.1/mega-manual/mega-manual.html#ref-images) section to understand what an output target is. Generally each image should be placed in meta layer within image directory in corresponding _image_name_.bb recipe. As pointed in linked chapter, instead of grepping through whole workspace, you can examine your meta layers by calling: ` $ ls meta*/recipes*/images/*.bb`. Have fun using yocto! – iksajotien Jun 10 '16 at 08:09
  • 1
    So there is defenitly no command in the bitbake binaries!?... *shakes his head out of disappointment*... Yeah that command works, thx... a little tweak ;-) : `ls meta*/recipes*/images/*.bb | sed -e 's/^.*\///g' | sed -e 's/\.bb$//g'`--- Just seeing, it's in @h0ch5tr4355 caommand too... – MDeero Jun 10 '16 at 10:14
  • Oh, and a big thx for the mega-manual... didn't find that yet (sure am glad I dont need to work on the YOCTO images) – MDeero Jun 10 '16 at 10:22

6 Answers6

33

You can easily list all the targets/recipes (.bb files) in your workspace doing:

bitbake-layers show-recipes

If you want only the recipes for your image, do:

bitbake-layers show-recipes "<image_name>"
David Bensoussan
  • 2,887
  • 2
  • 38
  • 55
  • This is a list of recipes only though, not a list of images per se. So it's not really what I want, but if it is known that the images one is looking for have a specific prefix/infix/postfix, the second command given can be useful. (If anyone is having troubles with the above, remember to set up the environment `source oe-init-build-env`. ) THX David – MDeero Jun 10 '16 at 10:33
  • I'd like you to include the limitation of this answer in your post (prefix/infix/postfix) but as h0ch5tr4355 I too think this is the closest answer (as long as there really ain't a way to find images only with one command, but it doesn't look like it). I will accept this. THX – MDeero Jun 10 '16 at 11:19
  • 6
    You can two ways as bitbake doesn't make differences for recipes: Either the assumption that image-recipes are always in `images`folders or te assumption that `image`is in the name of the recipe. second would also give this command: `bitbake-layers show-recipes "*-image-*"` – h0ch5tr4355 Jun 10 '16 at 11:20
9

To list the pre-defined Yocto images, run the following command from your poky directory

ls meta*/recipes*/images/*.bb
Frank Liu
  • 1,466
  • 3
  • 23
  • 36
  • This is the correct answer according to the yocto manual: https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#ref-images – user8908459 Nov 08 '19 at 18:05
4

Other SDKs often use a custom script for setting up the build environment for yocto (mostly refers on oe-init-build-env from yocto anyway).

I took an excerpt of the setup script from the Freescale SDK 1.9 (fsl-setup-env) and created a script to display the images. It can be similar to this:

get-images.sh:

# top level directory of your yocto project
POKYROOTDIR=/home/poky

echo "Images:"
for i in `ls $POKYROOTDIR/meta*/recipes-*/images/*.bb 2>/dev/null`;do
    i=`basename $i`;i=`echo $i |sed -e 's,^\(.*\)\.bb,\1,'`
    echo "    $i";
done

This is based on the assumption that every recipe is placed in a images directory, what is supposed to be a convention.

h0ch5tr4355
  • 2,092
  • 4
  • 28
  • 51
  • 1
    Also look at iksajotien's solution in the comments which is the short version of this – h0ch5tr4355 Jun 10 '16 at 08:13
  • I always forget that i have to escape the braces in sed, this is nice, but not a bitbake command, i see that i didnt explicitly asked for a bitbale command, but i am gonn await out to see if someone knows a bitbake command for this. thx – MDeero Jun 10 '16 at 10:20
  • deleted my comment and overworked it in David Bensoussan's solution. – h0ch5tr4355 Jun 10 '16 at 11:23
  • Better to make the POKYROOTDIR var generic and get the path using pwd, like so POKYROOTDIR=`pwd`; – Vendetta V Nov 02 '18 at 10:14
4

To list the pre-defined Yocto images in all meta files, run the following command from your poky directory

find . -type f -path '*images/*' -name '*.bb'
2

A similar command as the one provided on the NXP website here

bitbake-layers show-recipes "*image*"
Mickael T
  • 895
  • 2
  • 8
  • 19
0

I like this solution:

ziga@ziga--hypervisor:~/yocto$ ag -g .bb poky/meta | grep image

poky/meta/recipes-sato/images/core-image-sato.bb
poky/meta/recipes-sato/images/core-image-sato-dev.bb
poky/meta/recipes-sato/images/core-image-sato-sdk.bb
poky/meta/recipes-sato/images/core-image-sato-ptest-fast.bb
poky/meta/recipes-sato/images/core-image-sato-sdk-ptest.bb
poky/meta/recipes-graphics/xorg-lib/xcb-util-image_0.4.0.bb
poky/meta/recipes-graphics/images/core-image-clutter.bb
poky/meta/recipes-graphics/images/core-image-x11.bb
poky/meta/recipes-graphics/images/core-image-weston.bb
poky/meta/recipes-rt/images/core-image-rt-sdk.bb
poky/meta/recipes-rt/images/core-image-rt.bb
poky/meta/classes/image-live.bbclass
poky/meta/classes/kernel-uimage.bbclass
poky/meta/classes/image-combined-dbg.bbclass
poky/meta/classes/testimage.bbclass
poky/meta/classes/license_image.bbclass
poky/meta/classes/image-postinst-intercepts.bbclass
poky/meta/classes/core-image.bbclass
poky/meta/classes/image-mklibs.bbclass
poky/meta/classes/image-prelink.bbclass
poky/meta/classes/image_types_wic.bbclass
poky/meta/classes/image-buildinfo.bbclass
poky/meta/classes/image_types.bbclass
poky/meta/classes/kernel-fitimage.bbclass
poky/meta/classes/image.bbclass
poky/meta/classes/image-container.bbclass
poky/meta/recipes-extended/images/core-image-testmaster.bb
poky/meta/recipes-extended/images/core-image-testmaster-initramfs.bb
poky/meta/recipes-extended/images/core-image-kernel-dev.bb
poky/meta/recipes-extended/images/core-image-full-cmdline.bb
poky/meta/recipes-core/ovmf/ovmf-shell-image.bb
poky/meta/recipes-core/images/core-image-minimal-mtdutils.bb
poky/meta/recipes-core/images/core-image-minimal.bb
poky/meta/recipes-core/images/core-image-base.bb
poky/meta/recipes-core/images/core-image-minimal-initramfs.bb
poky/meta/recipes-core/images/core-image-minimal-dev.bb
poky/meta/recipes-core/images/core-image-tiny-initramfs.bb
poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
71GA
  • 1,132
  • 6
  • 36
  • 69