Yocto项目的神奇地方在于,当你需要移植什么软件的时候,只需配置recipes(食谱、方法),它就会帮你编译出来!神奇吧,本文主要记录yocto项目的使用方法以及遇到的问题及解决办法。
实验环境:VM+ubuntu14.04实验平台:恩智浦imx6dl处理器Linux内核版本:3.14.28Yocto版本:1.7 注意:磁盘空间最少分配100g,推荐150g,否则会不够用!被墙了!翻墙或换个地址。
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo 官网给出的地址需要翻墙才能下载,所以换个地址:
curl http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo > ~/bin/repo
$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.10.53-1.1.0_ga
这个地址网络链接失败,官方文档地址也不管用,醉了。。。
所以经过不断搜索,找到可用地址:repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.28-1.0.0_ga
//下拉Repo管理的项目代码:repo init -u xxxx(xxxl文件决定初始化的项目) ——————以上内容采自其他博客,都是改的这个地址。
文档中有这么一句话: The command below is used to set up a directory and configuration files for the specified board and backend. After this step, the build environment is initialized and configured for building an image. $ MACHINE=<machine name> source fsl-setup-release.sh -b <build dir> -e <backend> 我采用的是: MACHINE=imx6dlsabresd source fsl-setup-release.sh -b build-wayland -e wayland 以供参考! -b、-e含义如下:
• -b sets the build directory. -b < build dir > • -e sets the graphical back end for frame buffer and direct fb images. X11 is default if no backend is set. • -e fb • -e dfb • -e wayland • -e x11配置完后,可以进行编译操作 执行:bitbake fsl-image-qt5 即可。
在config/local.conf文件添加:
LICENSE_FLAGS_WHITELIST="commercial"即可。有一个问题就是local.conf这个文件,在环境变量声明的时候会刷新,所以当执行完:
MACHINE=imx6dlsabresd source fsl-setup-release.sh -b build-wayland -e wayland后,还需要重新添加。
文件系统、内核全编译:bitbake fsl-image-qt5
内核配置: bitbake -c menuconfig -f linux-imx
编译内核命令: bitbake -c compile -f linux-imx bitbake -c deploy -f linux-imx
编译工具链: bitbake meta-toolchain bitbake meta-toolchain-qt5
清理特定软件包: bitbake -c cleansstate bluez4 bitbake -c cleansstate bluez-hcidump
清理全部: bitbake -c cleansall bitbake -c cleansstate
make menuconfig 出错: apt-get install lsb-core
查看可用chain,以blue为例: bitbake -s |grep blue
编译结果路径: fsl_6dl_source/build-wayland/tmp/deploy/images/imx6dlsabresd/
文件系统路径:(但好像改完没啥作用!) fsl_6dl_source/build-wayland/tmp/work/imx6dlsabresd-poky-linux-gnueabi/fsl-image-qt5/1.0-r0/rootfs/
yocto Linux内核路径: fsl_6dl_source/build-wayland/tmp/work/imx6dlsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git
rootfs路径: fsl_6dl_source/build-wayland/tmp/deploy/images/imx6dlsabresd/fsl-image-qt5-imx6dlsabresd.tar.bz2
配置文件位置(永久添加): fsl_6dl_source/sources/meta-fsl-bsp-release/imx/meta-fsl-demos/recipes-fsl/images/fsl-image-qt5.bb 例如添加: QT5_IMAGE_INSTALL = “ppp\ openssh-sftp-server\ \” 或: vi fsl-6dl-source/sources/meta-fsl-bsp-release/imx/meta-fsl-demos/recipes-fsl/images/fsl-image-gui.bb IMAGE_INSTALL += ” \ X11IMAGEINSTALL {X11_IMAGE_INSTALL_GRAPHICS} \ DFBIMAGEINSTALL {WAYLAND_IMAGE_INSTALL} \ ${MM_IMAGE_INSTALL} \ packagegroup-fsl-tools-gpu \ packagegroup-fsl-tools-gpu-external \ packagegroup-fsl-tools-testapps \ packagegroup-fsl-tools-benchmark \ ppp \ openssh-sftp-server \ ” 还有一个路径: /sources/meta-fsl-bsp-release/imx/meta-fsl-arm
临时配置(MACHINE=imx6dlsabresd source fsl-setup-release.sh -b build-wayland -e wayland之后就没了): fsl-6dl-source/build-wayland/conf/local.conf 例如添加: IMAGE_INSTALL_append += “openssh-sftp-server” openssh-sftp-server openssh-sftp IMAGE_INSTALL_append += “ppp”
Linux内核自启动文件,是rootfs中的路径: vim ./etc/rc2.d/S99rc.local
yocto 蓝牙文档: fsl-6dl-source/sources/meta-fsl-bsp-release/imx/meta-fsl-bluez/readme-bluez.txt
交叉编译工具环境变量声明: source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
imx6交叉编译工具: arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 –sysroot=/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi
