Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
software:linux:yocto:getting_started_cpp [2020-03-31 11:48] mlammerichsoftware:linux:yocto:getting_started_cpp [2024-04-23 13:08] (aktuell) Moritz Lammerich
Zeile 1: Zeile 1:
-======= Getting started with Yocto and C/C++ =======+======= Getting Started with Yocto and C/C++ =======
  
-This guide will go through setting up a build environment and building an x86_64 image, and adding a small "hello world" application to it. First the application will be compiled using the [[ .:sdk SDK ]], then it will be added to the image directly by creating a [[ .:recipes | recipe ]].+This guide will go through setting up a build environment and building an x86_64 image, and adding a small "hello world" application to it. This page is a summary of the information from [[software:linux:yocto:setup|Setup and Building]], [[software:linux:yocto:recipes|Recipes]] and [[software:linux:yocto:devtool|devtool]].
  
-===== Setting up the build environment =====+===== Setting up the Build Environment =====
  
 Create a directory in a suitable place to store everything related to this build. Create a directory in a suitable place to store everything related to this build.
 This guide will assume everything is in a directory called ''yocto'' in your the home of the user ''ubuntu'': ''/home/ubuntu/yocto''. This folder can by anywhere on the system though. This guide will assume everything is in a directory called ''yocto'' in your the home of the user ''ubuntu'': ''/home/ubuntu/yocto''. This folder can by anywhere on the system though.
  
-Next, clone ''poky'', [[..: | yocto']] reference distribution. At the time of writing ''yocto-3.0.2'' is the newest release, feel free to substitute it for a newer/different version.+Next, clone ''poky'', yocto's reference distribution. At the time of writing ''yocto-3.0.2'' is the newest release, feel free to substitute it for a newer/different version.
 <code> <code>
-git clone -b yocto-3.0.2 git://git.yoctoproject.org/poky+git clone -b kirkstone git://git.yoctoproject.org/poky
 </code> </code>
  
Zeile 18: Zeile 18:
 </code> </code>
  
-Now we can initialize [[..: | yocto ]] using:+Now we can initialize yocto using:
 <code> <code>
 . poky/oe-init-build-env build/ . poky/oe-init-build-env build/
 </code> </code>
-This will populate the build directory with all necessary files and give you access to ''bitbake'', the build system used by [[..: | yocto ]].+This will populate the build directory with all necessary files and give you access to ''bitbake'', the build system used by yocto.
  
-==== Setting the machine ====+==== Setting the Machine ====
  
 Setting the machine tells bitbake what hardware to build for. This build will be a 64bit qemu image, so we can set the machine to ''qemu86-64''. This means we can run this image in Qemu. Setting the machine tells bitbake what hardware to build for. This build will be a 64bit qemu image, so we can set the machine to ''qemu86-64''. This means we can run this image in Qemu.
Zeile 40: Zeile 40:
 The build environment is now set up. The build environment is now set up.
  
-===== Building an image =====+===== Building an Image =====
  
 You can now build an image. This command will build a minimal image provided by ''poky'': You can now build an image. This command will build a minimal image provided by ''poky'':
Zeile 107: Zeile 107:
 </code> </code>
  
-==== Optional: Verifying the application works ====+==== Optional: Verifying that the Application Works ====
  
 This is an optional step to verify the application itself is built correctly before adding it to the image. This is an optional step to verify the application itself is built correctly before adding it to the image.
 Create a ''build'' directory inside the application folder for cmake to store its data in. Create a ''build'' directory inside the application folder for cmake to store its data in.
 Then execute ''cmake'' inside that folder to create the build configuration and build the  Then execute ''cmake'' inside that folder to create the build configuration and build the 
-applucation by running ''make''.+application by running ''make''.
 Now there should be a ''hello'' executable that prints "hello world" when executed. Now there should be a ''hello'' executable that prints "hello world" when executed.
 After confirming it works, change back to ''yocto/build'' before continuing with the next step. After confirming it works, change back to ''yocto/build'' before continuing with the next step.
Zeile 127: Zeile 127:
 ===== Creating a Recipe for the application ===== ===== Creating a Recipe for the application =====
  
-Bitbake povides a tool to create [[ .:recipes recipes ]] with relative ease. This tool is called ''devtool''+We use [[software:linux:yocto:devtool|devtool]] to create new [[ .:recipes | Recipe ]] for our ''hello'' application.
-To add a [[ .:recipes | recipe ]] for our ''hello'' application, run:+
 <code> <code>
 devtool add ../helloworld/ devtool add ../helloworld/
Zeile 138: Zeile 137:
 </code> </code>
  
-This means devtool ran successfully and created a [[ .:recipes | recipe ]] at the specfied location.+This means devtool ran successfully and created a recipe at the specified location. 
  
-To test whether this [[ .:recipes | recipe ]] works, build it by running bitbake:+To test whether this recipe works, build it by running bitbake:
  
 <code> <code>
Zeile 152: Zeile 151:
 </code> </code>
  
-This means the package provided by the [[ .:recipes | recipe ]] was built successfully.+This means the package provided by the recipe was built successfully.
  
 ===== Adding the Recipe to the Image ===== ===== Adding the Recipe to the Image =====