Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

source oe-init-build-env

create: bitbake-layers create-layer meta-<layer_name>

add: bitbake-layers add-layer ../meta-<layer_name>

show: bitbake-layers show-layers

It is possible to customize existing meta layers by creating an own meta layer with bitbake append files. In this description the meta layer meta-altera for Intel FPGA devices is used as reference.

For more informations about the operating system used and the sources and versions of yocto project or meta-altera layer, see Yocto KICKstart#Used source files.

Initialize the environment

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

Before starting to create a custom meta layer, navigate to the yocto poky directory and initialize the environment with the following commands:

Code Block
languagebash
themeMidnight
linenumberstrue
cd <path_to_yocto>/poky
source oe-init-build-env
cd ..


Download required sources

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

Since the created meta-custom layer should depend on meta-altera, these sources files must be downloaded and added to the yocto project.

  1. Navigate to yocto poky directory and download meta-altera layer:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    cd <path_to_yocto>/poky
    git clone -b dunfell https://github.com/kraj/meta-altera.git


  2. Add meta-altera to yocto project with:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    bitbake-layers add-layer ./meta-altera


Create custom meta layer

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

In this example, the created layer is named meta-custom. If you want to use a different name, just replace "custom".

  1. Create own layer "meta-

...

  1. custom" with:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    bitbake-layers create-layer ./meta-custom


  2. The created layer contains a sample recipes folder, that can be removed:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    rm -rf ./meta-custom/recipes-example


  3. Make meta-custom dependent on meta-altera:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    sed -i '/LAYERDEPENDS_meta-custom/s/core/meta-altera/g' meta-custom/conf/layer.conf 


  4. Add the meta-custom layer to the yocto project with:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    bitbake-layers add-layer ./meta-custom


Add required parameters to local.conf

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

  1. First the variable "MACHINE" must be redefined in the local.conf file. Several machines are defined in the meta-altera layer (see meta-altera/conf/machine for more information). In this example, the machine 'cyclone5' is used.
    Remove the default value and add 'cyclone5':

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    sed -i '/^MACHINE/s/MACHINE/#MACHINE/g' build/conf/local.conf
    echo -e '\nMACHINE = "cyclone5"' >> build/conf/local.conf


  2. For the linux kernel in the meta-altera layer it's required to define a the preferred provider and version in local.conf (see meta-altera/recipes-kernel/linux for other linux kernel versions):

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    echo -e '\nPREFERRED_PROVIDER_virtual/kernel = "linux-altera-lts"' >> build/conf/local.conf
    echo -e 'PREFERRED_VERSION_linux-altera-lts = "5.4%"' >> build/conf/local.conf
    


  3. Set the preferred u-boot version for meta-altera in local.conf (see meta-altera/recipes-bsp/u-boot for other u-boot versions):

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    echo -e '\nPREFERRED_VERSION_u-boot-socfpga = "v2021.04%"' >> build/conf/local.conf

...


Configure custom meta layer with devtool

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

Configure linux kernel

###with devtool

Set up the build environment to modify the source for an existing recipe:

devtool modify linux-altera-lts -O -s

Launch menuconfig, make changes to configuration and exit and save your config:

devtool menuconfig linux-altera-lts

devtool update-recipe linux-altera-lts -a ${PWD}/../meta-custom -O

create .bbappend file → file name must be the same as original .bb recipe file but with with .bbappend ending

gedit /meta-custom/recipes-kernel/linux/linux-altera-lts_5.4.bbappend

add following content to this file:

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

Configure u-boot

###with devtool

für meta-altera müssen folgende variablen in build/conf/local.conf eingefügt werden (wird nur für die konfiguration via menuconfig gebraucht, muss danach entfernt werden):

UBOOT_MACHINE=" socfpga_cyclone5_defconfig" → welche für die ausgewählte MACHINE benutzt wird steht in meta-altera/recipes-bsp/u-boot/u-boot-socfpga.inc

UBOOT_CONFIG = ""

Set up the build environment to modify the source for an existing recipe:

devtool modify u-boot-socfpga -O -s

Launch menuconfig, make changes to configuration and exit and save your config:

devtool menuconfig u-boot-socfpga

devtool update-recipe u-boot-socfpga -a ${PWD}/../meta-custom -O

folgende variablen können wieder entfernt werden, nachdem beenden der konfigration von u-boot:

UBOOT_MACHINE=" socfpga_cyclone5_defconfig" → welche für die ausgewählte MACHINE benutzt wird steht in meta-altera/recipes-bsp/u-boot/u-boot-socfpga.inc unter UBOOT_CONFIG[...]=...

UBOOT_CONFIG = ""

checkout other branch

...


Create workspace

The following command creates the workspace directory and adds it to bblayers.conf:

Code Block
languagebash
themeMidnight
linenumberstrue
devtool create-workspace


Configure u-boot

To modify the default configuration and create patches of u-boot do following steps:

  1. It is not possible to call menuconfig if UBOOT_CONFIG is defined. But UBOOT_CONFIG is needed to assign a defconfig file to UBOOT_MACHINE. UBOOT_MACHINE must therefore be defined manually. The variable UBOOT_CONFIG is predefined in the machine configuration file for cyclone5 with the value 'cyclone5-socdk' (see meta-altera/conf/machine/cyclone5.conf). The associated defconfig file is therefore socfpga_cylcone5_defconfig (see meta-altera/recipes-bsp/u-boot/u-boot-socfpga-common.inc). Accordingly these variables must be defined in local.conf:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    echo -e '\nUBOOT_MACHINE = "socfpga_cyclone5_defconfig"' >> build/conf/local.conf
    echo -e 'UBOOT_CONFIG = ""' >> build/conf/local.conf


  2. Run following command to prepare the workspace and fetch and unpack the sources:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    devtool modify u-boot-socfpga -O


  3. Make changes to u-boot configuration
    1. Launch menuconfig with following command and make your changes:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      devtool menuconfig u-boot-socfpga


    2. Exit and save your configuration. devtool-fragment.cfg will be created automatically.
  4. Make changes to the u-boot source files
    1. Navigate to u-boot-socfpga in the workspace and add, modify or remove files:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      cd build/workspace/sources/u-boot-socfpga


    2. Run a build to test your changes:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      devtool build u-boot-socfpga


    3. Add the changes made with:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      git add .


    4. Commit your changes and add a short message. The message is used to name the patch file:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      git commit -m "<message>"


    5. If you want to generate more patches, repeat step a - d, otherwise navigate back to the poky directory:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      cd <path_to_yocto>/poky


  5. Add the devtool-fragment.cfg and the patches to the meta-custom layer with:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    devtool update-recipe u-boot-socfpga -a ./meta-custom -O


  6. Remove the UBOOT_CONFIG and UBOOT_MACHINE variables from local.conf if you use the default defconfig file for the MACHINE 'cyclone5':

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    sed -i '/UBOOT_MACHINE = "socfpga_cyclone5_defconfig"/d' build/conf/local.conf
    sed -i '/UBOOT_CONFIG = ""/d' build/conf/local.conf


Configure linux kernel

To modify the default configuration and create patches of linux kernel do following steps:

  1. Run following command to prepare the workspace and fetch and unpack the sources:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    devtool modify linux-altera-lts -O


  2. Launch menuconfig with following command and make your changes, exit and save your configuration:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    devtool menuconfig linux-altera-lts


  3. Make changes to the linux-altera-lts configuration
    1. Launch menuconfig with following command and make your changes:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      devtool menuconfig linux-altera-lts


    2. Exit and save your configuration. devtool-fragment.cfg will be created automatically.
  4. Make changes to u-boot source files
    1. Navigate to linux-altera-lts in the workspace and add, modify or remove files:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      cd build/workspace/sources/linux-altera-lts


    2. Run a build to test your changes:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      devtool build linux-altera-lts


    3. Add the changes made with:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      git add .


    4. Commit your changes and add a short message. The message is used to name the patch file:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      git commit -m "<message>"


    5. If you want to generate more patches, repeat step a - d, otherwise navigate back to the poky directory:

      Code Block
      languagebash
      themeMidnight
      linenumberstrue
      cd <path_to_yocto>/poky


  5. Add the devtool-fragment.cfg and the patches to the meta-custom layer with:

    Code Block
    languagebash
    themeMidnight
    linenumberstrue
    devtool update-recipe linux-altera-lts -a ./meta-custom -O


Remove workspace

Remove the workspace from bblayers.conf and delete the workspace folder:

Code Block
languagebash
themeMidnight
linenumberstrue
bitbake-layers remove-layer workspace
rm -rf build/workspace

Add custom files to custom meta layer

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

References

Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue

  1. Linux Kernel Development Manual
  2. Reference Manual#devtool Quick Reference
  3. u-boot-socfpga/doc/README.socfpga
  4. Patching_the_source_for_a_recipe


Scroll Only


HTML
<style>
.wiki-content .columnLayout .cell.aside {
width: 0%;
}</style>



Scroll pdf ignore


Custom_fix_page_content

Table of contents

Table of Contents
outlinetrue