当前位置:网站首页>imx6 yocto编译备忘
imx6 yocto编译备忘
2022-08-11 05:14:00 【Cupid99】
1、Git把源码下到fsl-release-bsp后,配置编译选项:
$DISTRO=fsl-imx-fb MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-fb
-b 可以指定你要将文件编译到哪个目录
2、全编译:
在build-fb目录下执行:
$bitbake core-image-base
编译出来的image在 fsl-releases-bsp/build-fb/tmp/deploy/images/imx6qsabresd目录下,包括的u-boot zImage rootfs。如不小心删掉了deploy/images/imx6qsabresd下的文件,想重新生成,执行如下步骤:
$bitbake -c cleanall core-image-base
$bitbake -c compile -f u-boot-imx
$bitbake -c deploy -f u-boot-imx //部署生成的u-boot镜像到deploy/images/imx6qsabresd
$bitbake -c compile -f linux-imx
$bitbake -c deploy -f linux-imx //部署生成的内核镜像到deploy/images/imx6qsabresd
$bitbake core-image-base //生成rootfs到deploy/images/imx6qsabresd
如有报错:
1)ERROR: Task 4 (.../fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb, do_compile) failed with exit code '1'
是因之前有修改uboot配置,只须再把uboot重新配置:
$echo "UBOOT_CONFIG = \"emmc\"" >> conf/local.conf
2)执行compile -f linux-imx报错:
.../fsl-release-bsp/build-fb/tmp/work-shared/imx6qsabresd/kernel-source is not clean, please run 'make mrproper'
则按提示的路径直接cd到kernel-source,执行make mrproper即可。
3、U-Boot配置:
$cd build-fb
$echo "UBOOT_CONFIG = \"emmc\"" >> conf/local.conf
$MACHINE=imx6qsabresd bitbake -c deploy u-boot-imx
4、生成toolchain:
$cd build-fb
$bitbake meta-toolchain
5、安装toolchain:
$cd tmp/deploy/sdk
$./fsl-imx-fb-glibc-i686-meta-toolchain-cortexa9hf-vfp-neon-toolchain-4.1.15-1.2.0.sh
Freescale i.MX Release Distro SDK installer version 4.1.15-1.2.0
================================================================
Enter target directory for SDK (default: /opt/fsl-imx-fb/4.1.15-1.2.0): (回车,选择默认安装路径)
The directory "/opt/fsl-imx-fb/4.1.15-1.2.0" already contains a SDK for this architecture.
If you continue, existing files will be overwritten! Proceed[y/N]? y
[sudo] password for test01:
Extracting SDK.................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
$ . /opt/fsl-imx-fb/4.1.15-1.2.0/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
6、安装完成后根据提示配置环境变量:
$. /opt/fsl-imx-fb/4.1.15-1.2.0/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
然后就可在源码文件夹独立编译:
1)uboot源码:fsl-releases-bsp/build-fb/tmp/work/imx6qsabresd-poky-linux-gnueabi/u-boot-imx/2015.04-r0/git
$make mx6qsabresd_defconfig
$make
2)kernel源码:fsl-releases-bsp/build-fb/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/4.1.15-r0/git
imx6q的默认配置defconfig文件在:
fsl-release-bsp\sources\meta-fsl-arm\recipes-kernel\linux\linux-fslc-mx6
可将其拷贝到内核文件夹,在menuconfig中将其load后save到.config中(load前一定要先执行toolchain的环境变量导入,否则会加载失败),再编译:
$export ARCH=arm
$make zImage
*另:完成第6步后,可单独编译测试用的*.c代码:
$echo $CC
arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi
可见CC中已配好相关的编译选项,所以用以下命令编译写的测试hello.c:
$ $CC -o hello hello.c
生成的二进制文件属性:
$file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=b5885ce459ae1de3413051cdeb8e912d5f510f9a, not stripped
边栏推荐
猜你喜欢
随机推荐
IDEA模板总结
4 Module 3: Literature Reading and Research Methods
HAVE FUN | "SOFA Planet" spacecraft plan, the latest progress of source code analysis activities
(二)性能实时监控平台搭建(Grafana+Prometheus+Jmeter)
[No 2022 Shanghai Security Officer A Certificate Exam Question Bank and Mock Exam
基础数据之double和float区别
并发编程之线程基础
实战noVNC全过程操作(包含遇到的问题和解决)
代码在线审查(添加网页批注)的实现
Delphi7 learning record - demo example
prometheus:(二)监控概述(你永远逃不出我的手掌哈哈)
Idea提升工作效率的必备技巧
redis集群模式--解决redis单点故障
Tips to make your code more and more taller and taller - code specification, you have to know
for循环使用多线程优化
tensorflow代码翻译成pytorch代码 -详细教程+案例
输入字符串,替换其中敏感词进行输出
元宇宙社交应用,靠什么吸引用户「为爱发电」?
Flask框架学习:路由的尾部斜杠
pytorch和tensorflow函数对应表