This is a really handy link that is in the Quickstarts:
https://layers.openembedded.org/layerindex/branch/krogoth/layers/
http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#understanding-and-creating-layers
http://www.yoctoproject.org/docs/2.2/kernel-dev/kernel-dev.html#modifying-an-existing-recipe
https://stash.phytec.com/projects/KSP5015/repos/meta-density-vega/browse?at=refs%2Fheads%2Fkrogoth
http://www.yoctoproject.org/docs/2.2/toaster-manual/toaster-manual.html
Summary
i.MX6 PD16.1.0
Yocto 2.1.2. (Krogoth)
Customizing Linux to fit a specific application is
- The $YOCTO_DIR/sources directory contains the meta layers
- Check OpenEmbedded for pre made layers
Create your layer
- Download the standard BSP according to the Quickstart Guide for the product you are developing with
- Source the build environment as stated in the Quickstart manual
- Create a development directory at the root of your Yocto directory
- mkdir $YOCTO_DIR/development
- <TODO>: need to set permissions
- mkdir $YOCTO_DIR/development
Create your meta layer and move it to the development directory with the following commands:
cd $YOCTO_DIR/build yocto-layer create custom mv meta-custom/ ../development/
- Create a git repo and add your layer
cd $YOCTO_DIR/development/meta-custom/ git init && git add . && git commit -s
Configuring your layer
Set the layer priority to override the meta-phytec recipes and configuration
- Change priority to +1 of the meta-phytec layer priority
- You'll need to know the priority of the meta-phytec layer first. Use the command below to obtain the meta-phytec layer priority:
cat $YOCTO_DIR/sources/meta-phytec/conf/layer.conf | grep PRIORITY
- Use your favorite text editor to set your layer's priority to something greater than the priority of the meta-phytec layer
Create a machine configuration to describe your custom hardware
- create the machine directory
- mkdir $YOCTO_DIR/development/meta-custom/conf/machine
- copy the machine configuration that closest describes your hardware
- create the machine directory
Note here about how to find your machine configuration
cp $YOCTO_DIR/sources/meta-phytec/conf/machine/<standard machine config name> $YOCTO_DIR/sources/meta-custom/conf/machine/<your custom machine config name>
Append the standard kernel and bootloader recipes to add support for your custom machine
- Make a .bbappend file for your kernel recipe
- Create a recipes-kernel directory in the root of meta-custom
- see .....sources/meta-phytec/recipes-kernel/linux/linux_mainline_x.x.x-phyx.bb
- need to create a similar file in .....sources/meta-mycustomlayer/recipes-kernel/linux/ with a .bbappend filetype
- add machine name as a COMPATIBLE_MACHINE
- Make a .bbappend file for your kernel recipe
<TODO: add a picure of the *.bbappend recipe with just the COMPATIBLE_MACHINE assigned to the new machine config>
- Make a .bbappend file for your bootloader recipe
- see ....sources/meta-phytec/recipes-bsp/<bootloader>/something.bb
- need to create a similar file in .....sources/meta-mycustomlayer/recipes-bsp/<bootloader>/ with a .bbappend filetype
- add machine name as a COMPATIBLE_MACHINE
- see ....sources/meta-phytec/recipes-bsp/<bootloader>/something.bb
- Make a .bbappend file for your bootloader recipe
<TODO: add a picure of the *.bbappend recipe with just the COMPATIBLE_MACHINE assigned to the new machine config>
Customize your layer
- For developing a custom device tree, clone the linux source, make changes, commit, create a patch, and add the patch to your meta layer kernel recipe.
- Specify your custom device tree
- This is done throught the KERNEL_DEVICETREE variable in the machine configuration file
- Don't forget to add your custom device tree file to the Makefile in the device tree directory
- Specify your custom machine configuration
- This is done through the MACHINE variable in the local.conf file in the build directory (DO NOT append .conf!!!)
- Add new files and commit modifications to your git repo
- cd $YOCTO_DIR/sources/meta-custom
- git add . && git commit -s
- Push your git repo to your remote repo
- git push ....
Integrate your custom layer
- Using your favorite text editor, add your new layer to the bblayers.conf file (..../build/conf/bblayers.conf)
<TODO: add a picture of the bblayers.conf file, with custom layer appended>
Automating your build
- Copy your current manifest
- ls -l $YOCTO_DIR/.repo/manifest.xml
- Copy the *.xml file linked to manifest.xml and give it a unique name
- Add your layer information to the new manifest
- <remote fetch="<git repo URL that contains your layer source>" name="customlayer">
- <prjoect name="<your layer name here, ex. meta-custom>" path="sources/<your layer name here, ex. meta-custom>" remote="customlayer" revision="<tag name, commit ID, etc...>">