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.
$ 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 = ""