How do I: Difference between revisions
From Yocto Project
Jump to navigationJump to search
No edit summary |
Jfabernathy (talk | contribs) (new how to I add recipes) |
||
Line 25: | Line 25: | ||
Thats it - this should boot. | Thats it - this should boot. | ||
'''Q: How do I put my recipe into Yocto? ''' | |||
'''A:''' Let's use the Hello World example from Section 3.1.2 of the Poky Reference Manual and expand on it. | |||
* First we will start with a new meta layer in poky, add the recipe and build the image, core-image-minimal, with the addition of the “hello” application, using the autotooled package option. | |||
* Create the following directory structure in the ~/poky directory. I'll use my initials to denote the layer and recipe name: | |||
mkdir meta-jfa | |||
mkdir meta-jfa/conf | |||
mkdir meta-jfa/recipes-jfa | |||
mkdir meta-jfa/recipes-jfa/hello | |||
* Next, to make sure our recipe gets searched and located, we create the layer.conf file in the meta-jfa/conf directory as follows: | |||
# We have a conf and classes directory, add to BBPATH | |||
BBPATH := "${BBPATH}:${LAYERDIR}" | |||
# We have a packages directory, add to BBFILES | |||
BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \ | |||
${LAYERDIR}/recipes-*/*/*.bbappend" | |||
BBFILE_COLLECTIONS += "jfa" | |||
BBFILE_PATTERN_jfa := "^${LAYERDIR}/" | |||
BBFILE_PRIORITY_jfa = "5 | |||
* Now we need to put the recipe (.bb) file into the right directory. So we will put the file, hello_2.7.bb, into the meta-jfa/recipes-jfa/hello directory. I picked the version 2.7 of the hello program by going to the gnu site for the application (ftp://ftp.gnu.org/gnu/hello/) and downloading it to checkout the version I wanted to include. hello-2.7.tar.gz is the most current. I downloaded it locally and expanded it to look at the license information. The hello_2.7.bb file will contain the following: | |||
DESCRIPTION = "GNU Helloworld application" | |||
SECTION = "examples" | |||
LICENSE = "GPLv3+" | |||
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | |||
PR = "r0" | |||
SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz" | |||
inherit autotools gettext | |||
* To explain a few of the recipe statements: | |||
** LIC_FILES_CHKSUM = is required and, using file location defaults, points to the COPYING file that is part of the tarball that is downloaded from the SRC_URI address. The md5= part of the statement is generated by running “md5sum COPYING” against the COPYING file you downloaded to examine. | |||
** ${PV} in the SRC_URI statement is picked up from the part of the recipe file name after the “_”. In our case PV =2.7. | |||
* The recipe is built, so now we can run it: | |||
cd ~/poky | |||
source oe-init-build-env build-hello. | |||
* Before we can bitbake we need to edit 2 files. The source command above leaves you in the build-hello directory, so you need to edit the files conf/local.conf and conf/bblayers.conf. The bblayers.conf needs to have the one line added to include the layer you created. | |||
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf | |||
# changes incompatibly | |||
LCONF_VERSION = "4" | |||
BBFILES ?= "" | |||
BBLAYERS = " \ | |||
/home/jim/poky/meta \ | |||
/home/jim/poky/meta-yocto \ | |||
/home/jim/poky/meta-jfa \ | |||
* The conf/local.conf file needs to have the parallel processing lines edited to speed up the baking on multicore systems. The machine is by default set to qemux86 and for our purposes, fine. We need to add a line to include the hello package we are building into the image by adding the following line: | |||
POKY_EXTRA_INSTALL += "hello" | |||
* Now we can bake it by: | |||
bitbake core-image-minimal | |||
* Once completed we can test it by: | |||
runqemu qemux86 | |||
* Login as root with no password., then hello will run the command from the prompt. |
Revision as of 10:43, 27 January 2012
Q: How do I put yocto on a hard drive?
A: bitbake core-image-sato or core-image-sato-sdk
- have a suitable partition on the disk - say partition #3
- this partition will show up as sde3 on my host machine and sda3 on the atom
- mkfs.ext3 /dev/sde3
- mount /dev/sde3 /mnt/target
- mount -o loop tmp/deploy/images/core-image-sato-sdk.ext3 /mnt/target-ext3
- cp -a /mnt/target-ext3/* /mnt/target
- grub-install --recheck --root-directory=/mnt/target /dev/sde
If grub install passed, copy the following to /mnt/target/boot/grub/grub.cfg
set default="0" set timeout="30" menuentry 'Yocto SDK' { insmod part_msdos insmod ext2 set root='(hd0,msdos3)' linux /boot/bzImage root=/dev/sda3 }
Thats it - this should boot.
Q: How do I put my recipe into Yocto?
A: Let's use the Hello World example from Section 3.1.2 of the Poky Reference Manual and expand on it.
- First we will start with a new meta layer in poky, add the recipe and build the image, core-image-minimal, with the addition of the “hello” application, using the autotooled package option.
- Create the following directory structure in the ~/poky directory. I'll use my initials to denote the layer and recipe name:
mkdir meta-jfa mkdir meta-jfa/conf mkdir meta-jfa/recipes-jfa mkdir meta-jfa/recipes-jfa/hello
- Next, to make sure our recipe gets searched and located, we create the layer.conf file in the meta-jfa/conf directory as follows:
# We have a conf and classes directory, add to BBPATH BBPATH := "${BBPATH}:${LAYERDIR}" # We have a packages directory, add to BBFILES BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "jfa" BBFILE_PATTERN_jfa := "^${LAYERDIR}/" BBFILE_PRIORITY_jfa = "5
- Now we need to put the recipe (.bb) file into the right directory. So we will put the file, hello_2.7.bb, into the meta-jfa/recipes-jfa/hello directory. I picked the version 2.7 of the hello program by going to the gnu site for the application (ftp://ftp.gnu.org/gnu/hello/) and downloading it to checkout the version I wanted to include. hello-2.7.tar.gz is the most current. I downloaded it locally and expanded it to look at the license information. The hello_2.7.bb file will contain the following:
DESCRIPTION = "GNU Helloworld application" SECTION = "examples" LICENSE = "GPLv3+" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" PR = "r0" SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz" inherit autotools gettext
- To explain a few of the recipe statements:
- LIC_FILES_CHKSUM = is required and, using file location defaults, points to the COPYING file that is part of the tarball that is downloaded from the SRC_URI address. The md5= part of the statement is generated by running “md5sum COPYING” against the COPYING file you downloaded to examine.
- ${PV} in the SRC_URI statement is picked up from the part of the recipe file name after the “_”. In our case PV =2.7.
- The recipe is built, so now we can run it:
cd ~/poky source oe-init-build-env build-hello.
- Before we can bitbake we need to edit 2 files. The source command above leaves you in the build-hello directory, so you need to edit the files conf/local.conf and conf/bblayers.conf. The bblayers.conf needs to have the one line added to include the layer you created.
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly LCONF_VERSION = "4" BBFILES ?= "" BBLAYERS = " \ /home/jim/poky/meta \ /home/jim/poky/meta-yocto \ /home/jim/poky/meta-jfa \
- The conf/local.conf file needs to have the parallel processing lines edited to speed up the baking on multicore systems. The machine is by default set to qemux86 and for our purposes, fine. We need to add a line to include the hello package we are building into the image by adding the following line:
POKY_EXTRA_INSTALL += "hello"
- Now we can bake it by:
bitbake core-image-minimal
- Once completed we can test it by:
runqemu qemux86
- Login as root with no password., then hello will run the command from the prompt.