Transcript: from git checkout to meta-intel BSP

From Yocto Project
Revision as of 05:18, 5 April 2011 by Tzanussi (talk | contribs)
Jump to navigationJump to search

To build and run a meta-intel BSP, you need to check out a local copy of the poky repo, along with a local copy of the meta-intel repo somewhere inside the poky checkout e.g. see below (the example below uses the 'fishriver' BSP as an example. For other meta-intel BSPs, you can use the instructions in the same way - just substitute the BSP name you actually want to build below e.g. for the jasperforest BSP, substitute 'jasperforest', 'meta-jasperforest', etc.

NOTE: this transcript was from a build done on a Ubuntu 10.04 system. Please see the 'Yocto Project Quickstart' for the packages required to be installed on the host system for building [1]

First do the basic checkout of the Yocto sources:

trz@elmorro:/usr/local/src$ mkdir Yocto
trz@elmorro:/usr/local/src$ cd Yocto/
trz@elmorro:/usr/local/src/Yocto$ git init
Initialized empty Git repository in /usr/local/src/Yocto/.git/
trz@elmorro:/usr/local/src/Yocto$ git remote add poky git://git.pokylinux.org/poky.git
trz@elmorro:/usr/local/src/Yocto$ git remote update
Fetching poky
remote: Counting objects: 93654, done.
remote: Compressing objects: 100% (28485/28485), done.
remote: Total 93654 (delta 63441), reused 92073 (delta 62265)
Receiving objects: 100% (93654/93654), 61.50 MiB | 253 KiB/s, done.
Resolving deltas: 100% (63441/63441), done.
From git://git.pokylinux.org/poky
 * [new branch]      bernard    -> poky/bernard
 * [new branch]      bernard-5.0.1 -> poky/bernard-5.0.1
 * [new branch]      blinky     -> poky/blinky
 * [new branch]      clyde      -> poky/clyde
 * [new branch]      elroy      -> poky/elroy
 * [new branch]      green      -> poky/green
 * [new branch]      laverne    -> poky/laverne
 * [new branch]      master     -> poky/master
 * [new branch]      pinky      -> poky/pinky
 * [new branch]      purple     -> poky/purple
 * [new tag]         bernard-5.0 -> bernard-5.0
 * [new tag]         pinky-3.1.2 -> pinky-3.1.2
From git://git.pokylinux.org/poky
 * [new tag]         bernard-1.0rc1 -> bernard-1.0rc1
 * [new tag]         bernard-5.0-alpha -> bernard-5.0-alpha
 * [new tag]         bernard-5.0rc1 -> bernard-5.0rc1
 * [new tag]         bernard-5.0rc2 -> bernard-5.0rc2
 * [new tag]         laverne-4.0 -> laverne-4.0
 * [new tag]         laverne-4.0.1 -> laverne-4.0.1
 * [new tag]         m4         -> m4
 * [new tag]         purple-3.2 -> purple-3.2
 * [new tag]         purple-3.2.1 -> purple-3.2.1
trz@elmorro:/usr/local/src/Yocto$ git checkout -b bernard-cur poky/bernard
Branch bernard-cur set up to track remote branch bernard from poky.
Switched to a new branch 'bernard-cur'

Now check out the meta-intel repo into the top-level Yocto repo dir:

trz@elmorro:/usr/local/src/Yocto$ mkdir meta-intel
trz@elmorro:/usr/local/src/Yocto$ cd meta-intel
trz@elmorro:/usr/local/src/Yocto/meta-intel$ git init
Initialized empty Git repository in /usr/local/src/Yocto/meta-intel/.git/
trz@elmorro:/usr/local/src/Yocto/meta-intel$ git remote add meta-intel git://git.pokylinux.org/meta-intel.git
trz@elmorro:/usr/local/src/Yocto/meta-intel$ git remote update
trz@elmorro:/usr/local/src/Yocto/meta-intel$ git checkout -b fishriver meta-intel/master
Branch fishriver set up to track remote branch master from meta-intel.
Switched to a new branch 'fishriver'
trz@elmorro:/usr/local/src/Yocto/meta-intel$ cd ..
trz@elmorro:/usr/local/src/Yocto$ source poky-init-build-env 
You had no conf/local.conf file. Poky has created this configuration file for
you with some default values. You may wish to edit it to use a different MACHINE
(target hardware) or enable parallel build options to take advantage of multiple
cores for example. See the file for more information as common configuration
options are commented.

Also, for more information see the Poky Reference Manual:
    http://yoctoproject.org/community/documentation

You had no conf/bblayers.conf file. Poky has created this configuration file for
you with some default values. To add additional metadata layers into your
configuration please add entries to this file.

For more information see the Poky Reference Manual:
    http://yoctoproject.org/community/documentation


### Shell environment set up for Poky builds. ###

You can now run 'bitbake <target>'

Common targets are:
    poky-image-minimal
    poky-image-sato
    meta-toolchain
    meta-toolchain-sdk

You can also run generated qemu images with a command like 'poky-qemu qemux86'

Before building, you need to add the meta-fishriver layer so the build recognizes it. So edit bblayers.conf:

trz@elmorro:/usr/local/src/Yocto/build$ emacs -nw conf/bblayers.conf

And change:

BBLAYERS = " \
  /usr/local/src/Yocto/meta \                                                              
  "

to:

BBLAYERS = " \
  /usr/local/src/Yocto/meta \                                                              
  /usr/local/src/Yocto/meta-intel/meta-fishriver \                                         
  "

You also need to make a few changes to your local.conf:

trz@elmorro:/usr/local/src/Yocto/build$ emacs -nw conf/local.conf

Change:

MACHINE ??= "qemux86"

to

MACHINE ??= "fishriver"

To make the build go faster, depending on how many CPUs you have change the following variables. I have 4 cores, with HT, so I'm changing my values to 8:

trz@elmorro:/usr/local/src/Yocto/build/conf$ emacs -nw local.conf BB_NUMBER_THREADS = "8" PARALLEL_MAKE = "-j 8"

Since this is your first build, it won't matter - it will take awhile regardless, but for later builds, to avoid re-downloading all the packages again, you can point the DL_DIR variable in local conf to the downloads dir of a previous build.

You're now ready to build your image, which make take several hours. Continuing the session...:

trz@elmorro:/usr/local/src/Yocto/build$ cd /usr/local/src/Yocto/
trz@elmorro:/usr/local/src/Yocto$ source poky-init-build-env 

### Shell environment set up for Poky builds. ###

You can now run 'bitbake <target>'

Common targets are:
    poky-image-minimal
    poky-image-sato
    meta-toolchain
    meta-toolchain-sdk

You can also run generated qemu images with a command like 'poky-qemu qemux86'

trz@elmorro:/usr/local/src/Yocto/build$ bitbake poky-image-sato-live
.
.
.
NOTE: Running noexec task 5894 of 5900 (ID: 1037, /usr/local/src/Yocto/meta/recipes-kernel/linux/linux-yocto_git.bb, do_package_write)
NOTE: package perl-5.12.2-r3: task do_package_write_ipk: Succeeded
NOTE: Running noexec task 5895 of 5900 (ID: 1104, /usr/local/src/Yocto/meta/recipes-devtools/perl/perl_5.12.2.bb, do_package_write)
NOTE: package eglibc-2.12-r13: task do_package_write_ipk: Succeeded
NOTE: Running noexec task 5896 of 5900 (ID: 233, /usr/local/src/Yocto/meta/recipes-core/eglibc/eglibc_2.12.bb, do_package_write)
NOTE: package poky-image-sato-1.0-r0: task do_rootfs: Succeeded
NOTE: package poky-image-sato-live-1.0-r0: task do_package_write_rpm: Succeeded
NOTE: Running noexec task 5897 of 5900 (ID: 10, /usr/local/src/Yocto/meta/recipes-sato/images/poky-image-sato-live.bb, do_package_write)
NOTE: package syslinux-4.03-r0: task do_package_write_rpm: Succeeded
NOTE: Running noexec task 5898 of 5900 (ID: 141, /usr/local/src/Yocto/meta/recipes-devtools/syslinux/syslinux_4.03.bb, do_package_write)
NOTE: package poky-image-minimal-initramfs-1.0-r0: task do_rootfs: Succeeded
NOTE: Running task 5899 of 5900 (ID: 9, /usr/local/src/Yocto/meta/recipes-sato/images/poky-image-sato-live.bb, do_bootimg)
NOTE: package poky-image-sato-live-1.0-r0: task do_bootimg: Started
NOTE: package poky-image-sato-live-1.0-r0: task do_bootimg: Succeeded
NOTE: Running noexec task 5900 of 5900 (ID: 4, /usr/local/src/Yocto/meta/recipes-sato/images/poky-image-sato-live.bb, do_build)
NOTE: Tasks Summary: Attempted 5900 tasks of which 544 didn't need to be rerun and 0 failed.

The build succeeded - look in build/tmp/deploy/images for the bootable image:

trz@elmorro:/usr/local/src/Yocto/build$ cd /usr/local/src/Yocto/build/tmp/deploy/images
trz@elmorro:/usr/local/src/Yocto/build/tmp/deploy/images$ ls -al
total 1960464
drwxr-xr-x   3 trz trz      4096 2011-04-05 00:03 .
drwxr-xr-x   5 trz trz      4096 2011-04-04 22:36 ..
-rw-r--r--   1 trz trz   3910368 2011-04-04 22:57 bzImage- 2.6.37+git1+51c761795b078bf3c80104ed6e73b3d995067384_1+86bd1278bbf11589d87639df17d2f5f42db97b60-r16-fishriver-20110405031037.bin
lrwxrwxrwx   1 trz trz       136 2011-04-04 22:57 bzImage-fishriver.bin -> bzImage-2.6.37+git1+51c761795b078bf3c80104ed6e73b3d995067384_1+86bd1278bbf11589d87639df17d2f5f42db97b60-r16-fishriver-20110405031037.bin
drwxr-xr-x 339 trz trz     12288 2011-04-04 22:36 licenses
-rw-r--r--   1 trz trz  33630384 2011-04-04 22:57 modules-2.6.37.6-yocto-standard+-r16-fishriver.tgz
-rwxr--r--   1 trz trz   4648687 2011-04-05 00:03 poky-image-minimal-initramfs-fishriver-20110405031037.rootfs.cpio.gz
-rw-r--r--   1 trz trz  67108864 2011-04-05 00:03 poky-image-minimal-initramfs-fishriver-20110405031037.rootfs.ext3
lrwxrwxrwx   1 trz trz        68 2011-04-05 00:03 poky-image-minimal-initramfs-fishriver.cpio.gz -> poky-image-minimal-initramfs-fishriver-20110405031037.rootfs.cpio.gz
lrwxrwxrwx   1 trz trz        65 2011-04-05 00:03 poky-image-minimal-initramfs-fishriver.ext3 -> poky-image-minimal-initramfs-fishriver-20110405031037.rootfs.ext3
-rwxr--r--   1 trz trz 161879951 2011-04-05 00:02 poky-image-sato-fishriver-20110405031037.rootfs.cpio.gz
-rw-r--r--   1 trz trz 572852224 2011-04-05 00:00 poky-image-sato-fishriver-20110405031037.rootfs.ext3
lrwxrwxrwx   1 trz trz        55 2011-04-05 00:02 poky-image-sato-fishriver.cpio.gz -> poky-image-sato-fishriver-20110405031037.rootfs.cpio.gz
lrwxrwxrwx   1 trz trz        52 2011-04-05 00:00 poky-image-sato-fishriver.ext3 -> poky-image-sato-fishriver-20110405031037.rootfs.ext3
-rw-r--r--   1 trz trz 581971968 2011-04-05 00:03 poky-image-sato-live-fishriver-20110405031037.hddimg
-rw-r--r--   1 trz trz 581804032 2011-04-05 00:03 poky-image-sato-live-fishriver-20110405031037.iso
lrwxrwxrwx   1 trz trz        52 2011-04-05 00:03 poky-image-sato-live-fishriver.hddimg -> poky-image-sato-live-fishriver-20110405031037.hddimg
lrwxrwxrwx   1 trz trz        49 2011-04-05 00:03 poky-image-sato-live-fishriver.iso -> poky-image-sato-live-fishriver-20110405031037.iso

Now dd the 'live' image to a USB drive (/dev/sdf for me, yours will be different):

trz@elmorro:/usr/local/src/Yocto/build/tmp/deploy/images$ sudo dd if=poky-image-sato-live-fishriver-20110405031037.hddimg of=/dev/sdf
[sudo] password for trz: 
1136664+0 records in
1136664+0 records out
581971968 bytes (582 MB) copied, 5.15645 s, 113 MB/s
trz@elmorro:/usr/local/src/Yocto/build/tmp/deploy/images$ sync
trz@elmorro:/usr/local/src/Yocto/build/tmp/deploy/images$ eject /dev/sdf

The image should now be on the USB drive and ready to boot, enjoy!

NOTE: if you have a problem with e.g. garbage characters, or other strange things, try doing this before you dd the image:

$ sudo dd if=/dev/zero of=/dev/sdf bs=1M count=1024