Configuring packages

As we saw in the Configuring the Linux kernel recipe in Chapter 2, The BSP Layer, some packages, such as the Linux kernel, provide a configuration menu and can be configured with the menuconfig BitBake command.

Another package worth mentioning with a configuration interface is BusyBox, well-known software for embedded systems that provides stripped down Linux tools suitable for resource-constrained devices. We will show how to configure BusyBox, for example to add pgrep, a tool that looks up process IDs by name.

The BusyBox recipe has support for configuration fragments, so to configure BusyBox all we need is to bbappend the recipe in our custom layer. To generate the configuration fragment, first we launch the configuration menu with:

$ bitbake -c menuconfig busybox

In Process utilities, choose pgrep.

Now we generate a config fragment with:

$ bitbake -c diffconfig busybox
Config fragment has been dumped into:
 /opt/yocto/fsl-community-bsp/wandboard/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/busybox/1.24.1-r0/fragment.cfg
  

And finally, we apply the change to the layer with the following append file: recipes-core/busybox/busybox_1.24.1.bbappend:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"                                   
SRC_URI += "file://fragment.cfg"      

With the recipes-core/busybox/busybox/fragment.cfg file shown next:

CONFIG_PGREP=y 

The creation of the config fragment and append file can be automated with:

$ recipetool appendsrcfile </path/to/layer> busybox </path/to/config/fragment> 

We can now copy the RPM package into the target:

$ bitbake -e busybox | grep ^WORKDIR=
$ scp ${WORKDIR}/deploy-rpms/cortexa9hf_neon/busybox-1.24.1-r0.cortexa9hf_neon.rpm root@<target_ip>:/tmp

And install the RPM package on the target:

# rpm --force -U /tmp/busybox-1.24.1-r0.cortexa9hf_neon.rpm  

Note that we are forcing the update as the package version has not increased with the configuration change.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset