Building kernel and filesystem using Yocto for Raspberry Pi / Creating Embedded Linux for RPi using Yocto

For proceeding to this post: Setting up ubuntu development machine for Yocto is a prerequisite and make sure you have all those packages installed in ubuntu.

Now, lets clone the poky and raspberry Pi metadata as,

 $ mkdir workspace
 $ cd workspace
 $ git clone git://git.yoctoproject.org/poky
 $ cd poky
 $ git checkout pyro
 $ cd workspace
 $ git clone git://git.yoctoproject.org/meta-raspberrypi
 $ cd meta-raspberrypi
 $ git checkout pyro

Now, we will have to initialize the environment variables to start compilation for kernel and filesystem as,

 $ cd workspace/poky
 $ source oe-init-build-env

Above command will initialize environment variables and create build directory and will go inside this build directory. The tree structure of the newly created “build” directory is like,

$ tree build/
build/
└── conf
    ├── bblayers.conf
    ├── local.conf
    └── templateconf.cfg

1 directory, 3 files

Now, we need to change bblayers.conf to add the path of meta-raspberrypi layer, hence open this file and append the path of meta-raspberrypi layer like below,

 $ vim conf/bblayers.conf
BBLAYERS ?= " \
  /home/myuser/workspace/poky/meta \
  /home/myuser/workspace/poky \
  /home/myuser/workspace/poky/meta-yocto-bsp \
  /home/myuser/workspace/meta-raspberrypi \
  "

Next, we need to edit “conf/local.conf” to add Raspberry Pi as machine,

 vim conf/local.conf

and append following string,

 MACHINE = "raspberrypi3"

Now, lets start the compilation which will create the complete binary images required to boot Raspberry Pi,

 $ bitbake core-image-minimal
Tags:

Leave a Reply