1. Overview

This document describes how to use Yocto Project to quickly build board-level images for the RockChip platform. Mainly describe the basic construction method of meta-rochip layer and Yocto Project.

The Yocto Project is an open source collaborative project focused on embedded Linux® operating system development that provides a flexible toolset and development environment that allows embedded device developers worldwide to share technologies, software stacks, configurations and tools for creating these customizations Best Practices for Linux Imaging Collaboration. For more information about the Yocto Project, please refer to the official Yocto Project website:www.yoctoproject.org/. The Yocto Project home page has the Yocto Project Reference Manual and the Yocto Project Overview and other related documents describe in detail how to build the system.

The Yocer Project support provided by firefly is as follows:

Version Board level support Maintenance
2.7.4 (warrior) RK3399 No longer maintained
3.4 (honister) RK3588 RK3588S RK3399 RK3399PRO RK356X PX30 Maintain

2. Introduction to Yocto Project Release layer

layer path priority(The higher the number, the higher the priority) describe
meta-oe meta-openembedded/meta-oe 6 contains a large amount of additional recipes
meta-python meta-openembedded/meta-python 7 Provide Python recipes
meta-qt5 meta-qt5 7 Provides QT5 recipes
meta-clang meta-clang 7 clang compiler
meta-rockchip meta-rockchip 9 Rockchip board level support available
meta meta 5 Contains the OpenEmbedded-Core metadata
meta-poky meta-poky 5 Holds the configuration for the Poky reference distribution
meta-yocto-bsp meta-yocto-bsp 5 Configuration for the Yocto Project reference hardware board support package.
meta-chromium meta-chromium 7 Provide chromium browser recipe

3. Get SDK

repo init --no-clone-bundle --repo-url https://gitlab.com/firefly-linux/git-repo.git -u https://gitlab.com/firefly-linux/manifests.git -b master -m yocto_release.xml
.repo/repo/repo sync -c

4. compile

4.1. Select core-image-minimal image

The Yocto project provides some images that can be used without layers. The following table lists currently supported build images and associated recipes.

Image name Target provided by layer
core-image-minimal A small image that only allows a device to boot Poky

4.2. Build image

4.3. Select board configuration file

There are many board-level configuration files under /build/conf, select the corresponding configuration file by generating local.conf soft link.

Take the firefly-rk3399 board as an example:

    # Go to yocto SDK
    cd build/conf

    # Select the configuration file and find the configuration file corresponding to the firefly-rk3399 board
    firefly-rk3399.conf进行软连接
    ln -fs rk3399/firefly-rk3399.conf local.conf

Note: Different boards have different configuration files, the above is just for reference

The process of building with the bitbake command needs to ensure that the network connection is normal. If it is a customer in inland China, you need to ensure that it can ping the external network

  • Enter the directory <path/to/yocto> and execute the following commands in sequence

      # Install the required environment packages
      # sudo apt install zstd
      source oe-init-build-env
      bitbake core-image-minimal
    
  • The above command is to compile the complete core-image-minimal recipes. If you want to compile some recipes separately, you can refer to the following:

      # kernel
      bitbake linux-rockchip
    
      # u-boot
      bitbake u-boot
    
      # rkmpp
      bitbake rockchip-mpp
    
      # rockchip-librga
      bitbake rockchip-librga
    
      # 参看更多编译对象
      bitbake -s
    

4.4. More bitbake options

Fundamentally, BitBake is a generic task execution engine that allows shell and Python tasks to be run efficiently and in parallel while working within complex inter-task dependency constraints. One of BitBake’s main users, OpenEmbedded, takes this core and builds embedded Linux software stacks using a task-oriented approach.For more detailed usage, please check《bitbake-user-manual》

    bitbake <target> <paramater>
    # e.g
    bitbake u-boot -c clean
    bitbake u-boot
Bitbake paramater Description
-c fetch Fetches if the downloads state is not marked as done
-c clean Removes all output files for a target
-c cleanall Removes all output files, shared state cache, and downloaded source files for a target
-c compile -f It is not recommended that the source code under the temporary directory is changed directly, but if it is, the Yocto Project might not rebuild it unless this option is used. Use this option to force a recompile after the image is deployed.
-c listtasks Lists all defined tasks for a target

5. Flash image

The compiled firmware is located in the directory <path/to/yocto>/build/tmp/deploy/<board>/, the files to be downloaded are .wic and update.img, and after entering the loader mode, execute the following commands :

$ sudo upgrade_tool wl 0 <IMAGE NAME>.wic
$ sudo upgrade_tool uf update.img

# The default core-image-minimal login account password is: root

If customers develop on Windows PC, they can also use RKdevtool to directly burn update.img