Guideline to create OEM specific images
This document describes how to add a new configuration in yocto.
Write a recipe <oem>-image-tools-native.bb under recipes-tools to copy all the tools, binaries and scripts needed to create custom oem image to the staging binary directory
- This recipe should fetch all the sources from the GIT repo
- Example name space for the GIT repo where you should place all the tools like permission files, authentication keys etc - “rdk/devices/<OEM>/<OEM_device>/tools”
- Example namespace for the GIT repo to keep all the binaries (crcsum etc) - “rdk/devices/<OEM>/<OEM_device>/bin”
- This recipe will have only one task – do_install, which copies all the necessary files to create oem images to staging binary directory
- "inherit native" this class would short-circuit all the target build and strip tasks.
Write a bbclass - oem-image.bbclass
- Add oem-image-tools as DEPENDS
- In this class add a task "create_oem_image" to create the oem specific images - "addtask create_oem_image after do_rootfs before do_build"
- Copy all the tools and files needed from STAGING_BINDIR_NATIVE to working directory, which were copied by <oem>-image-tools-native.bb
- Once copied this task will have the logic to create the custom oem images
- After creating the custom oem images, copy them to DEPLOY_DIR_IMAGE
- In recipe add "create_oem_image[nostamp] = "1"", this allows task to run every-time on every run of bitbake.
- Add create_oem_image[depends] += "${PN}:do_rootfs" to make sure the do_rootfs task is re-run every time before executing the task - create_oem_image.
- Make this class inherit by all the rdk image recipes,
rdk-generic-mediaserver-image.bbappend: inherit oem-image,comcast-mediaclient-image.bbappend:inherit oem-image,comcast-hybrid-image.bbappend:inherit oem-image,rdk-generic-hybrid-image.bbappend:inherit oem-image, core-image-minimal.bbappend:inherit oem-image,rdk-generic-image.bbappend:inherit oem-image,rdk-generic-mediaclient-image.bbappend:inherit oem-image.
Adding a new SoC/OEM to RDK
Adding a new machine to the Yocto Project is a straightforward process which involves following steps:
- Create a new layer which will hold all the recipes and machine configurations for the new SoC/OEM.
- Adding the Machine Configuration File for the new SoC/OEM.
- Adding a Kernel for the Machine.
- Adding Recipe for SoC/OEM
- Creating packages for building images
Creating the new SoC/OEM Layer
Use the yocto-layer create sub-command to create a new general layer.
- yocto-layer create mylayer
There shall be separate device (machine) configuration file (.conf) for each device for the particular chip family for which the layer is intended for
- For Eg : A layer "meta-rdk-oem-OEM-X-SOC-Y" means this layer shall be able to build any devices manufactured by OEM "X" with all variants of SoC "Y" like Y-1,Y-2 etc
The device (machine) configuration file shall include corresponding include (.inc) file to get machine configuration details.
Adding the Machine Configuration File
To add a machine configuration, you need to add a .conf file with details of the device being added to the conf/machine/ file.
The most important variables to set in this file are as follows:
- TARGET_ARCH (e.g. "arm")
- PREFERRED_PROVIDER_virtual/kernel
- MACHINE_FEATURES (e.g. "apm screen wifi")
You might also need these variables:
- KERNEL_IMAGETYPE (e.g. "zImage")
- IMAGE_FSTYPES (e.g. "tar.gz jffs2")
The default configuration are defined in meta-rdk/conf/distro/rdk.conf and it should be overwritten by the machine specific conf file.
For example, meta-rdk-oem-<>/meta-<>/conf/machine/include/<>.inc
- PREFERRED_PROVIDER_virtual/iarmmgrs-hal = "iarmmgrs-hal-broadcom"
- PREFERRED_PROVIDER_virtual/closedcaption-hal = "closedcaption-hal-broadcom"
Adding a Kernel for the Machine
The OpenEmbedded build system needs to be able to build a kernel for the machine. We need to either create a new kernel recipe for this machine, or extend an existing recipe. There are several kernel examples in the Source Directory at meta/recipes-kernel/linux that can be used as references.
If you are creating a new recipe, following steps need to be done:
- setting up a SRC_URI.
- Specify any necessary patches
- create a configure task that configures the unpacked kernel with a defconfig.
If you are extending an existing kernel, it is usually a matter of adding a suitable defconfig file. The file needs to be added into a location similar to defconfig files used for other machines in a given kernel.
A possible way to do this is by listing the file in the SRC_URI and adding the machine to the expression in COMPATIBLE_MACHINE:
- COMPATIBLE_MACHINE = '(qemux86|qemumips)'
Adding recipes for SoC/OEM
The following kind of recipes can be added to SoC/OEM layer. The recipes shall be grouped as described in slide “BSP Reference Layer”
- recipes (.bb) to build Kernel
- recipes(.bb) to build SDK
- Kernel patches (SoC/OEM specific - if any)
- SDK patches (SoC/OEM specific - if any)
- Any SoC/OEM specific scripts or files which need to be installed in RFS
Creating packages for building images
Create a custom package-group for the SoC/OEM which shall list all the recipes that are required for this image. For example, for the hybrid box the following recipe can be appended to the mediaserver package group.
- meta-rdk-soc-broadcom/meta-brcm/recipes-core/packagegroups/packagegroup-rdk-mediaserver.bbappend :
RDEPENDS_packagegroup-rdk-generic-mediaserver += "\
gstqamtunersrc-brcm \
"
Create a custom image for generating RFS for required SoC/OEM. For example,
- meta-rdk-<soc>/recipes-core/images/<soc>-hybrid-image.bb
IMAGE_INSTALL += "\
packagegroup-rdk-baserootfs \
packagegroup-rdk-<soc/oem specific packages> \
"