Yocto Quick Reference
Topic | Command or Configuration | Description |
---|---|---|
Add a package | conf/local.conf or image recipe: IMAGE_INSTALL_append = " package1 package2" |
This is the simplest way to add packages to a Yocto build. Use your own package name in place of package1, package2 . Note the leading space before the package name.For more information, read this chapter in the Yocto Project manual: http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#usingpoky-extend-customimage-localconf |
Compile the bootloader | $ bitbake virtual/bootloader |
This command will compile the bootloader. |
Compile the kernel | $ bitbake virtual/kernel |
This command will compile the kernel. |
Customize kernel configuration | $ bitbake -c menuconfig virtual/kernel |
This command will open the ncurses menuconfig interface for the target Linux kernel. |
Generate a cross-toolchain | $ bitbake meta-ide-support |
This command will generate a cross-toolchain that can be used outside the Yocto build environment. An environment setup script is also generated in the tmp/ directory - which can be sourced to setup the current shell for cross-compilation. |
Generate an SDK | $ bitbake <recipe> -c populate_sdk |
This command will create a self-extracting SDK installer, containing the cross-toolchain, for a given recipe. The SDK installer executable can be found in the tmp/deploy/sdk directory. |
Host requirements | https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#required-packages-for-the-build-host | Instructions to host install required packages to build the base Yocto distribution can be found at this link. |
Image types | conf/local.conf or machine configuration file:IMAGE_FSTYPES = "type1 type2" |
Specifies what boot image formats are created upon build completion. The base types are defined in the IMAGE_TYPES variable in poky/meta/classes/image_types.bbclass . Supported notable types include: cpio, wic, tar.bz2, ext2, ext3, ext4, jffs2, ubifs, cramfs, squashfs |
Maintaining Build Quality | conf/local.conf : INHERIT += "buildhistory" BUILDHISTORY_COMMIT = "1" |
This can be a useful tool to maintain build quality as a build changes (eg, when using a new version of a package or experimenting with new configure options). More details can be found here: https://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#maintaining-build-output-quality |
Remove temporary work | conf/local.conf : INHERIT += "rm_work" |
Removes package source in tmp directory after the build completes. Drastically lowers amount of host hard drive space used for a build. |
Rootfs overlay | Image recipe:ROOTFS_POSTPROCESS_COMMAND += "rfs_overlay;" rfs_overlay() { rsync -a ${THISDIR}/rootfs/* ${WORKDIR}/rootfs } Create a rootfs/ directory in the image recipe directory. |
This configuration can be used to add directories and files exactly as you want on the target RFS. Add files and directories to the created rootfs/ directory.If your recipe is empty/does nothing other than edit the rootfs, then also add the following to the recipe to avoid a missing package error in the do_rfs step: FILES_${PN} = "" ALLOW_EMPTY_${PN} = "1" |