嵌入式系统定制工具—yocto_project使用心得
2015-12-14 17:57
597 查看
1.yocto_project是什么?
Yocto Project是一个开源协作项目。它可以提供一些模板、工具(交叉编译工具链等)用于构建嵌入式系统。有关于yocto_project的详细介绍请看以下博客:http://www.ibm.com/developerworks/cn/linux/l-yocto-linux/
(声明:博客引自他人文章,特此说明)
2.yocto_project使用简介
2.1 获取yocto_project源码包,构建yocto_project开发环境
这里,作者只讲Ubuntu-12.04环境下的yocto_project配置,其他版本的Linux系统详见上文中的引用博客。1.下载Ubuntu-12.04必备插件,初始化yocto_project环境:
$ sudo apt-get install libsdl1.2-dev xterm sed cvs subversion coreutils texi2html \ docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils \ libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
2.使用repo获取yocto_project源码包:
1. Create a bin folder in the home directory. $ mkdir ~/bin (this step may not be needed if the bin folder already exists) $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo 2. Add the following line to the .bashrc file to ensure that the ~/bin folder is in your PATH variable. export PATH=~/bin:$PATH
$ git config --global user.name "Your Name" $ git config --global user.email "Your Email" $ git config --list
3.接下来的例子是展示如何下载NXP(飞思卡尔)厂商的BSP开发使用的yocto_project,其中fsl-release-bsp是自己创建的一个目录:
$ mkdir fsl-release-bsp $ cd fsl-release-bsp $ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.38-6UL7D_beta
2.2 使用yocto_project进行NXP(飞思卡尔)BSP开发实例说明
2.2.1 配置环境变量
1.解压下载好的yocto_project工具包,到工具包根目录下,看到如下文件:/yocto_project$ ls fsl-release-bsp_1025.tgz fsl-setup-release.sh README setup-environment sources
2.2.2 yocto_project工程下载和编译
说明:yocto_project工程编译完毕之后非常大,建议预留120G空间给yocto_project。2.选择你要编译的板子名字,指定编译生成目录,指定生成的文件系统的gui类型(-fb、-x11、-wayland)
使用示例:
$ MACHINE=<machine name> source fsl-setup-release.sh -b <build dir> -e <backend>
比如i.MX6ul平台CPU,编译生成目录指定为build-fb:gui类型为-fb:
/yocto_project$ MACHINE=imx6ulevk source fsl-setup-release.sh -b build-fb -e fb
第一次编译的时候会出现以下信息:
The local.conf file contains the machine and distro specifications: MACHINE ??= 'imx6qsabresd' DISTRO ?= 'poky' ACCEPT_FSL_EULA = "1" The MACHINE configuration can be changed by editing this file, if necessary. ACCEPT_FSL_EULA in the local.conf file indicates that you have accepted the conditions of the EULA.
反正你选择接受就是了,然后一直敲回车,直到开始编译。OK,第一次编译yocto_project非常的漫长,好一点的电脑配置都要一天,用虚拟机带Linux系统的环境进行编译的话,会让你等到蛋疼,so,你可以让电脑一直运行,然后你去泡妞吧。
3.yocto_project使用技巧和心得
3.1.如何加快yocto_project编译速度
修改build-dir/conf/local.conf配置文件,具体修改如下图:3.2 编译出错,如何重新编译?
如果编译出错,将sources/poky/meta/recipes-sato/images这个文件中的一些包去掉,在最后根据自己的需要加入相应的包比如:IMAGE_INSTALL += " nodejs"
注意:这里的包名必须按照官方提供的来,不能想当然。
3.3 编译生成的u-boot、内核、文件系统镜像在哪里?
编译完成之后,生成的u-boot、内核、文件系统镜像在build-dir/tmp/deploy/images/machine_board(imx6ulevk)目录下,如图所示:~/newland-work/yocto_project/build-fb/tmp/deploy/images/imx6ulevk$ ls fsl-image-gui-imx6ulevk-20150908123149.rootfs.ext3 fsl-image-gui-imx6ulevk.manifest zImage fsl-image-gui-imx6ulevk-20150908123149.rootfs.manifest fsl-image-gui-imx6ulevk.sdcard zImage--3.14.38-r0-imx6ul-14x14-evk-20150908123149.dtb fsl-image-gui-imx6ulevk-20150908123149.rootfs.sdcard fsl-image-gui-imx6ulevk.tar.bz2 zImage--3.14.38-r0-imx6ul-14x14-evk-csi-20150908123149.dtb fsl-image-gui-imx6ulevk-20150908123149.rootfs.tar.bz2 modules--3.14.38-r0-imx6ulevk-20150908123149.tgz zImage--3.14.38-r0-imx6ulevk-20150908123149.bin fsl-image-gui-imx6ulevk-20150908214837.rootfs.ext3 modules-imx6ulevk.tgz zImage-imx6ul-14x14-evk-csi.dtb fsl-image-gui-imx6ulevk-20150908214837.rootfs.manifest README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt zImage-imx6ul-14x14-evk.dtb fsl-image-gui-imx6ulevk-20150908214837.rootfs.sdcard u-boot.imx zImage-imx6ulevk.bin fsl-image-gui-imx6ulevk-20150908214837.rootfs.tar.bz2 u-boot-imx6ulevk.imx fsl-image-gui-imx6ulevk.ext3 u-boot-sd-2015.04-r0.imx
3.4 如何单独编译u-boot、Linux内核呢?
3.4.1 单独编译u-boot
bitbake命令单独编译u-boot:$ bitbake -c compile -f u-boot-imx
$ bitbake -c deploy -f u-boot-imx //指定编译生成的u-boot镜像到deploy
3.4.2 单独编译Linux内核
bitbake命令单独编译kernel:bitbake -c compile -f linux-imx //编译内核
bitbake -c deploy -f linux-imx //部署内核镜像到deploy目录
相关文章推荐
- U-Boot源码分析及移植-fs2410
- U-BOOT源码分析及移植
- 学习嵌入式系统需要具备的条件、方法及步骤
- 嵌人式实时操作系统uC/OS在控制工程中的应用
- U-Boot启动过程--详细版的完全分析(二)
- U-Boot-2009-03移植笔记(移植准备)
- U-Boot-2009-03移植笔记(点亮第一展灯)
- 嵌入式系统简介
- 当人们谈论物理信息系统(CPS)的时候,他们到底在说什么?
- 几种开源TCPIP协议概述--LwIP,uIP,TinyTcp和uC/IP
- U_boot 的 bootcmd 和bootargs参数详解
- Linux kernel浮点计算支持
- U-Boot移植全程指导
- 加入嵌入式系统软件开发人员需掌握技能
- Linux内核阅读--文件路径查找(一)
- Linux内核阅读--文件路径查找(二)
- 编译安装linux内核步骤
- u-boot1.1.6-undefined reference to "raise"
- STM32 入门教程 系统时钟 SysTick
- ATM32F10x启动文件的选择