Yocto Build for Raspberry Pi 3B+

好文分享

I haven’t found others talked about Yocto Build for Raspberry Pi 3B+ using Yocto poky scarthgap. So I share my steps here.

My Environments

  • Ubuntu 22.04
  • Yocto Linux Version: Scarthgap (5.0.5)
  • Raspberry Pi 3B+

Minimal Build Host Environment require

Make sure your Build Host meets the following requirements:

  • At least 90 Gbytes of free disk space, though much more will help to run multiple builds and increase performance by reusing build artifacts.
  • At least 8 Gbytes of RAM, though a modern modern build host with as much RAM and as many CPU cores as possible is strongly recommended to maximize build performance.
  • Runs a supported Linux distribution (i.e. recent releases of Fedora, openSUSE, CentOS, Debian, or Ubuntu). For a list of Linux distributions that support the Yocto Project, see the Supported Linux Distributions section in the Yocto Project Reference Manual. For detailed information on preparing your build host, see the Preparing the Build Host section in the Yocto Project Development Tasks Manual.
    • Git 1.8.3.1 or greater
    • tar 1.28 or greater
    • Python 3.8.0 or greater.
    • gcc 8.0 or greater.
    • GNU make 4.0 or greater

Required Packages for the Build Host

$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1
$ sudo locale-gen en_US.UTF-8

Get Source Code

Using Git to Clone Poky

$ git clone git://git.yoctoproject.org/poky -b scarthgap

Adding Raspberrypi Layers

$ cd poky
$ git clone git://git.yoctoproject.org/meta-raspberrypi.git -b scarthgap
$ git clone git://git.openembedded.org/meta-openembedded -b scarthgap

Building Image

Initialize the Build Environment

$ source oe-init-build-env

Change the Configuration to Build Respberry pi 3

$ vi conf/bblayers.conf
# change the machine
MACHINE ??= "raspberrypi3"
# Add extra setting for UART setting, python 
ENABLE_UART= "1"
IMAGE_INSTALL:append = " python3 python3-pip rpi-gpio raspi-gpio"
#For the compiler error :ERROR: Nothing RPROVIDES 'linux-firmware-rpidistro-bcm43455
LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"
$ vi conf/bblayers.conf
# Add the layers for Raspberrypi 
BBLAYERS ?= " \
  /home/rita/fun/yocto/poky/meta \
  /home/rita/fun/yocto/poky/meta-poky \
  /home/rita/fun/yocto/poky/meta-yocto-bsp \
  /home/rita/fun/yocto/poky/meta-raspberrypi \
  /home/rita/fun/yocto/poky/meta-openembedded/meta-oe \
  /home/rita/fun/yocto/poky/meta-openembedded/meta-python \
  "

Start the Build

$ bitbake core-image-base
Yocto Build for Raspberry Pi 3

Write Image to SD Card

$ cd tmp/deploy/images/
$ sudo apt-get install bmaptool
$ sudo bmaptool copy core-image-base-raspberrypi3.rootfs.wic.bz2 /dev/sdb

Boot up

Yocto Build for Raspberry Pi 3

login: root, no password

Reference:

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料