Root File System (RFS) Development on Opal-6

What is a Root File System RFS

The root filesystem contains all the applications and tools required to boot and run Linux on Opal-6.

How do I configure it?

You will use Yocto recipes to configure your root filesystem. Using Yocto you can pick and choose which applications and tools you wish to have contained in your root filesystem image.

Including my application in the RFS

During development of your application you will simply copy across your application to your Opal-6 board and run it as you would any other application.

To permanently include your own application in the root filesystem you will first need to create a custom recipe for it and then include that in the root filesystem recipe. These steps are covered below.

Building using Yocto

We shall attempt to give an overview of what is required to include your application in the Yocto build environment however more details can be found at http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html and from the many Yocto resources on the web.

Creating a Custom Layer

Whenever adding your own content to Yocto, you should do so within your own layer. Creating a new layer is easy e.g. for our custom layer 'meta-opal6-demos', you would do the following:

$: cd ~/fsl-community-bsp
$: source setup-environment build
$: cd sources
$: yocto-layer create meta-opal6-demos

The priority of your layer should be at equal to the lowest already present (usually 4) unless you want to introduce a recipe with the same name as one that already exists. We have used this technique to override the ppp recipe. By setting our layer priority higher we ensure our files replace those in the original recipe. Note that layers sholud begin with 'meta-'. You can version your layer with git and upload to a server as required.

Add your custom layer to build/conf/bblayers.conf so it gets picked up by Yocto.

You can verify your layer has been added successfully by running the following command:

$: bitbake-layers show-layers

Creating a New Recipe

We'll continue with our hello world application. First create a folder to store your recipe in. Recipe folders start with 'recipe-':

$: cd ~/fsl-community-bsp/sources/meta-opal6-demos

We'll create a folder to store a few apps:

$: mkdir recipe-apps

Now we'll make a folder for our specific app:

$: mkdir helloworld

The actual recipe is contained in a .bb file. Our recipe looks like this:

#
# This file was derived from the 'Hello World!' example recipe in the
# Yocto Project Development Manual.
#
DESCRIPTION = "Simple helloworld application"
SECTION = "apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PR = "r0"
SRC_URI = "file://helloworld.c"
S = "${WORKDIR}"
do_compile() {
${CC} helloworld.c -o helloworld
}
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
}

 

All source files should be placed in another folder on the same level as the .bb file and should be named the same as the recipe. The SRC_URI specifies the files we want to include in our recipe and you can see we have added custom compile and install functions containing our compiler command and where we want the application to be stored in our root filesystem, in this case in /usr/bin.

 

On this page