Skip to content

Build basic YOCTO image for RaspberryPi

Dan Walkes edited this page May 6, 2023 · 2 revisions

Overview

  • This page describes how to build basic Yocto image for RaspberryPi.
  • A working example for the same can be found at this pull request

Implementation Steps

  1. Start by adding Yocto base from our assignment repo :

This specifies the base repository at https://github.com/cu-ecen-5013/yocto-assignments-base.git

git remote add yocto-assignments-base https://github.com/cu-ecen-5013/yocto-assignments-base.git
  1. fetch basic code from the base.
git fetch yocto-assignments-base
  1. make your master branch match the master branch of yocto-assignments-base
git merge yocto-assignments-base/master
  1. This command clones the assignment-autotest submodule and nested git repositories. (not compulsory if not planning to use existing testcases)
git submodule update --init --recursive
  1. Install all required packages in ubuntu to establish Yocto environment.
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
>      build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
>      xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
>      pylint3 xterm
  1. Add meta-raspberrypi(for raspberrypi machine), meta-openembedded(for meta-python and meta-networking - required for WiFi) and poky.
git submodule add https://git.yoctoproject.org/git/meta-raspberrypi meta-raspberrypi
git submodule add https://git.openembedded.org/meta-openembedded meta-openembedded

you can checkout specific poky branch as per your project requirements.

git submodule add git://git.yoctoproject.org/poky poky 
  1. Edit build.sh to specify image type to be generated, packages to be added to an image, add required meta layers etc. This all specifications will be added to conf/local.conf.

  2. Build an image.

./build.sh

build.sh execution will take several hours. This will execute below command internally after updating local.conf.

bitbake core-image-base

This bitbake execution should show meta-raspberrypi layer or any new layer added in Build configuration as below:

Once execution completes without any issue, it will create an image at build/tmp/deploy/images/<machine_name>/<image_type_specified> depending on the type specified in build.sh file.

  1. Flash this image on SD card and bring up RaspberryPi with the image flashed on SD card.

Use any imager software for this. Example:Raspberry Pi Imager You may also use the dd command.

Output

RPi booting with Yocto Image

Login Prompt

Once RaspberryPi booting completes, one should get above login prompt. Login with root as login id. Password is not required.