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:toradex:toradex-build [2019-10-16 12:14] mlammerichsoftware:linux:toradex:toradex-build [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1
Zeile 1: Zeile 1:
-====== Building a New Image ====== 
  
-Images are built using bitbake and yocto. 
- 
-The build process is based on [[ https://developer.toradex.com/knowledge-base/board-support-package/openembedded-%28core%29#update-to-a-specific-version-by-using-its-tag | this toradex guide ]]. 
- 
-===== Customising the Toradex image ===== 
- 
-Note that everything in this section assumes a build environment that is set up accoring to the guide above. 
- 
-==== Adding a custom application ==== 
- 
-A custom application can be added to a yocto build by means of a new recipes and a new layer. 
- 
-There are various ways to source application to be added to a build. This guide describes how to add [[ https://github.com/DynamicDevices/bbexample | this hello world application from github ]] into the toradex image. If you want to build your own hello world application, check out [[ https://blog.mbedded.ninja/programming/embedded-linux/yocto-project/adding-a-custom-app-to-a-yocto-build/ | this guide ]] on how to do that. 
- 
-=== On layers and recipes === 
- 
-Recipes could be considered the fundamental building block of yocto. A recipe describes how to build the thing you want to build (i.e an application, kernel module, ...), its dependencies and more.  
- 
-Groups of recipes that belong together are grouped into layers. For example ''meta-toradex-nxp'' is the layer that contains all the things needed to support the hardware specific to Toradex's modules that use NXP based processors. 
- 
-=== Creating a custom layer === 
- 
-To create a new layer, create a new directory in the ''oe-core/layers'' directory(''oe-core'' is the folder the build environment was set up in above). Since this is the NTB wiki, this guide will use ''oe-core/layers/meta-ntb''. The directory name can be anything, but it should start with ''meta-''. Now change into that directory and create another folder called ''conf''. In ''conf'', create a file named ''layer.conf'' with the following content: 
- 
-<code> 
-BBPATH := "${BBPATH}:${LAYERDIR}" 
- 
-BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bappend" 
- 
-BBFILE_COLLECTIONS += "ntb" 
- 
-BBFILE_PATTERN_ntb := "^${LAYERDIR}/" 
-BBFILE_PRIORITY_ntb := "5" 
-</code> 
- 
-This file configures the layer and where to look for recipes. In this case it will look for file in ''meta-ntb/recipes-<some name>/<some other name>/<file name>.bb''. ''.bb'' is the file extension used by ''bitbake'' the build system used by yocto. Finally, create a folder named ''recipes-ntb'' inside ''meta-ntb''. This folder will store all the recipes for this layer. The directory structure should now look like this: 
- 
-  * oe-core 
-    * ... 
-    * meta-ntb 
-      * conf 
-        * layer.conf 
-      * recipes-ntb 
- 
-=== Adding a Recipe to the Layer === 
- 
-As configured above, ''bitbake'' will look for recipes in any sub directory  
-of ''recipes-ntb'', **but not in ''recipes-ntb'' itself!** Create a folder inside ''recipes-ntb'' called ''helloworld'' and inside that create a file called ''helloworld_1_0.bb'' with the following content: 
- 
-<code> 
-DESCRIPTION = "Example Hello World" 
-SECTION = "ntb" 
-DEPENDS = "" 
- 
-LICENSE = "MIT" 
-LIC_FILES_CHKSUM = "file://LICENSE;md5=96af5705d6f64a88e035781ef00e98a8" 
- 
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" 
- 
-SRCREV = "b9fb7785e9e1f357f29bef63dce8f1d91adb6170" 
-SRC_URI = "git://github.com/DynamicDevices/bbexample.git" 
- 
-S = "${WORKDIR}/git" 
- 
-inherit autotools 
-</code> 
- 
-''bitbake'' is very particular about licenses to ensure no closed source software ends up in a project that only wants open source software. Hence the recipe needs to specify the license used (MIT in this case) and a checksum for the license file to ensure it has not been altered. All this is handled by the ''LIC_FILES_CHKSUM'' field. THe other two interesting fields are ''SRC_URI'' and ''SRC_REV''. ''SRC_URI'' specifies where the source for the application/module/... for this recipe is. In this case ''git:%%//%%'' lets ''bitbake'' know the source lives in a git repository. Note that ''https:%%//%%'' will not work. 
- 
-Now running ''bitbake console-tdx-image'' should run without errors and the image should include a ''hello'' executable that prints ''Hello World'' when executed. 
- 
-== Additional Information == 
- 
-[[ https://blog.mbedded.ninja/programming/embedded-linux/yocto-project/adding-a-custom-app-to-a-yocto-build/ ]] 
- 
-[[ https://wiki.yoctoproject.org/wiki/Building_your_own_recipes_from_first_principles ]] 
- 
-===== Building the SDK ===== 
- 
-To build the SDK for an image append '' -c populate_sdk'' to the bitbake build command. 
- 
-For example, to build the SDK for the standard toradex image ''console-tdx-image'' run ''bitbake console-tdx-image -c populate_sdk'' 
- 
-For more information check the [[ https://developer.toradex.com/knowledge-base/linux-sdks | Toradex guide ]].