Yocto BSP 開發說明

Yocto BSP 開發說明

內容參考:http://www.yoctoproject.org/docs/2.0/bsp-guide/bsp-guide.html#bsp

簡介:

一個BSP(BoardSupport Package)  定義瞭如何去支持一個或者一類特定的硬件設備,或者硬件平臺.

1 BSP layers:

BSP layers 的命名: meta-bsp_name, 如meta-minnow, meta-raspberrypi, and meta-intel .
源碼來源: http://git.yoctoproject.org/cgit/cgit.cgi
 
git clone git://git.yoctoproject.org/meta-minnow
 
向conf/bblayers.conf: BBLAYERS 添加BSP的layers 路徑
 

2 從文件組織來說明BSPlayers

下面是可能存在差異的文件列表:

     meta-bsp_name/
     meta-bsp_name/bsp_license_file
     meta-bsp_name/README
     meta-bsp_name/README.sources
     meta-bsp_name/binary/bootable_images
     meta-bsp_name/conf/layer.conf
     meta-bsp_name/conf/machine/*.conf
     meta-bsp_name/recipes-bsp/*
     meta-bsp_name/recipes-core/*
     meta-bsp_name/recipes-graphics/*
     meta-bsp_name/recipes-kernel/linux/linux-yocto_kernel_rev.bbappend

下面是eMenlow的文件列表:

     meta-emenlow/COPYING.MIT
     meta-emenlow/README
     meta-emenlow/README.sources
     meta-emenlow/binary/
     meta-emenlow/conf/
     meta-emenlow/conf/layer.conf
     meta-emenlow/conf/machine/
     meta-emenlow/conf/machine/emenlow-noemgd.conf
     meta-emenlow/recipes-bsp/
     meta-emenlow/recipes-bsp/formfactor/
     meta-emenlow/recipes-bsp/formfactor/formfactor/
     meta-emenlow/recipes-bsp/formfactor/formfactor_0.0.bbappend
     meta-emenlow/recipes-bsp/formfactor/formfactor/emenlow-noemgd/
     meta-emenlow/recipes-bsp/formfactor/formfactor/emenlow-noemgd/machconfig
     meta-emenlow/recipes-graphics/
     meta-emenlow/recipes-graphics/xorg-xserver
     meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config
     meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
     meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config/emenlow-noemgd
     meta-emenlow/recipes-graphics/xorg-xserver/xserver-xf86-config/emenlow-noemgd/xorg.config
     meta-emenlow/recipes-kernel/
     meta-emenlow/recipes-kernel/linux/
     meta-emenlow/recipes-kernel/linux/linux-yocto-dev.bbappend
     meta-emenlow/recipes-kernel/linux/linux-yocto_3.14.bbappend

 

2.1  License Files

meta-bsp_name/bsp_license_file

eMenlow 的license 文件是COPYING.MIT.

還可以是MIT,BSD, GPLv* 等等.

2.2  README 

meta-bsp_name/README , 它需要提供如何啓動的方法,最少也得包含依賴關係和聯繫方式.

2.3. README.sources

meta-bsp_name/README.sources , 它提供了BSP源代碼的存儲路徑和來源地址.

2.4. Pre-built User Binaries

meta-bsp_name/binary/bootable_images , 存儲了已經編譯好的二進制kernelrootfs.

2.5. Layer Configuration File

meta-bsp_name/conf/layer.conf ,下面是模版,需要用真實的名字替換掉bsp.
     # We have a conf and classes directory, add to BBPATH
     BBPATH .= ":${LAYERDIR}"
 
     # We have a recipes directory, add to BBFILES
     BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
             ${LAYERDIR}/recipes-*/*/*.bbappend"
 
     BBFILE_COLLECTIONS += "bsp"
     BBFILE_PATTERN_bsp = "^${LAYERDIR}/"
     BBFILE_PRIORITY_bsp = "6"
 
     LAYERDEPENDS_bsp = "intel"

2.6. Hardware Configuration Options

meta-bsp_name/conf/machine/*.conf

硬件的配置信息.

2.7. Miscellaneous BSP-Specific Recipe Files

meta-bsp_name/recipes-bsp/*

包含一些BSP特定的package.

2.8. Display Support Files

meta-bsp_name/recipes-graphics/*

它可以代表一類可以運行在該BSP上的package.

2.9. Linux Kernel Configuration

meta-bsp_name/recipes-kernel/linux/linux-yocto*.bbappend

它可以配置kernel信息.

3 發佈BSP的需求和推薦

3.1. Released BSP Requirements

在GIT上發佈一個BSP,我們需要嚴格按照BSP的書寫格式填寫相關的文件.

3.2. Released BSP Recommendations

發佈BSP的可選項:  可啓動的bootimage 以及 一個特定的yoctokernel recipes.

4 自定義一個BSP的recipe

在”xyz”中定義一個BSP相關的interfaces工具基於init-ifupdown_1.0.bb.

·       編輯init-ifupdown_1.0.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

·       建立interfaces的存儲位置

meta-xyz/recipes-core/init-ifupdown/files/xyz-machine-one/interfaces

如果BSP只支持一個硬件機器,可以改爲: meta-xyz/recipes-core/init-ifupdown/files/interfaces

5 BSP的Licensing考慮事項

6 使用Yocto的BSP 工具

Yocto 工程已經包含了一系列的BSP 工具 : yocto-bsp 和  yocto-kernel .

6.1. Common Features

$ source oe-init-build-env build_dir
$ yocto-bsp help
$ yocto-bsp help create

6.2. 通過yocto-bsp工具創建BSPlayers

$ yocto-bsp list karch
     Architectures available:
         qemu
         mips64
         powerpc
         x86_64
         arm
         mips
         i386
$ yocto-bsp create myarm qemu
     Checking basic git connectivity...
     Done.
     Which qemu architecture would you like to use? [default: i386]
         1) i386    (32-bit)
         2) x86_64  (64-bit)
         3) ARM     (32-bit)
         4) PowerPC (32-bit)
         5) MIPS    (32-bit)
         6) MIPS64  (64-bit)
     3
     Would you like to use the default (3.19) kernel? (y/n) [default: y] y
     Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n] [default: y]
     Getting branches from remote repo git://git.yoctoproject.org/linux-yocto-3.19.git...
     Please choose a machine branch to base your new BSP branch on: [default: standard/base]
         1) standard/arm-versatile-926ejs
         2) standard/base
         3) standard/beagleboard
         4) standard/beaglebone
         5) standard/ck
         6) standard/common-pc
         7) standard/crownbay
         8) standard/edgerouter
         9) standard/fsl-mpc8315e-rdb
         10) standard/mti-malta32
         11) standard/mti-malta64
         12) standard/qemuarm64
         13) standard/qemuppc
     1
     Would you like SMP support? (y/n) [default: y]
     Does your BSP have a touchscreen? (y/n) [default: n]
     Does your BSP have a keyboard? (y/n) [default: y]
     New qemu BSP created in meta-myarm

6.3. 通過yocto-kernel工具管理KernelPatches and Config

$ yocto-kernel --help
$ yocto-kernel patch add myarm ~/test.patch
     Added patches:
       test.patch
 
$ yocto-kernel patch add myarm ~/yocto-testmod.patch
     Added patches:
       yocto-testmod.patch
$ yocto-kernel patch list myarm
     The current set of machine-specific patches for myarm is:
       1) test.patch
       2) yocto-testmod.patch
$ yocto-kernel patch rm myarm
     Specify the patches to remove:
       1) test.patch
       2) yocto-testmod.patch
     1
     Removed patches:
       test.patch
$ yocto-kernel patch list myarm
     The current set of machine-specific patches for myarm is:
1)  yocto-testmod.patch
 
 
$ yocto-kernel config add myarm CONFIG_MISC_DEVICES=y
     Added item:
       CONFIG_MISC_DEVICES=y
 
     $ yocto-kernel config add myarm CONFIG_YOCTO_TESTMOD=y
     Added item:
       CONFIG_YOCTO_TESTMOD=y
$ yocto-kernel config list myarm
     The current set of machine-specific kernel config items for myarm is:
             1) CONFIG_MISC_DEVICES=y
             2) CONFIG_YOCTO_TESTMOD=y
$ yocto-kernel config rm myarm CONFIG_MISC_DEVICES=y

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章