Getting started with Yocto on Wandboard

 

Getting started with Yocto on Wandboard

Here are the steps on how to get started with the Yocto Project based on the Freescale Community BSP for Wandboard.

Contents

[show

Requirements hardware and software

  • Linux-based host system to use for building Linux
  • Wandboard Solo, Dual, and Quad support
  • Null-modem serial (RS-232) cable use for the serial console
  • 5V power supply to power the Wandboard
  • microSD card to store the bootloader, kernel, and filesystem as Wandboard has no on-board flash
  • lots of disk space (depending on image to build about 70 GB)

Setup Yocto Build System

Steps for a first-time build

Here are the steps to building an image for Wandboard with Yocto for the first time:

  1. Install required packages for your development system
  2. Download and install Google's repo utility
  3. Create the main BSP install directory and, using repo, download all of the metadata for the BSP layers.
  4. Build an image using bitbake
  5. Locate the built image and write it to SD card
Install Required Host Packages

Install the required packages for your host development system. The Yocto Project documentation has a listing of install commands for many different hosts (Ubuntu, CentOS, etc.).

Required Packages for the Host Development System

Download and Install Google's repo utility

The BSP is based on the Yocto Project, which consists of a number of applicable metadata 'layers'. These are managed by the repo utility.

$: mkdir ~/bin
$: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$: chmod a+x ~/bin/repo
Create the BSP directory download all of the metadata for the BSP layers
$: PATH=${PATH}:~/bin
$: mkdir fsl-community-bsp
$: cd fsl-community-bsp
Initialize the repositories

The next step is to initialize the repositories. This establishes which branch of the repository will be used for your development. In general, you have two options. The master branch is the current development branch, and the current stable branch is "dizzy". Both include support for all three variants of Wandboard (Solo, Dual, and Quad), and are based on Freescale's 3.10.17_1.0.0 SDK, using the 3.10.17 kernel.

Stable branch
$: repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b dizzy
Development branch, Including latest fixes (and bugs)
$: repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b master
Download all of the metadata for the BSP layers
$: repo sync

Once this has completed, you should have all of the metadata source in fsl-community-bsp.

Note: The master branch is a development branch, not a stable branch. It is constantly changing with code updates, the adding of new features, and so forth.

Additionally, Wandboard Quad support was not in the Poky 1.4 'dylan' branch, as Wandboard Quad was not available at the time Dylan was released. If you are using Wandboard Quad, you will need to use at least the dora branch (Poky 1.5) or later.

Setup environment and build an image

To start a build, first set the MACHINE shell environment variable to set the machine. These are:

Wandboard Machines in Yocto

Board Type
MACHINE=

Wandboard Solo
wandboard-solo

Wandboard Dual
wandboard-dual

Wandboard Quad
wandboard-quad

For example, if you have a Wandboard Dual, then set MACHINE to "wandboard-dual".

$: export MACHINE=wandboard-dual

Run the setup-environment script. This is a helper script which sets up the environment and creates a build directory for you. The first time you run this, you will be asked to accept the Freescale end user license agreement (EULA).

$: . ./setup-environment build

Run bitbake with core-image-minimal as its argument. This will create a small image and should have the shortest possible build time. Note: all of the sources are downloaded from the internet and built from scratch. This includes the toolchain (gcc) and all of the native utilities, so building an image for the first time could take a few hours, depending on the performance of your host machine.

$: bitbake core-image-minimal
Locating the images and installing to a microSD card

Once the image is built successfully, there are several target images that are built by default. One of these is an image suitable for loading directly into an SD card. It contains all of the required binaries (bootloader, kernel, filesystem) in a preformatted binary image.

You can find the image at:

 build/tmp/deploy/images/<MACHINE>/core-image-minimal-<MACHINE>.sdcard

The .sdcard image can be directly copied to an SD card with the dd command:

$ sudo dd if=tmp/deploy/images/<MACHINE>/core-image-minimal-<MACHINE>.sdcard of=/dev/sd<N> bs=1M

NOTE: <MACHINE> in the above corresponds to the MACHINE name provided to bitbake (e.g. wandboard-solo, wandboard-dual, wandboard-quad). "N" in the above command is the letter assigned to the SD card. This will vary depending on your host machine configuration.

Running the image on Wandboard

As this is just a console image, you will need a serial terminal program such as minicom in order to interact with the board and run commands. Simply plug the microSD card into the slot on the Wandboard module [MDS1] and either apply power, or reset using the pushbutton switch [RESET1] on the baseboard. You should immediately see log messages in the serial terminal. When complete, you should get a login prompt:

Poky Next (Yocto Project Reference Distro) 1.4+snapshot-20130809 wandboard-dual
wandboard-dual login:

The default login username is 'root' and there is no password.

Other interesting images

The image core-image-minimal builds relatively quickly due to its small size. It is a good image to test to see if your board works. There are other images that you can also try, but can take a good deal longer to build.

Image
Description

core-image-base
Basic image with kernel modules and other features

core-image-x11
Basic image with X11 support

fsl-image-test
Image containing test utilities and graphics libraries

Qt5

Building Qt5 using yocto on Wandboard has instructions for building Qt5 on the Wandboard and a cross Qt5 version in your host machine to develop Qt5 applications and deploy them directly to your Wandboard using QtCreator.

原文地址:https://www.cnblogs.com/yechuang/p/4562633.html