https://www.linux.com/learn/tutorials/588534:embedded-linux-development-in-6-easy-steps
Last month I introduced the Yocto Project here on Linux.com with the catchy title Getting Started with Embedded Linux and the Yocto Project. But despite the title, there was very little in that post that described just how to get started. I'm here today to rectify that situation.
The best thing to do is to rely on the Yocto Project documentation, starting with the Yocto Project Quick Start Guide. What follows below is a quick distillation of the information in the Quick Start Guide, but it is highly recommended to read the whole document before beginning. Of course, this is only the tip of the iceberg for embedded Linux development.
Last month I introduced the Yocto Project here on Linux.com with the catchy title Getting Started with Embedded Linux and the Yocto Project. But despite the title, there was very little in that post that described just how to get started. I'm here today to rectify that situation.
The best thing to do is to rely on the Yocto Project documentation, starting with the Yocto Project Quick Start Guide. What follows below is a quick distillation of the information in the Quick Start Guide, but it is highly recommended to read the whole document before beginning. Of course, this is only the tip of the iceberg for embedded Linux development.
-
Use a Linux desktop system as a host. The Yocto Project works best
with a major desktop distro like OpenSUSE, Fedora, CentOS, or Ubuntu,
but (theoretically) can be made to work with any Linux system. Make sure
to install all the necessary packages from the distro's repository -
see the Quick Start Guide for a list (scroll down to The Packages).
-
Download the Yocto Project tools by grabbing the
gzip
-edtar
file for the latest release, Poky 7.0 "Denzil", from the Yocto Project website download page, or from the command line as shown:
wget http://downloads.yoctoproject.org/releases/yocto/yocto-1.2/poky-denzil-7.0.tar.bz2; tar xvjf poky-denzil-7.0.tar.bz2
git
:
git -b denzil git://git.yoctoproject.org/poky.git
-
Create a build directory and set up your working environment correctly with a single command:
source poky/oe-init-build-env build
This command sets environment variables, creates and populates a working directory calledbuild
as a subdirectory of your current working directory, and makes this new location your working directory. You are all set to build now... almost.
-
Set up the main build configuration file
conf/local.conf
for your build. This is easier than it sounds. Simply edit that file and look for the following configuration lines to change or uncomment. Set threads to 2x the number of cores in your host system - for a quad-core host, for example, this number would be 8. This will greatly speed up your build by taking advantage of all available processor cores.
BB_NUMBER_THREADS = "threads"
PARALLEL_MAKE = "-j threads"
MACHINE ?= "qemux86"MACHINE
setting specifies a familiar 32-bit Intel architecture with a twist - it is set up automatically to use the QEMU hardware emulator to run your new image without requiring any hardware. Other supported values for this setting are shown inconf/local.conf
, includingqemuarm
as well as a number of hardware architectures.
-
Build your distro. Note: this can take a while, as BitBake needs to
download all the packages it needs for this build, even though we are
just using the minimal system. Depending on the speed of your network
connection, this can take between 1.5 and 4 hours. Subsequent builds
only take about an hour.
bitbake core-image-minimal
-
Time to see the results! Boot your new image in a QEMU emulator. After the bootloader messages go past, log in using
root
, no password needed.
runqemu qemux86
hob
in your build directory.) To see even more of this process in action, check out this video: Getting Started with the Yocto Project - New Developer Screencast Tutorial.
No comments:
Post a Comment