Build a Raspberry Pi 2 Minimal Image with The Yocto Project

The Yocto Project is a build system that allows developers to make custom Linux distributions matching their exact needs. I’ve already shown how to build a 12MB Compressed image for the Raspberry Pi with Yocto, but the Raspberry Pi 2 has recently been added to the project, so I’ve tried to build it too in a machine running Ubuntu 14.04.

Raspberry_Pi_2_Yocto_ProjectI’ll use poky since it’s the default, but you could also build the system for Angstrom or without distributions (OpenEmbedded Core only). The steps to get the code is just the same as for the Raspberry Pi:

You just need to checkout master, and not any branch (like dizzy) since R-Pi 2 is not yet supported in any release. Initialize some environment variables and the build directory:

Now edit conf/local.conf with vim or nano to set the machine to raspberrypi2 instead of qemux86:

There are more Raspberry Pi specific option in the README for setting the GPU memory, overclocking, adding VC-1 or/and MPEG-2 licenses, and so on.

You also need to add the path to meta-raspberrypi in conf/bblayers file, so that it looks like:


Two minimal images are available: rpi-basic-image and rpi-hwup-image. I’ve built rpi-basic-image, which adds ssh-server-dropbear (for ssh server support) and splash (for the splash screen).

This will take a while, possibly over one or more hours, and upon completion the log shown in the terminal windows should look similar to:

The step “0: bcm2835-bootfiles-20150206-r3 do_fetch (pid 25484)” may take a long time as it’s cloning a few gigabytes of data for the firmware stored in GitHub. Just be patient, this step took several hours on my machine.

You can now flash the image to a micro SD card with:


Where you need to replace X with the letter of your SD card, which you can check with lsblk. Alternatively, you could also flash the image with Win32DiskImager in Windows. Here’s the compiled image for your reference: rpi-basic-image-raspberrypi2-20150227091441.rootfs.rpi-sdimg (104 MB). You’ll also need to use tools like gparted to expand the ext-4 partition to make use of all the space on your micro SD card.

You’d then just have to insert the micro SD card into your Raspberry Pi 2, boot, and login as root without password. I have not tried, since I don’t have a Raspberry Pi 2 yet.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

Radxa Orion O6 Armv9 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
40 Comments
oldest
newest
Boardcon CM3588 Rockchip RK3588 System-on-Module designed for AI and IoT applications