1 mdm
1.1 屏蔽mdm sysvinit的console输出
- uboot传入参数的时候传入console=null,这样Linux启动信息没有了
- 还需要在Linux配置中去掉Support for console on AMBA serial port
- 文件系统/etc/inittab文件里注释掉::respawn:/sbin/getty -L ttyS000 115200 vt100 -n root -I "Auto login as root ..."
1.2 Ubuntu service
/usr/sbin/service
是个脚本,只是没有后缀.sh。
2 cmake
2.1 Yocto SDK
Download SDK install script, then run the script to install SDK to target directory.
SDK shell
2.2 musl libc dynamic-linker
$CC -o test test.c \
-Xlinker \
--dynamic-linker=/lib/ld-musl-aarch64.so.1
2.3 静态库
CMakeLists.txt中add_library()不指定SHARED,就是编译静态库。
2.4 静态可执行
CMakeLists.txt中target_link_libraries()添加-static,就是编译静态可执行。
3 bitbake
3.1 bitbake
.bb file
S = <Makefile directory>
SRCREV = <gerrit commit id>
SRC_URI += "file://0001-xxx.patch;patchdir=${WORKDIR}/git \
file://0002-xxx.patch;patchdir=${WORKDIR}/git"
0001-xxx.patch and 0002-xxx.patch are under current folder files.
3.2 Yocto添加应用程序
[26th-Apr-2022]
rm /path/to/bitbake.lock
For user space Makefile, refer to 3.3 of Android开发环境搭建和编译系统。
meta-xxx/recipes-bsp/hello-bsp/files/COPYRIGHT
meta-xxx/recipes-bsp/hello-bsp/files/Makefile
meta-xxx/recipes-bsp/hello-bsp/files/include
meta-xxx/recipes-bsp/hello-bsp/files/src
meta-xxx/recipes-bsp/hello-bsp.bb
SRC_URI = "file://COPYRIGHT"
SRC_URI += "file://Makefile"
SRC_URI += "file://include"
SRC_URI += "file://src"
S = "${WORKDIR}"
TARGET_CC_ARCH += "${LDFLAGS}"
do_compile () {
echo "${WORKDIR}"
oe_runmake
}
do_install () {
install -d ${D}${sbindir}
# hello_bsp name comes from Makefile.
install -m 0755 hello_bsp ${D}${sbindir}/
}
bitbake -c cleanall hello-bsp
bitbake hello-bsp
Build whole project:
core-image-base.bb
IMAGE_INSTALL_append = "hello-bsp"
bitbake core-image-base
3.3 bitbake cmake
[26th-Apr-2022]
Need install ninja-build in Linux PC, otherwise cmake could not generate Makefile under build directory.
The following first command in bb file is used to mkdir build folder for cmake, second command is used to pass parameters to cmake. Don't need add do_compile() and do_install() for cmake in bb file.
inherit pkgconfig cmake
EXTRA_OECMAKE += "-DXXX"
bitbake -c cleanall hello-bsp
bitbake hello-bsp
"inherit cmake" will call cmake.bbclass of OE build system.
3.4 standalone cmake showcase
wget http://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz
1) export BBPATH=/path/to/project
2) conf/bitbake.conf
CACHE = "${TMPDIR}/cache"
STAMP = "${TMPDIR}/stamps"
TMPDIR = "${TOPDIR}/tmp"
B = "${TMPDIR}"
T = "${TMPDIR}/work"
BBFILES = "${BBPATH}/xxx.bb"
3) classes/base.bbclass
addtask build
4) classes/cmake.bbclass
S="${PWD}/xxx/build"
cmake_do_build() {
. /path/to/environment-setup-aarch64-poky-linux
export SYSROOT_PATH=/path/to/sysroots/aarch64-poky-linux
rm -rf "${S}"
mkdir "${S}"
cd "${S}"
cmake ../ \
-DCMAKE_INSTALL_PREFIX=$SYSROOT_PATH/usr/ \
${EXTRA_OECMAKE}
make
make install
}
EXPORT_FUNCTIONS do_build
5) xxx.bb
DESCRIPTION="build xxx"
PN="xxx"
EXTRA_OECMAKE +="-Dxxx=1"
inherit cmake
6)
bitbake -s
bitbake xxx -vDD
3.5 Linux为普通用户添加Docker权限
apt install docker.io
sudo groupadd docker
sudo usermod -aG docker <username>
newgrp docker
3.6 bitbake列出所有的target
bitbake-layers show-recipes |grep <xxx>
bitbake <xxx>
4 codeSonar
MISRA C:2012
1) Create Project Tree and Create Project in codeSonar webserver.
2) csshiftleft/scripts/config.ini
ProjectName = the code sonar reports directory in webserver.
3) csshiftleft/build/module_build.sh
Add build commands to this file.
4) build
cd csshiftleft/scripts/
python3 codesonarbuild.py
codeSonar userName and Password are the Windows login userName and Password.
5 ctest
add_definitions()需要加在ADD_SUBDIRECTORY()之前,不然宏不起作用。
ADD_SUBDIRECTORY(unittest)
enable_testing()
add_test(
NAME ${BINARY_NAME}
COMMAND ${BINARY_NAME} # It will call gtest main()
<arg_list>)
Yocto bitbake and codeSonar
2025/2/24 0:51:33
来源:https://blog.csdn.net/zoosenpin/article/details/118381030
浏览:
次
关键词:Yocto bitbake and codeSonar
版权声明:
本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。
我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com
-
【linux核心命令】
-
C++17 中的 std::to_chars 和 std::from_chars:高效且安全的字符串转换工具
-
python中轻量级 LLM 应用开发框架 Promptic 如何有效进行对话管理?
热文排行
- 《警世贤文》摘抄:处人篇、受恩篇、宽人篇、听劝篇、劝善篇(多读书、多看报、少吃零食多睡觉)
- Vmess协议是什么意思? VLESS与VMess有什么区别?
- Android显示系统(08)- OpenGL ES - 图片拉伸
- `git restore` 和 `git checkout` 用于丢弃工作区的改动, `git switch` 和 `git checkout` 用来切换分支
- nccl 03 记 回顾:从下载,编译到调试 nccl-test
- 【CVE-2024-38077】核弹级Windows RCE漏洞如何自检并修复该漏洞(附批量漏洞检测工具及分析伪代码)
- windows11 ,ubuntu20.04双系统,ubuntu没有wifi的解决方式
- 【HW必备】用友NC-Cloud存在17处漏洞合集
- AD24设计步骤
- ctfshow-web入门-php特性(web132-web136)