Yocto 完整编译
source oe-init-build-env
bitbake core-image-minimal
Yocto 查询包名
bitbake -s | grep XXX
// 获取rockchip相关包
:~/rk3568/yocto$ bitbake -s | grep rockchip
android-tools-conf-rockchip :1.0-r0
gstreamer1.0-rockchip :1.0-r0
linux-rockchip :5.10-r0 :4.19-r0
rockchip-alsa-config :1.0-r0
rockchip-libmali :1.0-r0
rockchip-librga :1.0-r0
rockchip-mpp :1.0-r0
rockchip-npu :1.0-r0
rockchip-rkaiq :1.0-r0
udev-conf-rockchip :1.0-r0
Yocto 确定包的源码目录
// 从包名确认内核名为linux-rockchip
:~/rk3568/yocto$ bitbake -e linux-rockchip | grep ^S=
S="/homexx/yocto/rk3568/yocto/build/tmp/work-shared/roc-rk3568-pc/kernel-source"
Yocto 确定包的下载地址
:~/rk3568/yocto$ bitbake -e linux-rockchip | grep ^SRC_URI=
SRC_URI=" git://gitlab.com/firefly-linux/kernel.git;protocol=https;nobranch=1;branch=rk356x/firefly; file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/files/cgroups.cfg file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/files/ext4.cfg file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0001-perf-bench-Share-some-global-variables-to-fix-build-.patch file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0002-perf-parse-events-Use-asprintf-instead-of-strncpy-to.patch file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0003-perf-tests-bp_account-Make-global-variable-static.patch file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0004-libtraceevent-Fix-build-with-binutils-2.35.patch file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0005-init-do_mounts.c-Retry-all-fs-after-failed-to-mount-.patch file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0006-HACK-drm-rockchip-Force-enable-legacy-cursor-update.patch file:///home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-kernel/linux/linux-rockchip_4.19/0007-HACK-drm-rockchip-Prefer-non-cluster-overlay-planes.patch"
Yocto 编译内核
bitbake linux-rockchip -C compile
输出目录:build/tmp/deploy/images/
Yocto 查询当前recipe哪些tasks可执行
bitbake linux-rockchip -c listtasks
···
do_config_analysis
do_configure Configures the source by enabling and disabling any build-time and configuration options for the software being built
do_deploy Writes deployable output files to the deploy directory
do_deploy_setscene Writes deployable output files to the deploy directory (setscene version)
do_deploy_source_date_epoch
do_deploy_source_date_epoch_setscene (setscene version)
do_devpyshell Starts an interactive Python shell for development/debugging
do_devshell Starts a shell with the environment set up for development/debugging
do_diffconfig Compares the old and new config files after running do_menuconfig for the kernel
do_fetch Fetches the source code
do_fixup_wks
do_install Copies files from the compilation directory to a holding area
do_kernel_checkout Checks out source/meta branches for a linux-yocto style kernel
do_kernel_configcheck Validates the kernel configuration for a linux-yocto style kernel
do_kernel_configme Assembles the kernel configuration for a linux-yocto style kernel
do_kernel_link_images Creates a symbolic link in arch/$arch/boot for vmlinux and vmlinuz kernel images
do_kernel_metadata
···
Yocto recipe 说明
在 Yocto 中,有几种不同类型的 recipe,其中两种主要的是 Package recipe 和 Image recipe。
- Package recipe:
Package recipe 用于定义如何构建一个软件包。它包括了软件包的元数据(比如名称、版本、许可证等)以及构建软件包所需的步骤(比如下载源码、配置、编译、安装等)。Package recipe 的文件扩展名通常是 .bb,例如 foo_1.0.bb。Package recipe 可以被其他 recipe 继承或扩展,以添加额外的配置或修改构建过程。 - Image recipe:
Image recipe 用于定义如何构建一个完整的镜像,包括了操作系统的核心组件、用户空间工具、库以及其他资源。Image recipe 定义了如何从各种软件包中组装这些组件,并将它们打包成一个可用于在目标设备上运行的镜像文件。Image recipe 的文件扩展名通常是 .bb,例如 myimage.bb。Image recipe 也可以被其他 recipe 继承或扩展,以添加额外的配置或修改构建过程。
Yocto 编译报错
ERROR: hello-3-r0 do_package_qa: QA Issue: File /usr/bin/helloYocto in package hello doesn't have GNU_HASH (didn't pass LDFLAGS?)
File /usr/bin/zlibtest in package hello doesn't have GNU_HASH (didn't pass LDFLAGS?) [ldflags]
ERROR: hello-3-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in: /home4/yocto/rk3568/yocto/build/tmp/work/armv8a-poky-linux/hello/3-r0/temp/log.do_package_qa.3744892
ERROR: Task (/home4/yocto/rk3568/yocto/build/../meta-rockchip/recipes-graphics/helloYocto/hello.bb:do_package_qa) failed with exit code '1'
解决办法:TARGET_CC_ARCH += “${LDFLAGS}”
参考:
-
bitbake手册
bibake官方手册 -
yocto
rk3588平台构建一个基础镜像
什么是yocto
yocto使用技巧
yocto项目将编译目标安装到rootfs的过程