明遠智睿 IMX6-CB314源碼編譯

發(fā)布時(shí)間:2018-4-17 14:50    發(fā)布者:明遠智睿Lan
源碼文件(source code)
評估板對應的Linux版本及對應的源碼文件見(jiàn)下表:
The corresponding Linux version of the evaluation board and the corresponding source code files are shown in the table below:
評估板型號
(evaluation board model)
u-boot源碼文件
(u-boot source code)
linux源碼文件
(linux source code)
MY-IMX6-EK200u-boot-2015.04.tar.xzlinux-3.14.52.tar.xz
MY-IMX6-EK314
MY-IMX6-EK336
MY-IMX6-EK140

交叉編譯工具文件(cross compiler tool file)
Linux程序交叉編譯工具:gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
Linux program cross compiler tool:gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
Linux交叉編譯工具配置文件:gcc-linaro-arm-linux-gnueabihf-492-env
Linux cross compiler tool configuration file:gcc-linaro-arm-linux-gnueabihf-492-env
QT5程序交叉編譯工具:fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh
QT5 program compiler tool:fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh

創(chuàng )建工作目錄(creat working directory)
1)源碼目錄
source code directory
$ mkdir ~/my-imx6/02_source –p

2)工具目錄
tool directory
$ mkdir ~/my-imx6/03_tools –p

3)鏡像目錄
image directory
$ mkdir ~/my-imx6/04_image –p

$ mkdir ~/my-imx6/04_image/image-linux-31452 –p

4)應用程序目錄
application diretory
$ mkdir ~/my-demo


安裝交叉編譯工具鏈(install cross compiler tool chain)
安裝Linux交叉編譯工具鏈(install Linux cross compiler tool chain)
1)進(jìn)入交叉編譯工具鏈目錄
enter cross compiler tool chain diretory
$ cd ~/my-imx6/03_tools/
2)復制Linux交叉編譯工具到目錄
copy Linux cross compiler tool to directory
將gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz復制到“~/my-imx6/03_tools”,這一步自己采取相應的方式完成。

3)解壓Linux交叉編譯工具
copy gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz to“~/my-imx6/03_tools”,complete this step by yourself in a proper way。
$ tar xf gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz

4)復制交叉編譯工具配置文件
copy cross compiler tool configuration file
將gcc-linaro-arm-linux-gnueabihf-492-env復制到“~/my-imx6/03_tools”,這一步自己采取相應的方式完成。
copy gcc-linaro-arm-linux-gnueabihf-492-env to“~/my-imx6/03_tools”,complete this step by yourself in a proper way。
5)檢查安裝
check installation
$ source gcc-linaro-arm-linux-gnueabihf-492-env
$ ${CROSS_COMPILE}gcc –v


安裝QT5交叉編譯工具(install QT5 cross compiler tool)
1)進(jìn)入交叉編譯工具鏈目錄
enter cross compiler tool chain directory
$ cd ~/my-imx6/03_tools/

2)執行安裝命令
execute installation command
$ sh fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh
3)選擇安裝路徑
choose installation path
執行安裝命令后會(huì )出現如下提示信息:
after execution of installation command,there will be a following prompt message:
Enter target directory for SDK (default: /opt/fsl-imx-x11/3.14.52-1.1.0):
這時(shí)按“回車(chē)(Enter)”鍵,我們保持默認的安裝路徑。
then press“Enter”key,let's keep defauted installation path。
4)確認安裝路徑
confirm installation path
之后,會(huì )提示如下信息:
afterwards,there will be a following prompt message:
You are about to install the SDK to "/opt/fsl-imx-x11/3.14.52-1.1.0". Proceed[Y/n]? 這時(shí)輸入“Y”并按“回車(chē)(Enter)”鍵表示確認。
then enter“Y”and press“Enter”key for confirmation。

U-Boot編譯(U-Boot compilation)

準備編譯(prepare compilation)復制源碼包到開(kāi)發(fā)主機中(copy source code package to development host)
將下載的“u-boot源碼”復制到Linux開(kāi)發(fā)主機的“~/my-imx6/02_source”。
copy“u-boot source code”downloaded to “~/my-imx6/02_source”of Linux development host。
這一步自己采取相應的方式完成。
complete this step by yourself in a proper way。

解壓u-boot源碼包(decompress u-boot source code package)
$ cd ~/my-imx6/02_source/
$ tar xf u-boot-2015.04.tar.xz


使編譯配置文件生效(validate compiler configuration file)
MYIMX6EK200-6Q-1G configuration example:
$ make myimx6ek200-6q_config

執行編譯(execute compilation)
$ make
提示:這里為了提高編譯速度,在make后面加了“-j4”。這里編譯的Linux主機是雙核4線(xiàn)程的,所以“-j”后面用了4,也就是采用4線(xiàn)程編譯!-j”后面的數字可以根據系統資源分配,但是不應該超過(guò)編譯主機最大支持的線(xiàn)程數。
Tips:To speed up the compilation,add "-j4" after make.The Linux host used to compile is dual-core ,4 threads .So "-j" is followed by 4, which takes 4 threads to compile. The number behind "-j" is allocated based on system resources,but It should not exceed the maximum threads the host support.

  • 編譯完成
complete compilation
提示:u-boot編譯過(guò)程大概需要一、兩分鐘時(shí)間。
Tips: u-boot compiling process may take one or two minutes。


目標文件(target file)
  • 編譯文件
compile file
編譯完成后通過(guò)ls命令即可看到編譯得到的文件u-boot.imx
you can get the compiled file u-boot .imx with ls command after compilation.
$ ls
我們需要將編譯得到的u-boot.imx復制為我們的目標文件名。
We need to copy the compilied file u-boot.imx as our target file name.:
這里以MY-IMX6-EK200-6Q為例(把配置myimx6ek200-6q_config編譯生成的u-boot.imx復制為目標文件):
Copy the generated file u-boot.imx from the compilation of myimx6ek200-6q_config as target file.):
$ cp u-boot.imx ~/my-imx6/04_image/image-linux-31452/uboot-myimx6ek200-6q.imx

編譯內核(compile kernel)
準備編譯(prepare compilation)復制源碼包到開(kāi)發(fā)主機中(copy source code package to development host)
將下載的“l(fā)inux源碼”復制到Linux開(kāi)發(fā)主機的“~/my-imx6/02_source”。
copy “l(fā)inux source code”downloaded to “~/my-imx6/02_source”of Linux development host。
這一步自己采取相應的方式完成。
complete this step by yourself in a proper way。

解壓linux源碼包(decompress linux source code package)
$ cd ~/my-imx6/02_source/
$ tar xf linux-3.14.52.tar.xz


內核編譯配置(kernel compilation configuration)使編譯配置文件生效(validate compilfer configuration file)
$ source ~/my-imx6/03_tools/gcc-linaro-arm-linux-gnueabihf-492-env


清除內核臨時(shí)文件(remove kernel temporary file)
  • 進(jìn)入linux源碼目錄
enter linux source code directory
$ cd ~/my-imx6/02_source/linux-3.14.52

  • 清除臨時(shí)文件
remove temporary file
$ make distclean


內核配置(kernel configuration)
  • 內核配置文件
kernel configuration file
評估板型號
(evaluation board model)
配置文件
(configuration file)
MY-IMX6-EK200myimx6_defconfig
MY-IMX6-EK314
MY-IMX6-EK336
MY-IMX6-EK140myimx6ul_defconfig
$ make myimx6_defconfig
如果是編譯 MY-IMX6-EK140 的內核,請使用 $ make myimx6ul_defconfig
if what compified is kernel of MY-IMX6-EK140,please use $ make myimx6ul_defconfig
這里以 myimx6_defconfig 為例。
take myimx6_defconfig as an example。


編譯內核(compife kernel)
  • 執行編譯
execute compilation
$ make zImage

  • 編譯完成
complete compilation

  • 目標文件
target file
arch/arm/boot/zImage即為編譯得到的內核文件,使用ls命令可查看文件信息。
arch/arm/boot/zImage is the kernel file compifed,you can check file information with ls command。
$ ls arch/arm/boot/zImage -la

注意:我們燒錄及啟動(dòng)的內核文件名為“zImage-myimx6”,所以我們需要把zImage復制為zImage-myimx6。
Note: The kernel file name which is going to be programed and started is “zImage-myimx6”, So we should Copy zImage as zImage-myimx6
$ cp arch/arm/boot/zImage ~/my-imx6/04_image/image-linux-31452/zImage-myimx6


編譯設備樹(shù)(compife device tree)
$ make myimx6ek200-6q.dtb

  • 目標文件
target file
使用ls命令可查看編譯得到的目標設備樹(shù)文件信息:
You can browse the target device tree file information from compilation with ls command:
$ ls arch/arm/boot/dts/myimx6ek*.dtb

復制設備樹(shù)文件到鏡像目錄
Copy device tree file to image directory
$ cp arch/arm/boot/dts/myimx6ek*.dtb ~/my-imx6/04_image/image-linux-31452/

編譯模塊 (compife module)
  • 編譯模塊命令
compile module command
$ make modules

  • 安裝模塊到指定目錄
Install module to the specified directory
$ make modules_install INSTALL_MOD_PATH=./modules

  • 打包模塊文件
package the module file
$ cd modules
$ tar cjf ../modules.tar.bz2 *

  • 復制模塊包到鏡像目錄
Copy module package to image directory
評估板型號
(development board model)
目標模塊包
(target module package)
MY-IMX6-EK200kernel-modules-myimx6.tar.bz2
MY-IMX6-EK314
MY-IMX6-EK336
MY-IMX6-EK140kernel-modules-myimx6g.tar.bz2
$ cp ../modules.tar.bz2 ~/my-imx6/04_image/image-linux-31452/kernel-modules-myimx6.tar.bz2
注意:如果是編譯內核時(shí)配置文件使用的是 myimx6_defconfig,在這里要把 modules.tar.bz2 復制為 kernel-modules-myimx6.tar.bz2;如果是編譯內核時(shí)配置文件使用的是 myimx6ul_defconfig,在這里要把 modules.tar.bz2 復制為 kernel-modules-myimx6g.tar.bz2
Note:when you compile the Kernel If the configuration file you use is myimx6_defconfig, here you should Copy modules.tar.bz2 as kernel-modules-myimx6.tar.bz2.If the configuration file is myimx6ul_defconfig,you should Copy modules.tar.bz2 as kernel-modules-myimx6g.tar.bz2.

應用程序編譯(application compilation)
Linux應用程序編譯(Linux application compilation)編寫(xiě)應用程序(write an application)
  • 創(chuàng )建應用程序的源碼目錄和Linux-3.14.52的可執行程序目錄
Create application source code directory and Linux-3.14.52 executable program directory
$ mkdir ~/my-demo/source_code -p

$ mkdir ~/my-demo/bin-l31452 -p

  • 編寫(xiě)源代碼
write source code
$ cd ~/my-demo/source_code
$ vi hello.c
寫(xiě)入以下代碼并保存
write following code and save
#include

int main(int argc, char **argv)
{
  printf("Hello, MYZR!\n");

  return;
}
  • 查看代碼
view code

$ cat hello.c
編譯應用程序(compife application)
  • 配置環(huán)境變量
Configure environment variables
$ source ~/my-imx6/03_tools/gcc-linaro-arm-linux-gnueabihf-492-env

  • 編譯
compife
$ ${CROSS_COMPILE}gcc hello.c -o hello.out

注意:上面的命令有包含“$”號,即“${CROSS_COMPILE}gcc”,是引用我們source時(shí)產(chǎn)生的環(huán)境變量。
Note:The above command contains “$”,which is “${CROSS_COMPILE}gcc”. It is the environment variable generated when referring to our source.。
  • 目標文件
target file
$ file hello.out

可以看到目標文件 hello.out 的屬性。
you can see the property of target file hello.out。

保存目標可執行文件(save target executable file)
$ mv hello.out ~/my-demo/bin-l31452/


QT應用程序編譯 (QT application compife)準備QT5程序代碼(prepare QT5 program code)
提示:這里我們使用“Qt5_NMap_CarouselDemo_1.0.tgz”進(jìn)行演示。
Tips:Here We demonstrate with “Qt5_NMap_CarouselDemo_1.0.tgz".
1)將代碼包復制到Linux開(kāi)發(fā)主機
copy code package to Linux development host
將代碼包“Qt5_NMap_CarouselDemo_1.0.tgz”復制到“~/my-demo/source_code”。
copy code package“Qt5_NMap_CarouselDemo_1.0.tgz”to“~/my-demo/source_code”。
這一步自己采取相應的操作完成。
complete this step by yourself in a proper way。
2)解壓代碼包
decompress code package
$ cd ~/my-demo/source_code
$ tar zxf Qt5_NMap_CarouselDemo_1.0.tgz


編譯QT5程序(compile QT5 application)
提示:我們將使用命令行編譯。
Tips: We compile with commands。
1)進(jìn)入代碼目錄
enter code directory
提示:我們前面將代碼包“Qt5_NMap_CarouselDemo_1.0.tgz”解壓在“~/my-demo/source_code”。
tips:first we decompress code package“Qt5_NMap_CarouselDemo_1.0.tgz”to“~/my-demo/source_code”。
$ cd ~/my-demo/source_code/Qt5_NMap_CarouselDemo_1.0/
2)檢查QMake
check QMake
$ qmake –v

如果執行命令后當前終端有輸出“QMake version 3.0”,則表示交叉編譯工具配置正常。 If the current terminal output has “QMake version 3.0” after the execution of command,that means cross compiler is Configured normally..
否則需要執行下面的命令:
Otherwise you need to execute the command below:
$ source /opt/fsl-imx-x11/3.14.52-1.1.0/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
3)生成Makefile文件
creat Makefile
$ qmake

執行qmake后通過(guò)ls可以看到多了Makefile文件
you can see an extra Makefile with ls after execution of qmake
4)編譯
compile
$ make

5)目標文件
target file
  • 可執行文件
target file
$ file Qt5_NMap_CarouselDemo

  • 資源文件
source file
QT5程序的運行需要對應的qml文件和content
Running QT5 needs the corresponding qml file and content


保存目標可執行文件(save target executable file)
由于QT5程序的運行需要對應的qml文件和content文件,這里我們?yōu)榱瞬僮鞯暮?jiǎn)潔,直接將整個(gè)目錄復制到目標目錄
Because running QT5 program requires qml file and content file, here We copy the entire directory to the target directory for simplicity.
$ cp ../Qt5_NMap_CarouselDemo_1.0 ~/my-demo/bin-l31452/ -a

準備編譯 (Prepare for compilation)
安裝軟件包(install software package)
說(shuō)明,Yocto編譯依賴(lài)一些軟件包,所以需要在開(kāi)發(fā)主機上進(jìn)行安裝。
instruction,Yocto compilation relies on some software package. So you need to Install them on the host。
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo \
gcc-multilib build-essential chrpath socat

$ 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

$ sudo apt-get install uboot-mkimage





本文地址:http://selenalain.com/thread-524618-1-1.html     【打印本頁(yè)】

本站部分文章為轉載或網(wǎng)友發(fā)布,目的在于傳遞和分享信息,并不代表本網(wǎng)贊同其觀(guān)點(diǎn)和對其真實(shí)性負責;文章版權歸原作者及原出處所有,如涉及作品內容、版權和其它問(wèn)題,我們將根據著(zhù)作權人的要求,第一時(shí)間更正或刪除。
您需要登錄后才可以發(fā)表評論 登錄 | 立即注冊

關(guān)于我們  -  服務(wù)條款  -  使用指南  -  站點(diǎn)地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權所有   京ICP備16069177號 | 京公網(wǎng)安備11010502021702
快速回復 返回頂部 返回列表
午夜高清国产拍精品福利|亚洲色精品88色婷婷七月丁香|91久久精品无码一区|99久久国语露脸精品|动漫卡通亚洲综合专区48页