• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Yocto recipetool tutorial

by admin

The recipetool allows for the easier creation of a base recipe based on the source code files. As long as you can extract or point to the source files, the recipetool will generate a recipe and automatically configure all pre-built information into the new recipe file.

There are two ways of writing a recipe:

  • Writing from scratch.
  • Using recipetool to create a recipe for us.

We will see in this post how to create a base recipe using recipetool.

Syntax for recipetool for local source:

recipetool create source

Let’s try to pass a simple hello.c file to recipetool and observe the output.

Note: Yocto environment script should be run, for us to use recipetool.
$ cat hello.c
#include <stdio.h>

int main()
{
	printf("hello yacto\n");
	return 0;
}
$ recipetool create hello.c > /dev/null 2>&1
$ cat hello.bb | tail -n 15
do_configure () {
	# specify any needed configure commands here
	:
}

do_compile () {
	# specify compilation commands here
	:
}

do_install () {
	# specify install commands here
	:
}

The recipetool command created ‘hello.bb’ with the following information added in the recipe:

  • LICENSE = “CLOSED”
  • SRC_URI
  • Empty configure(), compile(), install() tasks.

We can pass ‘o’ option to change the name of generated recipe:

$ recipetool create -o test_recipe.bb hello.c

When given a tar file, it added CHKSUM as well as any inherits.

$ recipetool create -o zlib 1.2.7.bb http://78.108.103.11:11080/MIRROR/ftp/png/src/history/zlib/zlib-1.2.7.tar.xz >
/dev/null 2>&1
$ cat zlib_1.2.7.bb
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
#  contrib/dotzlib/LICENSE 1 0.txt
LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://contrib/dotzlib/LICENSE 1 0.txt;md5=81543b22c36f10d20ac9712f8d80ef8d"

SRC_URI = "http://78.108.103.11:11080/MIRROR/ftp/png/src/history/zlib/zlib-${PV}.tar.xz"
SRC_URI[md5sum] = "b9acfc7597b5357a7243e37a84abb01le"
SRC_URI[sha256sum] = "347aa0dfce5694be44b94d2a349ea059c7dabbb39d9a7a330408dc49861268fe"

inherit cmake

# Specify any options you want to pass to cmake using EXTRA OECMAKE:
EXTRA_OECMAKE = ""

It added a ‘DEPENDS’ variable, when passed dropbear tarball.

$ recipetool create https://dropbear.nl/mirror/release/dropbear-2018.76.tar.bz2 > /dev/null > 2>&1
$ cat dropbear_2018.76.bb | tail -n 18
DEPENDS = "zlib"

# NOTE: if this software is not capable of being built in a separate build directory
# from the source, you should replace autotools with autotools-brokensep in the
# inherit line
inherit autotools

# Specify any options you want to pass to the configure script using EXTRA_DECONF:
EXTRA_DECONF = ""

Filed Under: C, C Library

Some more articles you might also be interested in …

  1. Linux Device Driver example for dump_stack() to print the stack trace of module loading
  2. C Functions
  3. Beginners Guide to C functions
  4. C Constants, Variables and Data Types
  5. oe-pkgdata-util utility in Yocto
  6. StringCchCat Function example
  7. Basics of C Functions
  8. File Handling in C Programming
  9. C Strings
  10. C Operators and Type Conversion

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright