how to add custom board using Yocto

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to add custom board using Yocto

18,260 Views
Colin_MTData
Contributor III

Hi,

  We have our own hardware closely matching the imx28evk (but not exactly).  In have built systems for it using LTIB but we want to upgrade to Yocto and to a recent kernel.

I have installed Yocto and built a successfully target for the imx28evk using Yocto.

Now I want to understand how to build for our target hardware.

The question was asked here: How to create a custom board in Yocto ? but the replies only go as far as getting the new empty layer created.

Where do I go to get a clear explanation of how to use layers and recipes to replace one board with another?  To add a layer to get from 'imx28evk' to 'myboard"?

I need to change the usage of the pins of the chip, drop the LCD and drop the nand flash.  Part of this is kernel configuration and part is a new device tree file.

I assume I will need a new 'defconfig' and a new myboard.dts but where do they go?   Somewhere under  sources/meta-myboard/.. I assume?  and where do I copy them from in order to edit them for our hardware?

The .dts files seem to be a sort of 'include' chain. Can I make just a few changes in myboard.dts and then refer the to remainder of the chain?

Having used ". setup-environment mybuild" to create a working space, it will then include conf/local.conf and after building many others including conf/bblayers.conf.

I assume I modify this conf/bblayers.conf to add my new layer.   How is this change then captured?   If the sources are in git repositories under 'sources/...'  how do other developers in the company get the changes that I've made in my local mybuild/conf ? It's not part of a git repository.

While I'm here, another question is: What role does 'repo' play in all this.  Is this new board actually a new 'project'?  How do I add projects to repo?  Does it capture the changes I've made in mybuild/conf/... ?

Regards,

Colin Moloney

4 Replies

6,025 Views
frankba
Contributor III

Hi,

you probably already found a solution. For the sake of completeness: Here is my little repo for another iMX6 board

FrankBau/meta-marsboard-bsp · GitHub

which explains how to add a new board in the wiki: Yocto built Linux image · FrankBau/meta-marsboard-bsp Wiki · GitHub

hth

Frank

6,025 Views
marcin99
Contributor II

Colin, I'm having a similar but simpler issue. All I'm trying to do is to swap the touchscreen driver in the image built by yocto.

I used menuconfig to reconfigure touchscreen driver modules.

/wandboard-bsp-dizzy/build$ bitbake -c menuconfig linux-wandboard

Then by using the .config file made by the above process I modified the defconfig in:

/wandboard-bsp-dizzy/sources/meta-fsl-arm-extra/recipes-kernel/linux/linux-wandboard-3.10.17

then bitbaked the full project.

(not sure if this is correct way... probably patch would be preferred, but it works. The driver module does not load on boot but I can get it with modprobe, these changes pushed through)

So now I am stuck because to make it work I need to patch the dtsi file which specifies the touchscreen I2C bus and GPIO. I know what to modify but I don't know how. the dtsi files are located only in build directory and I'm not sure if this location can be patched.

I'm assuming the patch files should all be in the same dir as recipes which are in source dir. So how do I save patch there which gets applied to a dtsi file buried deep in the build directory.

I'm sorry if this is something basic.. but I've searched for a long time... maybe I'm missing something basic.

Maybe Freescale guys could help

0 Kudos
Reply

6,025 Views
gusarambula
NXP TechSupport
NXP TechSupport

Layers serve to compartmentalize the specific code that each vendor or application would require whereas the machine definition set the variables required for each specific target. You would definitely want to create a new layer and add your machine information there.

The machine information is contained on the conf/machine folder inside each layer. (Not all layers may contain machine definitions).

I would recommend looking at the available machine configuration files and choosing the one that is closer to your own custom board as a starting point. You may find the conf files for our boards on the Community BSP GitHub below.

https://github.com/Freescale/meta-fsl-arm/tree/master/conf/machine

The machine conf files point out to the device tree required for the specific board. You may edit a current device tree and call it on your own machine definition.

Repo is a tool built on top of git to manage several git repositories and it’s an executable Python script. Unless you add your layer to a git repository your layer would remain local. You would need to create a git with your layer and machine information and add this repository to repo. Other developers would then be able to sync with this repository and retrieve your layer.

Please do keep in mind that the local.conf file is created by the environment setup script and it is not downloaded from any repository buy rather created or edited when initializing the build directory.

You may find the Yocto Reference Manual useful as well (link below)! Although with Yocto is often recommended to look for a similar layer/machine as reference and work from there.

http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html

6,025 Views
Colin_MTData
Contributor III

Thanks gusarambula,

  I have progressed a little.  My layer is included in the layers seen by bitbake.  The first thing I want to change is the device tree.  Searching the internet yields many different suggestions.

When I try "bitbake core-image-minimal" it fail trying to  build mtd4000.dtb: No rule to  build target.

I can't work out where I'm supposed to put the dts files and how to tell the system where they are.

If the .dtb has to be in the list for the MXS:  dtb-$(CONFIG_ARCH_MXS) += mtd4000.dtb, how do I do that in a layer?  The Makefile is in

    "tmp/work/mtd4000-poky-linux-gnueabi/linux-fslc/3.14+gitAUTOINC+00e472111a-r0/git/arch/arm/boot/dts/Makefile"

Can anyone untangle the mess below and explain where to put the .dts/.dtsi files?

Which path is correct: linux-fslc/3.14/git/...  or linux-fslc/3.14/image/usr/...  or some other path?

Also, I will need to get the "defconfig" right for this new machine.  Where does it go and how to tell Yocto/bitbake ?

Colin Moloney

-----------

My build workspace is called "mdtata", my layer is "meta-mtdata" and my new machine is "mtd4000".  My workspace is like:

.../help

.../mtdata

.../README

.../README.cm

.../.repo

.../setup-environment.../download

.../sources/base

.../sources/meta-fsl-arm

.../sources/meta-fsl-arm-extra

.../sources/meta-fsl-demos

.../sources/meta-openembedded

.../sources/poky

and my layer

.../sources/meta-mtdata

.../sources/meta-mtdata/recipes-kernel

.../sources/meta-mtdata/recipes-kernel/linux

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc.inc

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc_3.14.bbappend

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch/arm

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch/arm/boot

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch/arm/boot/dts

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch/arm/boot/dts/mtd4000.dtsi

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch/arm/boot/dts/mtd4000-pinfunc.h

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/git/arch/arm/boot/dts/mtd4000.dts

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch/arm

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch/arm/boot

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch/arm/boot/dts

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch/arm/boot/dts/mtd4000.dtsi

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch/arm/boot/dts/mtd4000-pinfunc.h

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/3.14/image/usr/src/kernel/arch/arm/boot/dts/mtd4000.dts

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/defconfig

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/mtd4000

.../sources/meta-mtdata/recipes-kernel/linux/linux-fslc/mtd4000/defconfig

.../sources/meta-mtdata/conf

.../sources/meta-mtdata/conf/machine

.../sources/meta-mtdata/conf/machine/mtd4000.conf

.../sources/meta-mtdata/conf/layer.conf

.../sources/meta-mtdata/README

and build directory:

.../mtdata/bitbake.lock

.../mtdata/cache

.../mtdata/state-cache

.../mtdata/conf

.../mtdata/conf/local.conf

.../mtdata/conf/templateconf.cfg

.../mtdata/conf/sanity_info

.../mtdata/conf/bblayers.conf

.../mtdata/tmp

My machine config mtd4000.conf has:

    include conf/machine/include/mxs-base.inc

    PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"

    PREFERRED_VERSION_linux-fslc = "3.14%"

    IMXBOOTLETS_MACHINE = "MTD4000"

    KERNEL_IMAGETYPE = "uImage"

and several attempts at the device tree:

    #KERNEL_DEVICETREE = "imx28-evk.dtb"   -- original freescale

    KERNEL_DEVICETREE = "mtd4000.dtb"

    KERNEL_DEVICETREE = "${S}/git/arch/arm/boot/dts/mtd4000.dtb"

    KERNEL_DEVICETREE = "${WORKDIR}/mtd4000.dts"

    KERNEL_DEVICETREE = "${WORKDIR}/mtd4000"

The local.conf has:

    MACHINE ??= "mtd4000"

The layer "linux-fslc.inc" is:

    LICENSE = "GPLv2"

    LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"

    DEPENDS += "lzop-native bc-native"

    PROVIDES = "virtual/kernel linux-mainline"

    inherit kernel

    require recipes-kernel/linux/linux-imx.inc

    require recipes-kernel/linux/linux-dtb.inc

    SRCBRANCH ?= ""

    SRC_URI = "git://github.com/Freescale/linux-mainline.git;branch=${SRCBRANCH} \

               file://defconfig"

    LOCALVERSION = "-fslc"

The layer "linux-fslc_3.14.bbappend" is:

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

    #FILESEXTRAPATHS_prepend := "${THISDIR}:${THISDIR}/mxs:"

    #FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:${THISDIR}/mxs:${THISDIR}/${PN}/${PV}/git/arch/arm/boot/dts:"

    COMPATIBLE_MACHINE_mtd4000 = "mtd4000"      # Should this be appended or assigned ?

    KMACHINE_mtd4000 = "mtd4000"

0 Kudos
Reply