最近安装YOCTO被折腾的不行,昨天终于成功摸索出编译方法,故整理一个中文版。
首先丢两个链接
【原创】-- YOCTO安装及编译过程--【持续整理】
Yocto构建P1010rdb开发板linux系统
本人主要是进行编译环境的安装,主要参考第一个链接和官网整合包的说明文档。
安装包使用 SDK 1.7 LINUX版本 Ubuntu 14.04(CentOS6.7 7.0均 未能成功安装) 目标芯片 P1010RDB (1.6同 2.0不支持 其他版本未知)。
注:在飞思卡尔的官网搜索SDK 1.7可以找到安装包,安装包大小3.08GB注意文件名,不要选错。
下载好的安装包解压后如下图所示。如果发现解压内容与下面不同那么你就是下错了。其中START_HERE.html就是安装步骤的说明。
除了安装包,我们还需要准备一个LINUX系统。这里我使用的是VMware Workstation Pro虚拟机。使用虚拟机建立系统的时候要注意系统的硬盘不要选择在30GB以下,因为整个安装需要可能不止20GB加上其他需要,这里我选择的是40GB的空间。
系统安装过程不再累述。至此,进入系统前的准备工作就完成了。
进入系统后,使用快捷键Ctrl + Alt + T 打开终端
在安装之前,我们还需要做另外一点准备工作。
1、第一次使用 Ubuntu 时,可能需要设置ROOT密码
$ sudo passwd root
-----------------------本段来自Yocto构建P1010rdb开发板linux系统-------------------
2、给用户增加sudo权限,运行环境配置脚本。
$ vim /etc/sudoers
在99行加入
(用户名) ALL=(ALL) ALL - - - - - -- - - -- -- - - -- -- - - - - 注:本人测试这句不是必须
(用户名) ALL = NOPASSWD: /usr/bin/yum
---------------------------------------------------------------------------------------------
下面开始正式安装
1、首先把ISO包拷贝到虚拟机中。
2、打开START_HERE.html 第一步位置在 Getting Started with Yocto Project/Contents/nstall the SDK
(这一步主要是创建源文件挂载目录 /mnt/yocto_cdrom 这里建议选择自己建的目录,这样不容易遇到权限问题)
- Mount the ISO on your machine:
$ sudo mount -o loop QorIQ-SDK-<version>-<target>-<yyyymmdd>-yocto.iso /mnt/cdrom
- As a non-root user, install Yocto Project(此处执行安装文件,中间可能会让你选安装位子什么的直接回车安装到默认位置就行,其他就一路确定就行。):
$ /mnt/cdrom/install
3、说明文档位置Getting Started with Yocto Project/Contents/Host Environment
-
$ cd <yocto_install_path>
-
$ ./scripts/host-prepare.sh 这一步没改权限一定报错
-
$ source ./fsl-setup-poky -m <machine> 这里选择需要的模块 我填的是p1010rdb
-----------------------------------------------------此处为1.7支持列表,各版本在此位置都有有支持说明--------------------------------------------
Supported QorIQ (PowerPC) machines: t1040qds-64b t1040qds b4420qds-64b b4420qds b4860qds-64b b4860qds bsc9131rdb bsc9132qds c293pcie p1010rdb p1020rdb p1021rdb p1022ds p1023rdb p1025twr p2020ds p2020rdb p2041rdb p3041ds p4080ds p5020ds-64b p5020ds p5040ds-64b p5040ds t1024qds-64b t1024qds t1024rdb-64b t1024rdb t1040rdb-64b t1040rdb t1042rdb-64b t1042rdb t1042rdb-pi-64b t1042rdb-pi t2080qds-64b t2080qds t2080rdb-64b t2080rdb t4160qds-64b t4160qds t4240qds-64b t4240qds t4240rdb-64b t4240rdb
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4、说明文档位置Getting Started with Yocto Project/Contents/Builds and .. /Installing the Toolchain
-
$ cd <yocto_install_path>/build_<machine>_release/
-
$ source ./fsl-setup-poky -m <machine>
-
$ bitbake fsl-toolchain
-
$ cd build_<machine>_release/tmp/deploy/sdk
-
$ ./fsl-networking-eglibc-<host-system>-<core>-toolchain-<release>.sh 这一步非常慢。。。
以上安装过程保持联网,需要从外网下载。
5、
To use the installed toolchain, go the the location where the toolchain is installed and source the environment-setup-<core> file. This will set up the correct path to the build tools and also export some environment variables relevant for development (eg. $CC, $ARCH, $CROSS_COMPILE, $LDFLAGS etc).
To invoke the compiler, use the $CC variable (eg. $CC <source files>).
编译之前先$source 文件,如下图 ,注意这两个文件长得很像,选紫色圈的文件,别选黄色的,会报错
默认位子在 /opt/fsl-networking/QorIQ-SDK-V1.7
之后可以编译了.c文件了,还有一点注意 $ CC x.c 其中 CC是大写
--------目前进行到这一步,下一步准备下载到板子验证是否成功