Transcript: Using the Yocto BSP tools to create a qemu BSP
Here's a cut-and-paste shell session showing how to have the Yocto BSP tools create a new BSP from scratch. It starts with a fresh git checkout, then invokes yocto-bsp to create a new qemu-based ARM BSP, and finally builds a sato image and boots into a sato desktop in a qemu session (commands also shown for that).
NOTE: this transcript was from a build done on a Ubuntu 10.04 system. Please see the 'Yocto Project Quickstart' for the packages required to be installed on the host system for building [1]
One thing to note with this example is that I'm checking out from poky/master.
trz@elmorro:/usr/local/dev$ mkdir Yocto trz@elmorro:/usr/local/dev$ cd Yocto/ trz@elmorro:/usr/local/dev/Yocto$ git init Initialized empty Git repository in /usr/local/dev/Yocto/.git/ trz@elmorro:/usr/local/dev/Yocto$ git remote add yocto git://git.yoctoproject.org/poky.git trz@elmorro:/usr/local/dev/Yocto$ git remote update Fetching yocto remote: Counting objects: 134438, done. remote: Compressing objects: 100% (39702/39702), done. remote: Total 134438 (delta 93915), reused 131102 (delta 91225) Receiving objects: 100% (134438/134438), 75.48 MiB | 1.70 MiB/s, done. Resolving deltas: 100% (93915/93915), done. From git://git.yoctoproject.org/poky * [new branch] 1.1_M1 -> yocto/1.1_M1 * [new branch] 1.1_M2 -> yocto/1.1_M2 * [new branch] 1.1_M3 -> yocto/1.1_M3 * [new branch] 1.1_M4 -> yocto/1.1_M4 * [new branch] 1.2_M1 -> yocto/1.2_M1 * [new branch] 1.2_M2 -> yocto/1.2_M2 * [new branch] 1.2_M3 -> yocto/1.2_M3 * [new branch] bernard -> yocto/bernard * [new branch] blinky -> yocto/blinky * [new branch] clyde -> yocto/clyde * [new branch] edison -> yocto/edison * [new branch] elroy -> yocto/elroy * [new branch] green -> yocto/green * [new branch] laverne -> yocto/laverne * [new branch] master -> yocto/master * [new branch] pinky -> yocto/pinky * [new branch] purple -> yocto/purple * [new tag] 1.1_M1.final -> 1.1_M1.final * [new tag] 1.1_M2.final -> 1.1_M2.final * [new tag] 1.1_M2.rc3 -> 1.1_M2.rc3 * [new tag] 1.1_M3.final -> 1.1_M3.final * [new tag] 1.1_M3.rc3 -> 1.1_M3.rc3 * [new tag] 1.2_M1.final -> 1.2_M1.final * [new tag] 1.2_M1.rc2 -> 1.2_M1.rc2 * [new tag] 1.2_M2.final -> 1.2_M2.final * [new tag] 1.2_M2.rc1 -> 1.2_M2.rc1 * [new tag] 1.2_M3.rc1 -> 1.2_M3.rc1 * [new tag] bernard-5.0.2+docs -> bernard-5.0.2+docs * [new tag] pinky-3.1.2 -> pinky-3.1.2 From git://git.yoctoproject.org/poky * [new tag] 1.1_M1.rc1 -> 1.1_M1.rc1 * [new tag] 1.1_M1.rc2 -> 1.1_M1.rc2 * [new tag] 1.1_M2.rc1 -> 1.1_M2.rc1 * [new tag] 1.1_M2.rc2 -> 1.1_M2.rc2 * [new tag] 1.1_M3.rc2 -> 1.1_M3.rc2 * [new tag] 1.1_M4.rc2+ -> 1.1_M4.rc2+ * [new tag] 1.1_M4.rc3 -> 1.1_M4.rc3 * [new tag] 1.1_M4.rc4 -> 1.1_M4.rc4 * [new tag] 1.2_M1.rc1 -> 1.2_M1.rc1 * [new tag] bernard-1.0rc1 -> bernard-1.0rc1 * [new tag] bernard-5.0 -> bernard-5.0 * [new tag] bernard-5.0-alpha -> bernard-5.0-alpha * [new tag] bernard-5.0.1 -> bernard-5.0.1 * [new tag] bernard-5.0.2 -> bernard-5.0.2 * [new tag] bernard-5.0rc1 -> bernard-5.0rc1 * [new tag] bernard-5.0rc2 -> bernard-5.0rc2 * [new tag] edison-6.0 -> edison-6.0 * [new tag] laverne-4.0 -> laverne-4.0 * [new tag] laverne-4.0.1 -> laverne-4.0.1 * [new tag] m4 -> m4 * [new tag] purple-3.2 -> purple-3.2 * [new tag] purple-3.2.1 -> purple-3.2.1
Now that we've cloned the Yocto repo, we need to source the environment in order to create or build a BSP:
trz@elmorro:/usr/local/dev/Yocto$ source oe-init-build-env You had no conf/local.conf file. This configuration file has therefore been created for you with some default values. You may wish to edit it to use a different MACHINE (target hardware) or enable parallel build options to take advantage of multiple cores for example. See the file for more information as common configuration options are commented. The Yocto Project has extensive documentation about OE including a reference manual which can be found at: http://yoctoproject.org/documentation For more information about OpenEmbedded see their website: http://www.openembedded.org/ You had no conf/bblayers.conf file. The configuration file has been created for you with some default values. To add additional metadata layers into your configuration please add entries to this file. The Yocto Project has extensive documentation about OE including a reference manual which can be found at: http://yoctoproject.org/documentation For more information about OpenEmbedded see their website: http://www.openembedded.org/ ### Shell environment set up for builds. ### You can now run 'bitbake <target>' Common targets are: core-image-minimal core-image-sato meta-toolchain meta-toolchain-sdk adt-installer meta-ide-support You can also run generated qemu images with a command like 'runqemu qemux86'
We're now ready to generate a BSP using the 'yocto-bsp' tool. The 'yocto-bsp' tool will step through a series of questions about how the new BSP should be configured. The Yocto BSP tools all have extensive help and usage screens built in, which can be easily displayed at any time to remind yourself of the command syntax and descriptions of what the commands and sub-commands do. The tools have a git-like interface, meaning that there's a top-level command which essentially invokes multiple lower-level subcommands.
To display help for a top-level command, simply invoke the command without any parameters:
trz@elmorro:/usr/local/dev/Yocto/build$ yocto-bsp Usage: Create a customized Yocto BSP layer. usage: yocto-bsp [--version] [--help] COMMAND [ARGS] The most commonly used 'yocto-bsp' commands are: create Create a new Yocto BSP list List available values for options and BSP properties See 'yocto-bsp help COMMAND' for more information on a specific command. Options: --version show program's version number and exit -h, --help show this help message and exit -D, --debug output debug information
In order to create a new BSP, we'll want to use the 'yocto-bsp create' command.
To display usage help for a sub-command like 'yocto-bsp create', simply invoke it without any parameters:
trz@elmorro:/usr/local/dev/Yocto/build$ yocto-bsp create Usage: Create a new Yocto BSP usage: yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>] [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] This command creates a Yocto BSP based on the specified parameters. The new BSP will be a new Yocto BSP layer contained by default within the top-level directory specified as 'meta-bsp-name'. The -o option can be used to place the BSP layer in a directory with a different name and location. The value of the 'karch' parameter determines the set of files that will be generated for the BSP, along with the specific set of 'properties' that will be used to fill out the BSP-specific portions of the BSP. The possible values for the 'karch' paramter can be listed via 'yocto-bsp list karch'. Options: -h, --help show this help message and exit -o OUTDIR, --outdir=OUTDIR name of BSP dir to create -i PROPERTIES_FILE, --infile=PROPERTIES_FILE name of file containing the values for BSP properties as a JSON file -c, --codedump dump the generated code to bspgen.out
You can also get more extensive help for a sub-command by adding 'help' before the sub-command name:
trz@elmorro:/usr/local/dev/Yocto/build$ yocto-bsp help create NAME yocto-bsp create - Create a new Yocto BSP SYNOPSIS yocto-bsp create <bsp-name> <karch> [-o <DIRNAME> | --outdir <DIRNAME>] [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] DESCRIPTION This command creates a Yocto BSP based on the specified parameters. The new BSP will be a new Yocto BSP layer contained by default within the top-level directory specified as 'meta-bsp-name'. The -o option can be used to place the BSP layer in a directory with a different name and location. The value of the 'karch' parameter determines the set of files that will be generated for the BSP, along with the specific set of 'properties' that will be used to fill out the BSP-specific portions of the BSP. The possible values for the 'karch' paramter can be listed via 'yocto-bsp list karch'. The BSP-specific properties that define the values that will be used to generate a particular BSP can be specified on the command-line using the -i option and supplying a JSON object consisting of the set of name:value pairs needed by the BSP. If the -i option is not used, the user will be interactively prompted for each of the required property values, which will then be used as values for BSP generation. The set of properties available for a given architecture can be listed using the 'yocto-bsp list' command. Specifying -c causes the Python code generated and executed to create the BSP to be dumped to the 'bspgen.out' file in the current directory, and is useful for debugging. NOTE: Once created, you should add your new layer to your bblayers.conf file in order for it to be subsquently seen and modified by the yocto-kernel tool. NOTE for x86- and x86_64-based BSPs: The generated BSP assumes the presence of the of the meta-intel layer, so you should also have a meta-intel layer present and added to your bblayers.conf as well.