imx6 yocto编译备忘

来源:互联网 发布:百度seo排名点击软件 编辑:程序博客网 时间:2024/05/01 11:12

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



0 0
原创粉丝点击