900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > yocto-poky下目录结构分析

yocto-poky下目录结构分析

时间:2022-04-05 02:58:46

相关推荐

yocto-poky下目录结构分析

poky目录结构

poky目录下的核心组件bitbake目录build目录meta目录meta-poky目录meta-yocto-bsp目录meta-selftest目录meta-skeleton目录已有硬件层的实例目录metadara元数据classesrecipes

yocto由许多的文件,目录或子目录组成,了解这些文件的意义和作用有助于我们快速的理解yocto项目

poky目录下的核心组件

bitbake目录

ubuntu:/media/C/Learn/poky/bitbake$ lsAUTHORS contrib LICENSEREADMEbin docLICENSE.GPL-2.0-only toaster-requirements.txtChangeLog libLICENSE.MIT

bitbake是一个独立的项目,这里的poky/bitbake目录下就放了这个bitbake项目的副本,我们在使用的bitbake命令的其实就是这里的bitbake,而不是你的环境系统里面的。

bitbake是用来读取和解析meta目录中的数据,并创建相应的任务来处理,其他的目录基本上都是被bitbake使用的,用来按照相应的规则编译某个项目。

当我们source环境(source oe-init-build-env)的时候,会将scripts和bitbake/bin这两个目录的路径添加到PATH环境变量中:

build目录

一开始git clone下载的干净的poky目录下是没有这个build目录的,是我们source的过程中才开始创建的这个目录(可以参考oe-init-build-env和poky/scripts/oe-setup-builddir)

这个poky/build目录中包含有用户配置文件和OpenEmbedded构建系统在其标准配置中生成的输出,其中下载和解压后的源代码与编译输出的结果都在这个里面。

build目录也可以不固定放在poky目录下,或者名字也可以不固定,只要在source的时候带上参数即可:

. ./oe-init-build-env

meta目录

meta目录包含最小的,底层的OpenEmbedded核心元数据,保存着可以运行的虚拟目标,比如qemux86、qemuarm等的recipes,公共的class类和machine机器的配置。

ubuntu:/media/C/Learn/poky/meta$ lsclasses files recipes-connectivity recipes-extended recipes-kernel recipes-sato siteconf lib recipes-core recipes-gnome recipes-multimedia recipes-supportCOPYING.MIT recipes-bsp recipes-devtools recipes-graphics recipes-rtrecipes.txt

meta-poky目录

该目录用来添加足够的元数据来定义poky reference distribution,是基于meta目录之上的扩展。build目录中的conf目录就是从meta-poky/conf中演变过来的,如local.conf和bblayer模板就是在这里

ubuntu:/media/C/Learn/poky/meta-poky$ tree.├── classes│ └── poky-sanity.bbclass├── conf│ ├── bblayers.conf.sample│ ├── conf-notes.txt│ ├── distro│ │ ├── include│ │ │ ├── poky-distro-alt-test-config.inc│ │ │ ├── poky-floating-revisions.inc│ │ │ └── poky-world-exclude.inc│ │ ├── poky-altcfg.conf│ │ ├── poky-bleeding.conf│ │ ├── poky.conf│ │ └── poky-tiny.conf│ ├── layer.conf│ ├── local.conf.sample│ ├── local.conf.sample.extended│ └── site.conf.sample├── README.poky└── recipes-core├── busybox│ ├── busybox│ │ └── poky-tiny│ │ └── defconfig│ └── busybox_%.bbappend├── psplash│ ├── files│ │ └── psplash-poky-img.h│ └── psplash_git.bbappend└── tiny-init├── files│ ├── init│ └── rc.local.sample└── tiny-init.bb12 directories, 22 files

meta-yocto-bsp目录

这个目录下yocto官方为了方便bsp开发人员在开发和添加自己的bsp layer时,提供了3种目前主流体系架构的硬件平台bsp模板用于参考。比如这个目录下就有arm架构对应的beaglebone平台,mips对应的edgerouter平台,x86对应的genericx86平台等等。这里可以看到如何给这些平台增加相应的内核,bootLoader和其他的BSP配置。

ubuntu:/media/C/Learn/poky/meta-yocto-bsp$ tree.├── conf│ ├── layer.conf│ └── machine│ ├── beaglebone-yocto.conf│ ├── edgerouter.conf│ ├── genericx86-64.conf│ ├── genericx86.conf│ └── include│ └── genericx86-common.inc├── lib│ └── oeqa│ ├── controllers│ │ ├── beaglebonetarget.py│ │ ├── edgeroutertarget.py│ │ ├── grubtarget.py│ │ └── __init__.py│ └── selftest│ └── cases│└── systemd_boot.py├── README.hardware├── recipes-bsp│ ├── formfactor│ │ ├── formfactor│ │ │ ├── beaglebone-yocto│ │ │ │ └── machconfig│ │ │ ├── genericx86│ │ │ │ └── machconfig│ │ │ └── genericx86-64│ │ │ └── machconfig│ │ └── formfactor_0.0.bbappend│ └── gma500-gfx-check│ ├── gma500-gfx-check│ │ ├── gma500-gfx-check.conf│ │ └── gma500-gfx-check.sh│ └── gma500-gfx-check_1.0.bb├── recipes-graphics│ └── xorg-xserver│ ├── xserver-xf86-config│ │ ├── beaglebone-yocto│ │ │ └── xorg.conf│ │ ├── genericx86│ │ │ └── xorg.conf│ │ └── genericx86-64│ │ └── xorg.conf│ └── xserver-xf86-config_0.1.bbappend├── recipes-kernel│ └── linux│ ├── linux-yocto_5.4.bbappend│ ├── linux-yocto_5.8.bbappend│ └── linux-yocto-dev.bbappend└── wic├── beaglebone-yocto.wks├── edgerouter.wks└── genericx86.wks.in25 directories, 29 files

meta-selftest目录

这个目录存放自己的测试代码的配置,基本不用

meta-skeleton目录

skeleton英文意思是骨架,这个目录就是提供bsp和内核相关开发的模板,比如这里面就有一个hello-mod驱动模块的实例,系统层的服务程序,添加多个用户账户。

ubuntu:/media/C/Learn/poky$ tree meta-skeleton/meta-skeleton/├── conf│ ├── layer.conf│ ├── multilib-example2.conf│ └── multilib-example.conf├── recipes-baremetal│ └── baremetal-examples│ └── baremetal-helloworld_git.bb├── recipes-core│ └── busybox│ ├── busybox│ │ └── no_rfkill.cfg│ └── busybox_%.bbappend├── recipes-kernel│ ├── hello-mod│ │ ├── files│ │ │ ├── COPYING│ │ │ ├── hello.c│ │ │ └── Makefile│ │ └── hello-mod_0.1.bb│ └── linux│ ├── linux-yocto-custom│ │ ├── 0001-linux-version-tweak.patch│ │ ├── feature.scc│ │ └── smp.cfg│ └── linux-yocto-custom.bb├── recipes-multilib│ └── images│ └── core-image-multilib-example.bb└── recipes-skeleton├── service│ ├── service│ │ ├── COPYRIGHT│ │ ├── skeleton│ │ └── skeleton_test.c│ └── service_0.1.bb└── useradd├── useradd-example│ ├── file1│ ├── file2│ ├── file3│ └── file4└── useradd-example.bb18 directories, 24 files

以下是meta-skeleton中的几个recipes,可以根据提示详细的分析

1、recipes-baremetal

这个目录里面是一个不跑系统的裸机程序演示,感兴趣的可以看下这个:

/aehs29/baremetal-helloqemu/blob/master/hello_baremetal_arm.c2、recipes-kernel

教我们怎么给Linux内核添加patch补丁和config配置,怎么在源码树之外添加驱动模块实例3、recipes-skeleton

教我们怎么添加一个应用层的service,而且还给了一个启动脚本

同时还演示了如何在bb文件中安装启动脚本内容4、recipes-skeleton/useradd

默认/home目录下通常只用一个root用户,这里就是我们可以往下面新增用户

已有硬件层的实例目录

这些目录了解需要我们根据yocto中的重要概念区分,找到对应的目录,后期我们将按照我们对这些目录的理解,去修改对应的文件或者增加对应的文件,解决自己目标需求。

metadara元数据

metadata中包括共享的配置(比如qemux86-64.conf机器配置),全局变量定义(如使用的kernel是什么版本,机器镜像有哪些功能等,比如x11,screen、alsa等等),共享的class类(如meta/classes),包装(meta/lib)和recipes配方。metadata和layers通常可以理解为一个东西,就是下面这些

poky]$ ls | grep "^meta"meta #yocto基础的layermeta-freescale #飞思卡尔的layermeta-poky #yocto的poky发行版本layermeta-qcom #这个是高通的layermeta-qt5 #Qt5的layermeta-selftest #自我测试的layermeta-skeleton #骨架,很多例子meta-yocto-bsp #yocto官方提供的参考bsp layer

classes

classes类定义了构建具有逻辑的封装和继承,有些Linux的bb文件就继承了Linux相关的一些class类,继承这些类的kernelrecipe bb文件,就不需要我们为内核的下载,config配置编译和安装等任务做太多事情,Linux的类有

ubuntu:/media/C/Learn/poky$ ls meta/classes/kernel*meta/classes/kernel-arch.bbclassmeta/classes/kernel-artifact-names.bbclassmeta/classes/kernel.bbclassmeta/classes/kernel-devicetree.bbclassmeta/classes/kernel-fitimage.bbclassmeta/classes/kernel-grub.bbclassmeta/classes/kernel-module-split.bbclassmeta/classes/kernelsrc.bbclassmeta/classes/kernel-uboot.bbclassmeta/classes/kernel-uimage.bbclassmeta/classes/kernel-yocto.bbclass

第三方应用项目也有许多的class类,比如有些项目是cmake构建的,可以继承/meta/classes/cmake.bbclass,你就可以省去cmake项目应该怎么构建的烦恼。

Linux类和cmake类怎么继承,看例子:

#poky/meta/recipes-kernel/linux/linux-yocto.incinherit kernel inherit kernel-yocto...#poky/meta/recipes-support/libical/libical_3.0.8.bbinherit cmake pkgconfig...

使用到了inherit关键字

recipes

recipes配方是构建的软件和镜像的逻辑单元,它是构建一个项目的基本,通常应该包含若干个bb文件,包括bbappend文件。recipes通常是放在metadata layers目录中,会继承上面提及的一些class类,大致如下:

meta-xxx/recipes-abc/abc.bb

如果想知道自己yocto有哪些recipes,可以通过下面的命令查看:

build]$ bitbake-layers show-recipes

我们简单的看下/poky/meta/recipes.txt中内容

1 recipes-bsp- Anything with links to specific hardware or hardware configuration information2 recipes-connectivity - Libraries and applications related to communication with other devices3 recipes-core - What's needed to build a basic working Linux image including commonly used dependencies4 recipes-devtools- Tools primarily used by the build system (but can also be used on targets)5 recipes-extended- Applications which whilst not essential add features compared to the alternatives in6 core. May be needed for full tool functionality.7 recipes-gnome - All things related to the GTK+ application framework8 recipes-graphics- X and other graphically related system libraries9 recipes-kernel - The kernel and generic applications/libraries with strong kernel dependencies10 recipes-multimedia - Codecs and support utilties for audio, images and video11 recipes-rt - Provides package and image recipes for using and testing the PREEMPT_RT kernel12 recipes-sato - The Sato demo/reference UI/UX, its associated apps and configuration13 recipes-support- Recipes used by other recipes but that are not directly included in images

翻译:

recipes-bsp—任何带有特定硬件或硬件配置信息链接的内容recip- connectivity -与其他设备通信相关的库和应用程序recipes-core—构建包括常用依赖项在内的基本工作Linux映像所需要的内容recipes-devtools——主要用于构建系统的工具(但也可以用于目标)recipes-extended -与内核中的替代方案相比,这些应用程序虽然不是必不可少的,但却可以添加一些特性。可能需要完整的工具功能。所有与GTK+应用程序框架相关的内容recipes-graphics ---X和其他图形相关的系统库recipes-kernel—具与内核有强依赖性的通用应用程序或者库recipes-multimedia --音频、图像和视频的编解码器和支持应用程序recipes-rt——提供用于使用和测试PREEMPT_RT内核的包和映像食谱recipes-sato 参考UI/UX,相关的应用程序和配置recipes-support——其他食谱使用的食谱,但没有直接包含在图片中

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。