For native development, Yocto offers the -dev and -sdk target images. We can create -dev and -sdk versions of any image recipe by adding the following image features:
- tools-sdk: Adds developing tools to the target image. This is already included in the available -sdk images but not on -dev images.
- tools-debug: Adds debugging tools to the target image. This is already included in the available -sdk images but not on -dev images.
- dev-pkgs: Adds development packages with headers and libraries to the target image. This is included in both -sdk and -dev image types available.
- dbg-pkgs: Adds debug information to all packages in our image.
To just add native GDB debugging capabilities to an image such as core-image-minimal, we only need the dbg-pkgs and tools-debug features, which we can add with the following line in our conf/local.conf file:
EXTRA_IMAGE_FEATURES += "dbg-pkgs tools-debug"
To add complete native development capabilities to core-image-minimal-dev for example, we would add the following to our conf/local.conf file:
EXTRA_IMAGE_FEATURES += "tools-sdk dbg-pkgs tools-debug"
To keep the image sizes small we might want to remove the source that is installed alongside the debug package with the following:
PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"
To prepare a development-ready version of the core-image-minimal-dev target image, we would execute the following commands:
$ cd /opt/yocto/fsl-community-bsp/ $ source setup-environment wandboard $ bitbake core-image-minimal-dev
We will then program the development image to our target.