1.6.2. Creating a new BSP Layer Using the yocto-bsp Script

The yocto-bsp script creates a new BSP layer for any architecture supported by the Yocto Project, as well as QEMU versions of the same. The default mode of the script's operation is to prompt you for information needed to generate the BSP layer.

For the current set of BSPs, the script prompts you for various important parameters such as:

You use the yocto-bsp create sub-command to create a new BSP layer. This command requires you to specify a particular kernel architecture (karch) on which to base the BSP. Assuming you have sourced the environment, you can use the yocto-bsp list karch sub-command to list the architectures available for BSP creation as follows:

     $ yocto-bsp list karch
     Architectures available:
         powerpc
         i386
         x86_64
         arm
         qemu
         mips
                    

The remainder of this section presents an example that uses myarm as the machine name and qemu as the machine architecture. Of the available architectures, qemu is the only architecture that causes the script to prompt you further for an actual architecture. In every other way, this architecture is representative of how creating a BSP for an actual machine would work. The reason the example uses this architecture is because it is an emulated architecture and can easily be followed without requiring actual hardware.

As the yocto-bsp create command runs, default values for the prompts appear in brackets. Pressing enter without supplying anything on the command line or pressing enter with an invalid response causes the script to accept the default value. Once the script completes, the new meta-myarm BSP layer is created in the current working directory. This example assumes you have sourced the oe-init-build-env and are currently in the top-level folder of the Source Directory.

Following is the complete example:

     $ yocto-bsp create myarm qemu
     Checking basic git connectivity...
     Done.

     Which qemu architecture would you like to use? [default: i386]
     	     1) i386    (32-bit)
	     2) x86_64  (64-bit)
	     3) ARM     (32-bit)
	     4) PowerPC (32-bit)
	     5) MIPS    (32-bit)
     3
     Would you like to use the default (3.10) kernel? (y/n) [default: y] y
     Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n] [default: y]
     Getting branches from remote repo git://git.yoctoproject.org/linux-yocto-3.10.git...
     Please choose a machine branch to base your new BSP branch on: [default: standard/base]
	     1) standard/arm-versatile-926ejs
	     2) standard/base
	     3) standard/beagleboard
	     4) standard/ck
	     5) standard/crownbay
	     6) standard/edf
	     7) standard/emenlow
	     8) standard/fri2
	     9) standard/fsl-mpc8315e-rdb
	     10) standard/minnow
	     11) standard/mti-malta32
	     12) standard/mti-malta64
	     13) standard/qemuppc
	     14) standard/routerstationpro
	     15) standard/sys940x
     1
     Would you like SMP support? (y/n) [default: y]
     Does your BSP have a touchscreen? (y/n) [default: n]
     Does your BSP have a keyboard? (y/n) [default: y]

     New qemu BSP created in meta-myarm
                    

Let's take a closer look at the example now:

  1. For the QEMU architecture, the script first prompts you for which emulated architecture to use. In the example, we use the ARM architecture.

  2. The script then prompts you for the kernel. The default 3.10 kernel is acceptable. So, the example accepts the default. If you enter 'n', the script prompts you to further enter the kernel you do want to use (e.g. 3.2, 3.2_preempt-rt, and so forth.).

  3. Next, the script asks whether you would like to have a new branch created especially for your BSP in the local Linux Yocto Kernel Git repository . If not, then the script re-uses an existing branch.

    In this example, the default (or "yes") is accepted. Thus, a new branch is created for the BSP rather than using a common, shared branch. The new branch is the branch committed to for any patches you might later add. The reason a new branch is the default is that typically new BSPs do require BSP-specific patches. The tool thus assumes that most of time a new branch is required.

  4. Regardless of which choice you make in the previous step, you are now given the opportunity to select a particular machine branch on which to base your new BSP-specific machine branch (or to re-use if you had elected to not create a new branch). Because this example is generating an ARM-based BSP, the example uses #1 at the prompt, which selects the ARM-versatile branch.

  5. The remainder of the prompts are routine. Defaults are accepted for each.

  6. By default, the script creates the new BSP Layer in the current working directory of the Source Directory, which is poky in this case.

Once the BSP Layer is created, you must add it to your bblayers.conf file. Here is an example:

     BBLAYERS = ? " \
        /usr/local/src/yocto/meta \
        /usr/local/src/yocto/meta-yocto \
        /usr/local/src/yocto/meta-yocto-bsp \
        /usr/local/src/yocto/meta-myarm \
        "

     BBLAYERS_NON_REMOVABLE ?= " \
        /usr/local/src/yocto/meta \
        /usr/local/src/yocto/meta-yocto \
        "
                    

Adding the layer to this file allows the build system to build the BSP and the yocto-kernel tool to be able to find the layer and other Metadata it needs on which to operate.