IMX6Q-Yocto環(huán)境搭建

環(huán)境:VM10(分配300G空間,4核,4-8G內(nèi)存),ubuntu14.04.5-64bit,天嵌imx6q開發(fā)板
目標:搭建支持設(shè)備樹的yocto環(huán)境,yocto的內(nèi)核版本更高4.1.5

安裝軟件包

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev
$ 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

安裝u-boot-tools

$ sudo apt-get install u-boot-tools

設(shè)置repo()

$ mkdir ~/bin
$ cd ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo
$ chmod a+x repo
$ export PATH=~/bin:$PATH

這里需要從谷歌下載文件,有梯子的同學(xué)需要注意了,如果你的梯子只支持http代理(如lantern),這里用命令是下載不下來的,你需要手工把鏈接粘貼到瀏覽器里下載下來再粘貼到~/bin目錄下。

這是因為curl wget等命令是通過socket下載的,比http更底層,當(dāng)你的代理只是在http層代理的時候是無效的

設(shè)置git環(huán)境

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ git config --list

repo同步

$ mkdir ~/fsl-release-bsp
$ cd ~/fsl-release-bsp
$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-4.1-krogoth
$ repo sync

然后等待同步完成,如果同步過程出錯,可以用ctrl+c中斷執(zhí)行,并重新執(zhí)行repo sync直到同步成功。

編譯yocto工程

$ DISTRO=<distro name> MACHINE=<machine name> source fsl- setup-release.sh -b <build dir>

DISTRO有如下四種設(shè)置:

   fsl-imx-x11
   fsl-imx-wayland
   fsl-imx-xwayland
   fsl-imx-fb
   我選擇fsl-imx-x11
   MACHINE同樣有多種配置:
   imx6qpsabreauto
   imx6qpsabresd
   imx6ulevk
   imx6ull14x14evk
   imx6ull9x9evk
   imx6dlsabreauto
   imx6dlsabresd
   imx6qsabreauto
   imx6qsabresd
   imx6slevk
   imx6solosabreauto
   imx6solosabresd
   imx6sxsabresd
   imx6sxsabreauto
   imx7dsabresd
   我選擇imx6qsabresd。因此我執(zhí)行的最終命令如下:

$ DISTRO=fsl-imx-x11 MACHINE=imx6qsabresd source fsl-setup-release.sh -b build

編譯鏡像文件

$ bitbake fsl-image-qt5

同樣的bitbake可以編譯以下多種鏡像:
core-image-minimal
core-image-base
core-image-sato
fsl-image-machine-test
fsl-image-gui
fsl-image-qt5
編譯fsl-image-qt5的時間非常長,在網(wǎng)速飛快的情況下也需兩天,如果編譯中途出錯,可以ctrl+c中斷后重新執(zhí)行命令:

$ bitbake fsl-image-qt5

如果編譯過程中無意關(guān)掉了終端,那么重新打開終端進入fsl-release-bsp目錄后只需要執(zhí)行以下命令就可以重新進入編譯環(huán)境:

      $ source setup-environment build

編譯結(jié)束后會占用80G左右空間,虛擬機默認配置空間會不足

編譯qt5的交叉編譯工具鏈

       $ bitbake meta-toolchain-qt5

編譯完成后會在/opt/yocto/fsl-release-bsp/build/tmp/deploy/sdk目錄下
生成文件fsl-imx-fb-glibc-i686-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.0.0.sh。

執(zhí)行如下命令安裝qt5的交叉編譯工具鏈:

       $ cd ~/fsl-release-bsp/build/tmp/deploy/sdk
       $ ./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh

........
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-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

執(zhí)行如下命令安裝GCC的交叉編譯工具鏈:

 $ source setup-environment build
 $ bitbake meta-toolchain
 $ cd ~/fsl-release-bsp/build/tmp/deploy/sdk
 $ ./fsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh

一路選擇默認設(shè)置,最終將在/opt/fsl-imx-x11/4.1.15-2.1.0/目錄下生成我們所需要的工具鏈。
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-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

至此,我們所需要的所有文件均已生成,包含了uboot,kernel,rootfs以及交叉編譯qt應(yīng)用程序的交叉編譯工具。相對應(yīng)的軟件版本如下:
uboot:v2016.03
kernel:v4.1.15
qt版本:qt5.6.2
當(dāng)然最重要的是yocto編譯生成的rootfs中包括了imx6所需要的各種庫,特別是有我們所需要的能完整的支持imx6的gpu性能的qt5.6.

設(shè)置開機自動運行腳本

cd  /opt/fsl-imx-x11/4.1.15-2.1.0
chmod a+x environment-setup-cortexa9hf-neon-poky-linux-gnueabi
vim ~/.bashrc
在最后一行添加
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

這樣開機自動會把工具鏈加入環(huán)境變量中


本文來自 拖殺豬刀的 的CSDN 博客 ,全文地址請點擊此處

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容