Yocto
Yocto系列讲解[入门篇] 1 - 快速入门熟悉Yocto的构建
Yocto系列讲解[入门篇] 2 - 演示运行qemux86-64虚拟机
Yocto系列讲解[理论篇] 3 - meta layer recipe class概念介绍
Yocto系列讲解[入门篇] 4 - 创建自己的meta layer
Yocto系列讲解[入门篇] 5 - 在meta-mylayer中添加helloworld recipe
Yocto系列讲解[理论篇] 6 - yocto是什么,学习它不难
Yocto系列讲解[实战篇] 7 - 开发工具devtool实操(创建新项目helloyocto)
Yocto系列讲解[实战篇] 8 - 开发工具devtool实操(添加git项目learnyocto)
Yocto系列讲解[实战篇] 9 - devtool验证并将learnyocto添加到meta-mylayer中
Yocto系列讲解[实战篇] 10 - 在qemux86机器运行时安装程序
Yocto系列讲解[实战篇] 11 - 在qemux86机器运行时卸载删除程序
Yocto系列讲解[实战篇]12 - 修改开源项目的代码(1)
Yocto系列讲解[技巧篇]13 - devtool修改workspace目录位置
Yocto系列讲解[技巧篇]14 - devtool edit-recipe命令(编辑bb文件命令)
本文档使用 MrDoc 发布
-
+
首页
Yocto系列讲解[实战篇]12 - 修改开源项目的代码(1)
#### 目录 + [问题描述](#问题描述) + [修改某个开源项目](#修改某个开源项目) + [alsa-utils源码位置](#alsa-utils源码位置) + [devtool modify命令](#devtool_modify命令) + [修改alsa-utils源码](#修改alsa-utils源码) + [修改后开始编译](#修改后开始编译) + [在线部署验证](#在线部署验证) + [提交我们的修改](#提交我们的修改) + [devtool build-image命令](#devtool_build-image命令) + [devtool finish命令](#devtool_finish命令) + [devtool reset 命令](#devtool_reset_命令) + [运行验证](#运行验证) ### 问题描述 前面我们创建的几个项目`helloyocto`和`learnyocto`项目都是我们自己创建的项目可以很容易修改。`yocto`中使用的项目都是开源的,有的是从压缩包或者`git`等方式下载下来的,如果发现这些开源软件有问题,要修改,总不能获取源码然后修改,在像添加自己的项目那样添加吧?那多麻烦。 比如你要修改的开源项目是`abc`,编译过程中创建的代码路径和中间文件可能是下面这样的: ```bash build]$ ls tmp/work/core2-64-poky-linux/abc/git-r0/ abc/ debugsources.list license-destdir pkgdata-pdata-input recipe-sysroot-native abc.spec deploy-rpms package pkgdata-sysroot source-date-epoch build deploy-source-date-epoch packages-split pseudo sysroot-destdir configure.sstate image pkgdata recipe-sysroot temp ``` 假设此时你在`tmp/work/core2-64-poky-linux/abc/git-r0/abc/`源码目录里面去修改,然后`bitbake abc`时,要么没有编译你的修改,要么代码会重新恢复到原始的状态,即便成功,以后都要去源码里面修改吗?你修改的代码状态又该如何保存呢?自己生成补丁,然后在`bb`文件中添加吗?当然也可以,但是很麻烦。今天就为大家介绍简单的方法。 ### 修改某个开源项目 这里我们的`qemux86-64`系统内部有一个`alsamixer`程序,可以运行看下帮助信息: ```bash root@qemux86-64:~# alsamixer --help Usage: alsamixer [options] ... ``` 现在我们假设要修改这个第三方开源的项目,该如何做呢? 不用管它是做什么的,为了简单我们准备在这个help命令里面做一点修改。 该程序编译后的目录在如下位置: ```bash build]$ ls tmp/work/core2-64-poky-linux/alsa-utils/1.2.1-r0/image/usr/bin/ alsamixer ... #省略其他程序 ``` ### alsa-utils源码位置 先简单看下源代码的情况: ```bash build]$ ls tmp/work/core2-64-poky-linux/alsa-utils/1.2.1-r0/alsa-utils-1.2.1/ ... alsamixer/ ... build]$ cd tmp/work/core2-64-poky-linux/alsa-utils/1.2.1-r0/alsa-utils-1.2.1/ alsa-utils-1.2.1]$ git branch master * my-yocto-3.1.2 ``` ### devtool modify命令 我们准备在alsamixer程序的help命令里面加一点字符串,但并不是在tmp/work/core2-64-poky-linux/alsa-utils/1.2.1-r0/alsa-utils-1.2.1/目录里面修改。我们可以通过devtool modify命令修改已有的recipe,比如像这里的alsa-utils。该命令与devtool add命令非常相似,不同之处在于它不会在workspace layer中创建recipe,因为该recipe已经存在于另一个layer中。比如alsa-utils recipe就存在于: ```bash poky]$ ls meta/recipes-multimedia/alsa/alsa-utils_1.2.1.bb meta/recipes-multimedia/alsa/alsa-utils_1.2.1.bb ``` devtool modify命令获取recipe的源代码,并将其放到默认的workspace/sources目录中,会为其创建git存储库,并初始化,在目标分支上再切换出一个devtool分支, 并且会在此基础上打上recipe需要的patches文件。结合实际,这里我们使用如下命令获取alsa-utils源码: ```bash build]$ devtool modify alsa-utils NOTE: Starting bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... Loading cache: 100% |############################################################################################| Time: 0:00:00 Loaded 1320 entries from dependency cache. Parsing recipes: 100% |##########################################################################################| Time: 0:00:00 Parsing of 782 .bb files complete (779 cached, 3 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "3.1.2" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe" meta-altera = "master:aa24dfcb39fce3619a87ee6eef6e4296e66d2099" meta-mylayer workspace = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe" Initialising tasks: 100% |#######################################################################################| Time: 0:00:00 Sstate summary: Wanted 0 Found 0 Missed 0 Current 20 (0% match, 100% complete) NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 93 tasks of which 90 didn't need to be rerun and all succeeded. INFO: Source tree extracted to /home/peeta/poky/build/workspace/sources/alsa-utils INFO: Recipe alsa-utils now set up to build from /home/peeta/poky/build/workspace/sources/alsa-utils ``` alsa-utils源码就放到了这里: ```bash build]$ ls workspace/sources/alsa-utils/ ABOUT-NLS alsactl alsaucm axfer config.guess configure.ac iecset m4 po test-driver acinclude.m4 alsa-info amidi bat config.rpath COPYING include Makefile.am README.md TODO aclocal.m4 alsaloop amixer ChangeLog config.sub depcomp INSTALL Makefile.in seq topology alsaconf alsamixer aplay compile configure gitcompile install-sh missing speaker-test utils ``` 并且会添加一个bbappend文件: ```bash build]$ ls workspace/appends/ alsa-utils_1.2.1.bbappend helloyocto.bbappend learnyocto_git.bbappend build]$ cat workspace/appends/alsa-utils_1.2.1.bbappend FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" FILESPATH_prepend := "/home/peeta/poky/build/workspace/sources/alsa-utils/oe-local-files:" # srctreebase: /home/peeta/poky/build/workspace/sources/alsa-utils inherit externalsrc # NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND EXTERNALSRC_pn-alsa-utils = "/home/peeta/poky/build/workspace/sources/alsa-utils" # initial_rev: 7721f196e02f770e8363a24a1ca170637052f166 ``` 会从master分支切换到一个新的devtool分支上 ```bash build]$ cd workspace/sources/alsa-utils/ alsa-utils]$ git branch -a * devtool #当前所在分支 master alsa-utils]$ git log 7721f19 Initial commit from upstream at version 1.2.1 (OpenEmbedded, 3 分钟前) alsa-utils]$ git log master 7721f19 Initial commit from upstream at version 1.2.1 (OpenEmbedded, 3 分钟前) alsa-utils]$ ``` devtool使用现有recipe的SRC\_URI语句获取上游的源码,将源代码提取到工作空间中的默认的source目录。使用的默认开发分支是“ devtool”。 ### 修改alsa-utils源码 开始在下面的路径中修改源码 ```bash build]$ cd workspace/sources/alsa-utils/ alsa-utils]$ vim alsamixer/cli.c +40 ``` ```c static void show_help(void) { puts(_("Usage: alsamixer [options], hello fulinux!")); //这里添加"hello fulinux !" puts(_("Useful options:\n" " -h, --help this help\n" " -c, --card=NUMBER sound card number or id\n" " -D, --device=NAME mixer device name\n" " -V, --view=MODE starting view mode: playback/capture/all")); puts(_("Debugging options:\n" " -g, --no-color toggle using of colors\n" " -a, --abstraction=NAME mixer abstraction level: none/basic")); } ``` 保存退出。查看修改点: ```bash [peeta@tommy-OptiPlex-7060 alsa-utils]$ git status 位于分支 devtool 尚未暂存以备提交的变更: (使用 "git add <文件>..." 更新要提交的内容) (使用 "git checkout -- <文件>..." 丢弃工作区的改动) 修改: alsamixer/cli.c 修改尚未加入提交(使用 "git add" 和/或 "git commit -a") [peeta@tommy-OptiPlex-7060 alsa-utils]$ git diff diff --git a/alsamixer/cli.c b/alsamixer/cli.c index 3f8f52f..fe00d31 100644 --- a/alsamixer/cli.c +++ b/alsamixer/cli.c @@ -37,7 +37,7 @@ static struct snd_mixer_selem_regopt selem_regopt = { static void show_help(void) { - puts(_("Usage: alsamixer [options]")); + puts(_("Usage: alsamixer [options], hello fulinux!")); puts(_("Useful options:\n" " -h, --help this help\n" " -c, --card=NUMBER sound card number or id\n" ``` ### 修改后开始编译 使用devtool build命令编译: ```bash build]$ devtool build alsa-utils NOTE: Tasks Summary: Attempted 1130 tasks of which 1122 didn't need to be rerun and all succeeded. #没有编译错误,编译成功 ``` ### 在线部署验证 使用上一篇的方法将其部署到`qemux86-64`系统中,我们不覆盖`/usr/bin/`目录下的内容,将其部署到用户根目录下。参考如下: ```bash build]$ devtool deploy-target alsa-utils root@192.168.7.2:~/ ``` #机器终端: ```bash root@qemux86-64:~# ls lib usr var root@qemux86-64:~# cd usr/bin/ root@qemux86-64:~/usr/bin# ./alsamixer --help Usage: alsamixer [options], hello fulinux! #这里显示的就是我们添加的内容。 ``` 可见我们修改是成功的。不过到这里我们的工作还没有结束。 ### 提交我们的修改 我们姑且认为我们的改动达到了预期目标,于是我们将改动做git提交如下: ```bash alsa-utils]$ git add -u alsa-utils]$ git commit -m 'alsamixer:test devtool modify' ``` ### devtool build-image命令 ```bash build]$ cd .. poky]$ source oe-init-build-env ### Shell environment set up for builds. ### You can now run 'bitbake <target>' Common targets are: core-image-minimal core-image-sato meta-toolchain meta-ide-support You can also run generated qemu images with a command like 'runqemu qemux86' Other commonly useful commands are: - 'devtool' and 'recipetool' handle common recipe tasks - 'bitbake-layers' handles common layer tasks - 'oe-pkgdata-util' handles common target package tasks build]$ devtool build-image core-image-sato NOTE: Starting bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... Parsing recipes: 100% |###################################################################################| Time: 0:00:18 Parsing of 782 .bb files complete (0 cached, 782 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors. INFO: Building image core-image-sato with the following additional packages: helloyocto learnyocto example Loading cache: 100% |#####################################################################################| Time: 0:00:00 Loaded 1320 entries from dependency cache. Parsing recipes: 100% |###################################################################################| Time: 0:00:00 Parsing of 782 .bb files complete (778 cached, 4 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "3.1.2" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe" meta-altera = "master:aa24dfcb39fce3619a87ee6eef6e4296e66d2099" meta-mylayer workspace = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe" Initialising tasks: 100% |################################################################################| Time: 0:00:08 Sstate summary: Wanted 4 Found 1 Missed 3 Current 2768 (25% match, 99% complete) NOTE: Executing Tasks ERROR: core-image-sato-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs --setopt=logdir=/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp --repofrompath=oe-repo,/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo --nogpgcheck install locale-base-en-us locale-base-en-gb rpm learnyocto helloyocto dnf packagegroup-core-x11-base packagegroup-core-ssh-dropbear packagegroup-base-extended packagegroup-core-x11-sato example packagegroup-core-boot psplash run-postinsts' returned 1: DNF version: 4.2.2 cachedir: /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/var/cache/dnf Added oe-repo repo from /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo repo: using cache for: oe-repo not found other for: not found modules for: not found deltainfo for: not found updateinfo for: oe-repo: using metadata from Thu 22 Oct 2020 12:25:50 PM UTC. No module defaults found No match for argument: example Error: Unable to find a match ERROR: Logfile of failure stored in: /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp/log.do_rootfs.15636 ERROR: Task (/home/peeta/poky/meta/recipes-sato/images/core-image-sato.bb:do_rootfs) failed with exit code '1' NOTE: Tasks Summary: Attempted 6854 tasks of which 6852 didn't need to be rerun and 1 failed. Summary: 1 task failed: /home/peeta/poky/meta/recipes-sato/images/core-image-sato.bb:do_rootfs Summary: There was 1 ERROR message shown, returning a non-zero exit code. ``` 编译出错,这个和之前的一篇讲到的时候出现了相同的错误,仔细看上面的log,初步推断是我们自己加的空的example项目导致。该recipe里面没有任何实质的内容,可能就导致编译镜像的时候出现问题,因此我们做如下操作。 ### devtool finish命令 下面的命令可能需要用到`meta-mylayer`,从本专栏开始学习过来盆友,应该记得创建自己的`layer`一篇中有提交到这个,不清楚的回去看下。 我们上面已经将自己的改动做了git提交。`devtool finish`命令会在本地git存储库中生成提交对应的所有补丁,更新`recipe`(这里我们对应的就是`alsa-utils`)以指向它们(或创建一个`.bbappend`文件来这样做,具体取决于指定的目标`layer`),然后重置`recipe`,以便可以正常构建`recipe`(这里就是`alsa-utils`),而不是从工作空间中构建`recipe`。比如说我们的`alsa-utils`,使用了该命令后会生成一个`patch`和`bbappend`, 并在我们指定的`meta-mylayer`层,重置recipe,使得原来在`workspace`中构建`alsa-utils`失效,因为今后正常构建这个`alsa-utils recipe`时,会使用到生成的`patch`和`bbappend`。参考如下: ```bash build]$ devtool finish alsa-utils meta-mylayer NOTE: Starting bitbake server... ERROR: Source tree is not clean: M Makefile.in M aclocal.m4 M alsa-info/Makefile.in M alsaconf/Makefile.in M alsactl/Makefile.in M alsactl/init/Makefile.in M alsaloop/Makefile.in M alsamixer/Makefile.in M alsaucm/Makefile.in M amidi/Makefile.in M amixer/Makefile.in M aplay/Makefile.in M axfer/Makefile.in M axfer/test/Makefile.in M bat/Makefile.in M bat/tests/Makefile.in M bat/tests/asound_state/Makefile.in M config.guess M config.rpath M config.sub M configure M iecset/Makefile.in M include/Makefile.in M include/aconfig.h.in M m4/Makefile.in D m4/gettext.m4 D m4/iconv.m4 D m4/lib-ld.m4 D m4/lib-link.m4 D m4/lib-prefix.m4 D m4/nls.m4 D m4/po.m4 D m4/progtest.m4 M po/Makefile.in.in M seq/Makefile.in M seq/aconnect/Makefile.in M seq/aplaymidi/Makefile.in M seq/aseqdump/Makefile.in M seq/aseqnet/Makefile.in M speaker-test/Makefile.in M speaker-test/samples/Makefile.in M topology/Makefile.in M utils/Makefile.in ?? autom4te.cache/ ?? include/aconfig.h.in~ ?? version Ensure you have committed your changes or use -f/--force if you are sure there's nothing that needs to be committed ``` 这里提示我们的源码目录里面不干净,可能是因为我做git提交后又编译了一次。我们到源码里面看下: ```bash build]$ cd workspace/sources/alsa-utils/ [peeta@tommy-OptiPlex-7060 alsa-utils]$ git status 位于分支 devtool 尚未暂存以备提交的变更: (使用 "git add/rm <文件>..." 更新要提交的内容) (使用 "git checkout -- <文件>..." 丢弃工作区的改动) 修改: Makefile.in 修改: aclocal.m4 修改: alsa-info/Makefile.in 修改: alsaconf/Makefile.in 修改: alsactl/Makefile.in 修改: alsactl/init/Makefile.in 修改: alsaloop/Makefile.in 修改: alsamixer/Makefile.in 修改: alsaucm/Makefile.in 修改: amidi/Makefile.in 修改: amixer/Makefile.in 修改: aplay/Makefile.in 修改: axfer/Makefile.in 修改: axfer/test/Makefile.in 修改: bat/Makefile.in 修改: bat/tests/Makefile.in 修改: bat/tests/asound_state/Makefile.in 修改: config.guess 修改: config.rpath 修改: config.sub 修改: configure 修改: iecset/Makefile.in 修改: include/Makefile.in 修改: include/aconfig.h.in 修改: m4/Makefile.in 删除: m4/gettext.m4 删除: m4/iconv.m4 删除: m4/lib-ld.m4 删除: m4/lib-link.m4 删除: m4/lib-prefix.m4 删除: m4/nls.m4 删除: m4/po.m4 删除: m4/progtest.m4 修改: po/Makefile.in.in 修改: seq/Makefile.in 修改: seq/aconnect/Makefile.in 修改: seq/aplaymidi/Makefile.in 修改: seq/aseqdump/Makefile.in 修改: seq/aseqnet/Makefile.in 修改: speaker-test/Makefile.in 修改: speaker-test/samples/Makefile.in 修改: topology/Makefile.in 修改: utils/Makefile.in 未跟踪的文件: (使用 "git add <文件>..." 以包含要提交的内容) autom4te.cache/ include/aconfig.h.in~ version ``` 这里面主要是生成了一些`do_configure`的中间文件等。我可以通过`git checkout .`或者手动删除等操作来清理源码目录,但是我们仔细看上面的提示“`use -f/--force if you are sure there's nothing that needs to be committed`”,即在使用`devtool finish`命令时,加个“-f”选项也可以,如下: ```bash build]$ devtool finish alsa-utils meta-mylayer -f NOTE: Writing append file /home/peeta/poky/meta-mylayer/recipes-multimedia/alsa/alsa-utils_%.bbappend NOTE: Copying 0001-alsamixer-test-devtool-modify.patch to /home/peeta/poky/meta-mylayer/recipes-multimedia/alsa/alsa-utils/0001-alsamixer-test-devtool-modify.patch INFO: Cleaning sysroot for recipe alsa-utils... INFO: Leaving source tree /home/peeta/poky/build/workspace/sources/alsa-utils as-is; if you no longer need it then please delete it manually 12345 ``` 上面命令`NOTE`提示我们在`poky/meta-mylayer/recipes-multimedia/alsa/`目录下加了一个`alsa-utils_%.bbappend`文件,生成一个我们`git commit`提交的补丁文件,然后将其拷贝到了`poky/meta-mylayer/recipes-multimedia/alsa/alsa-utils/`目录下面。 而且最后提示你说如果`poky/build/workspace/sources/alsa-util`目录没有用了你可以删除它。 ```bash build]$ cat /home/peeta/poky/meta-mylayer/recipes-multimedia/alsa/alsa-utils_%.bbappend FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-alsamixer-test-devtool-modify.patch" 1234 ``` ```bash build]$ cat /home/peeta/poky/meta-mylayer/recipes-multimedia/alsa/alsa-utils/0001-alsamixer-test-devtool-modify.patch From 79b08b5cc319156df72dd808e93b7f624d0f7058 Mon Sep 17 00:00:00 2001 From: Peeta Chen <peeta.chen@quectel.com> Date: Sat, 24 Oct 2020 16:07:20 +0800 Subject: [PATCH] alsamixer:test devtool modify --- alsamixer/cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsamixer/cli.c b/alsamixer/cli.c index 3f8f52f..fe00d31 100644 --- a/alsamixer/cli.c +++ b/alsamixer/cli.c @@ -37,7 +37,7 @@ static struct snd_mixer_selem_regopt selem_regopt = { static void show_help(void) { - puts(_("Usage: alsamixer [options]")); + puts(_("Usage: alsamixer [options], hello fulinux!")); puts(_("Useful options:\n" " -h, --help this help\n" " -c, --card=NUMBER sound card number or id\n" build]$ rm -rf workspace/sources/alsa-utils/ ``` 这里我们的工作基本上完成了,编译我们的镜像文件,做个镜像验证,确保我们的工作最后有效。 ### devtool reset 命令 使用`devtool reset`命令从工作空间层中删除`recipe`及其配置(例如,删除相应的`.bbappend`文件)。因此该命令使用需要谨慎些。因此,在运行`devtool reset`命令之前,如有必要将相关的文件保存到`workspace`目录之外的地方。不过该命令不会删除`workspace/source`目录下的内容。最后会提示你自己手动删除,参考如下: ```bash build]$ devtool reset example NOTE: Starting bitbake server... INFO: Cleaning sysroot for recipe example... INFO: Leaving source tree /home/peeta/poky/build/workspace/sources/example as-is; if you no longer need it then please delete it manually 1234 ``` 如果没有保留`poky/build/workspace/sources/example`的必要可以使用下面的命令删除 ```bash rm -rf poky/build/workspace/sources/example 1 ``` 再次使用`devtool build-image`命令编译: ```bash build]$ devtool reset example NOTE: Starting bitbake server... INFO: Cleaning sysroot for recipe example... INFO: Leaving source tree /home/peeta/poky/build/workspace/sources/example as-is; if you no longer need it then please delete it manually [peeta@tommy-OptiPlex-7060 build]$ devtool build-image core-image-sato NOTE: Starting bitbake server... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... NOTE: Reconnecting to bitbake server... NOTE: Previous bitbake instance shutting down?, waiting to retry... NOTE: Retrying server connection (#2)... Loading cache: 100% |############################################################################################| Time: 0:00:00 Loaded 1320 entries from dependency cache. Parsing recipes: 100% |##########################################################################################| Time: 0:00:00 Parsing of 782 .bb files complete (779 cached, 3 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors. Removing 1 recipes from the core2-64 sysroot: 100% |#############################################################| Time: 0:00:00 Removing 1 recipes from the qemux86_64 sysroot: 100% |###########################################################| Time: 0:00:00 INFO: Building image core-image-sato with the following additional packages: learnyocto helloyocto Loading cache: 100% |############################################################################################| Time: 0:00:01 Loaded 1321 entries from dependency cache. Parsing recipes: 100% |##########################################################################################| Time: 0:00:02 Parsing of 782 .bb files complete (779 cached, 3 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors. NOTE: Resolving any missing task queue dependencies Build Configuration: BB_VERSION = "1.46.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "3.1.2" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe" meta-altera = "master:aa24dfcb39fce3619a87ee6eef6e4296e66d2099" meta-mylayer workspace = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe" Initialising tasks: 100% |#######################################################################################| Time: 0:00:26 Sstate summary: Wanted 19 Found 1 Missed 18 Current 2753 (5% match, 99% complete) NOTE: Executing Tasks NOTE: Tasks Summary: Attempted 6850 tasks of which 6808 didn't need to be rerun and all succeeded. INFO: Successfully built core-image-sato. You can find output files in /home/peeta/poky/build/tmp/deploy/images/qemux86-64 ``` ### 运行验证 启动`qemu`虚拟机: ```bash poky]$ source oe-init-build-env build]$ runqemu qemux86-64 12 ``` 通过ssh登录: ```bash $ ssh root@192.168.7.2 ssh: connect to host 192.168.7.2 port 22: Connection refused $ ssh root@192.168.7.2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is SHA256:/hpbzg8DwVBkocBe87SoGsSatvCkQF/g26z7XS/5mIc. Please contact your system administrator. Add correct host key in /home/peeta/.ssh/known_hosts to get rid of this message. Offending RSA key in /home/peeta/.ssh/known_hosts:13 remove with: ssh-keygen -f "/home/peeta/.ssh/known_hosts" -R 192.168.7.2 RSA host key for 192.168.7.2 has changed and you have requested strict checking. Host key verification failed. $ ssh-keygen -f "/home/peeta/.ssh/known_hosts" -R 192.168.7.2 # Host 192.168.7.2 found: line 13 /home/peeta/.ssh/known_hosts updated. Original contents retained as /home/peeta/.ssh/known_hosts.old $ ssh root@192.168.7.2 The authenticity of host '192.168.7.2 (192.168.7.2)' can't be established. RSA key fingerprint is SHA256:/hpbzg8DwVBkocBe87SoGsSatvCkQF/g26z7XS/5mIc. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.7.2' (RSA) to the list of known hosts. root@qemux86-64:~# learnyocto #这个程序也是在文件系统中 [develop branch]Hello Yocto! [develop branch]learn devtool deploy-target root@qemux86-64:~# alsamixer --help Usage: alsamixer [options], hello fulinux! #依旧有我们之前加的内容 Useful options: -h, --help this help -c, --card=NUMBER sound card number or id -D, --device=NAME mixer device name -V, --view=MODE starting view mode: playback/capture/all Debugging options: -g, --no-color toggle using of colors -a, --abstraction=NAME mixer abstraction level: none/basic root@qemux86-64:~# ``` **谢谢阅读!期待您的点个赞,你的喜欢就是我持续更新的动力!**
admin
2024年2月20日 10:58
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码