【Yocto】devtool修改源代码
说明
本文接在【Yocto】BitBake入门之镜像中的HelloWorld之后完成。
修改源代码
如果想要修改Poky项目中的源代码,可以依赖于devtool
工具,这里以修改busybox为例。
首先创建workspace:
jw@X1C:~/code/poky/build$ devtool create-workspace
NOTE: Starting bitbake server...
jw@X1C:~/code/poky/build$ tree workspace/workspace/
├── conf
│ └── layer.conf
└── README1 directory, 2 files
使用devtool create-workspace
除了创建上述的workspace,还会修改conf/bblayers.conf
,它的作用是将workspace作为一个Layer添加到项目中:
jw@X1C:~/code/poky/build$ cat conf/bblayers.conf
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"BBPATH = "${TOPDIR}"
BBFILES ?= ""BBLAYERS ?= " \/home/jw/code/poky/meta \/home/jw/code/poky/meta-poky \/home/jw/code/poky/meta-yocto-bsp \/home/jw/code/poky/meta-mylayer \/home/jw/code/poky/build/workspace \"
还可以通过bitbake-layers
查看:
jw@X1C:~/code/poky/build$ bitbake-layers show-layers
NOTE: Starting bitbake server...
layer path priority
==========================================================================
meta /home/jw/code/poky/meta 5
meta-poky /home/jw/code/poky/meta-poky 5
meta-yocto-bsp /home/jw/code/poky/meta-yocto-bsp 5
meta-mylayer /home/jw/code/poky/meta-mylayer 6
workspace /home/jw/code/poky/build/workspace 99
其次就是添加配方到workspace目录:
jw@X1C:~/code/poky/build$ devtool modify busybox
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 1424 entries from dependency cache.
INFO: SRC_URI contains some conditional appends/prepends - will create branches to represent these
NOTE: Resolving any missing task queue dependenciesBuild Configuration:
BB_VERSION = "1.49.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"
DISTRO_VERSION = "3.2+snapshot-f13e17656248021debea6fe01564c40af27271d1"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp
meta-mylayer
workspace = "master:f13e17656248021debea6fe01564c40af27271d1"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: Adding local source files to srctree...
INFO: Source tree extracted to /home/jw/code/poky/build/workspace/sources/busybox
WARNING: SRC_URI is conditionally overridden in this recipe, thus several devtool-override-* branches have been created, one for each override that makes changes to SRC_URI. It is recommended that you make changes to the devtool branch first, then checkout and rebase each devtool-override-* branch and update any unique patches there (duplicates on those branches will be ignored by devtool finish/update-recipe)
INFO: Using source tree as build directory since that would be the default for this recipe
INFO: Recipe busybox now set up to build from /home/jw/code/poky/build/workspace/sources/busybox
这样busybox的代码就被下载到build/workspace/sources/busybox
目录下了,这个时候在构建项目,则使用的是workspace目录下的源码,如下所示:
jw@X1C:~/code/poky/build$ bitbake core-image-minimal
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 1424 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:00
Parsing of 810 .bb files complete (809 cached, 1 parsed). 1424 targets, 42 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependenciesBuild Configuration:
BB_VERSION = "1.49.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"
DISTRO_VERSION = "3.2+snapshot-f13e17656248021debea6fe01564c40af27271d1"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp
meta-mylayer
workspace = "master:f13e17656248021debea6fe01564c40af27271d1"Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01
Sstate summary: Wanted 5 Found 1 Missed 4 Current 1088 (20% match, 99% complete)
NOTE: Executing Tasks
NOTE: busybox: compiling from external source tree /home/jw/code/poky/build/workspace/sources/busybox
NOTE: Tasks Summary: Attempted 3113 tasks of which 3083 didn't need to be rerun and all succeeded.
下一个就是修改源码,比如修改coreutils/date.c
,增加helloworld打印:
puts("helloworld\n");
然后再构建项目,发现会报错:
jw@X1C:~/code/poky/build$ bitbake core-image-minimal
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 1424 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:01
Parsing of 810 .bb files complete (809 cached, 1 parsed). 1424 targets, 42 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependenciesBuild Configuration:
BB_VERSION = "1.49.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"
DISTRO_VERSION = "3.2+snapshot-f13e17656248021debea6fe01564c40af27271d1"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp
meta-mylayer
workspace = "master:f13e17656248021debea6fe01564c40af27271d1"Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01
Sstate summary: Wanted 5 Found 1 Missed 4 Current 1088 (20% match, 99% complete)
NOTE: Executing Tasks
NOTE: busybox: compiling from external source tree /home/jw/code/poky/build/workspace/sources/busybox
ERROR: busybox-1.32.0-r0 do_package: Error executing a python function in exec_python_func() autogenerated:The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>0001:*** 0002:ptest_update_alternatives(d)0003:
File: '/home/jw/code/poky/meta/classes/ptest.bbclass', lineno: 98, function: ptest_update_alternatives0094: for alt_name, alt_link, alt_target, _ in alternatives:0095: # Some alternatives are for man pages,0096: # check if the alternative is in PATH0097: if os.path.dirname(alt_link) in bin_paths:*** 0098: os.symlink(alt_target, os.path.join(ptest_bindir, alt_name))0099:}0100:0101:do_configure_ptest_base[dirs] = "${B}"0102:do_compile_ptest_base[dirs] = "${B}"
Exception: FileExistsError: [Errno 17] File exists: '/bin/busybox.suid' -> '/home/jw/code/poky/build/tmp/work/core2-64-poky-linux/busybox/1.32.0-r0/package/usr/lib/busybox/ptest/bin/login'ERROR: Logfile of failure stored in: /home/jw/code/poky/build/tmp/work/core2-64-poky-linux/busybox/1.32.0-r0/temp/log.do_package.12918
ERROR: Task (/home/jw/code/poky/meta/recipes-core/busybox/busybox_1.32.0.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3096 tasks of which 3090 didn't need to be rerun and 1 failed.Summary: 1 task failed:/home/jw/code/poky/meta/recipes-core/busybox/busybox_1.32.0.bb:do_package
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
但是如果再次编译,又能够编译成功了:
jw@X1C:~/code/poky/build$ bitbake core-image-minimal
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 1424 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:00:00
Parsing of 810 .bb files complete (809 cached, 1 parsed). 1424 targets, 42 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependenciesBuild Configuration:
BB_VERSION = "1.49.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"
DISTRO_VERSION = "3.2+snapshot-f13e17656248021debea6fe01564c40af27271d1"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp
meta-mylayer
workspace = "master:f13e17656248021debea6fe01564c40af27271d1"Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:01
Sstate summary: Wanted 5 Found 1 Missed 4 Current 1088 (20% match, 99% complete)
NOTE: Executing Tasks
NOTE: busybox: compiling from external source tree /home/jw/code/poky/build/workspace/sources/busybox
NOTE: Tasks Summary: Attempted 3113 tasks of which 3090 didn't need to be rerun and all succeeded.
运行镜像之后执行date
命令,结果如下:
可以看到代码修改成功了。
【Yocto】devtool修改源代码相关推荐
- AOP开发——在不修改源代码的前提下,对类里面的方法进行增强 : 前置 后置 环绕 异常||如何得到目标方法的参数和返回值
AOP开发 @Transactionl 在不修改源代码的前提下,对类里面的方法进行增强 前置 后置 环绕 异常 创建项目前引入aop的包 <dependency> <grou ...
- apache缺省banner_NSFOCUS建议您采取以下措施以降低威胁: * 修改源代码或者配置文件改变SSH服务的缺省banner。...
NSFOCUS建议您采取以下措施以降低威胁: * 修改源代码或者配置文件改变SSH服务的缺省banner. 垃圾绿盟,老扫漏洞出来要整改 1.在 /etc/下创建一个文件 ssh_banner_cha ...
- apk反编译修改源代码_单击即可将APK反编译为源代码
apk反编译修改源代码 In this tutorial I will guide you how to decompile apk to source code in just one click. ...
- 免ROOT使用Frida(不修改源代码)
在 非ROOT环境下使用Frida及调试 中通过修改smail代码实现在非ROOT的情况下使用Frida.前面提到这种方式有一个明显的缺点就是要修改smali源代码.这篇文章主要来说怎样在不修改源代码 ...
- Android aar 包修改源代码和布局资源id
Android aar 包修改源代码和布局资源id 原文地址 https://www.jianshu.com/p/bdb62f36bc62 注:本项目基于 Android Studio 讲解,Inte ...
- VueI18n国际化vm._watchers[0].constructor未定义的解决办法:修改源代码吧
初始化的时候根本没这个_watchers对象,报错如下 我尝试nvm use 了19.0.0到16.0.0的node都提示 15.0.0太低,不支持好多对象 因此修改了D:\xuexi\cms-vue ...
- Pytorch.Dataloader 详细深度解读和微修改源代码心得
关于pytorch 的dataloader库,使用pytorch 基本都会用到的一个库 今天遇到了一个问题,我在训练的时候,采用batch_size =2 去训练,最终的loss抖动太大了,看得出来应 ...
- 谷歌浏览器控制台修改源代码并保存修改到文件
修改代码并保存 F12/cmd+opt+i打开控制台: 点击sources中的Filesystem中的add folder to workspace,让控制台关联上需要调试的项目文件夹: 在对应编辑器 ...
- 苹果元数据被拒回复邮件多久_苹果2.1被拒怎么办?最新最详细的2.1大礼包应对修改源代码过审指南...
前言 在解决 Guideline 4.3 问题 (可参考:<2019年首次接单遇到"苹果4.3被拒问题"看我是如何解决的>)后, 我们今天来解决 Guideline 2 ...
最新文章
- web 平台搭建-LNMP-源码包(CentOS-6)
- java JDBC连接Oracle数据库的方法
- 【android开发】 修改控件Spinner内容的字体大小 颜色等属性
- go mod导入本地包
- 为什么新闻联播的主持人不低头念稿,难道都背下来了?
- 阿里涉足零售 IoT 的猜想
- ros安装详细教程+问题解决
- 基于Hive数据仓库的标签画像实战
- JavaScript自动切换并播放视频 | Tampermonkey
- Gradle 2.0 用户指南翻译——第二十三章. Java 插件
- html插入腾讯视频自动播放,腾讯视频代码在哪里 腾讯视频嵌入网页的方法
- 在html中input是什么意思,在HTML代码中input是什么意思?
- DICOM MPPS 的原理及应用(Principle and Application of DICOM MPPS)
- 【1235. 规划兼职工作】
- T解 湖南师大附中集训 模拟考试1
- 智能小区安防子系统实现
- 以太坊交易中的nonce和confirmation
- 【小知识】字符编码笔记:ASCII,Unicode 和 UTF-8
- 【虹科ELPRO - EMS系统】实现苏州某医药仓库温湿度自动监测 - 100% GxP合规(下)
- ssm+redis缓存配置