Write an application[/b ]- Create the source code directory of the application and the executable program directory of 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 write source code $ cd ~/my-demo/source_code $ vi hello.c
Write the following code and Save write following code and save #include37)]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
注意:如果是编译内核时配置文件使用的是 myimx6_defconfig,在这里要把 modules.tar.bz2 复制为 kernel-modules-myimx6.tar.bz2;如果是编译内核时配置文件使用的是 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)编写应用程序(write an application)
- 创建应用程序的源码目录和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
write source code
$ cd ~/my-demo/source_code
$ vi hello.c
写入以下代码并保存
write following code and save
#include37)]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-EK200 | kernel-modules-myimx6.tar.bz2 |
MY-IMX6-EK314 |
MY-IMX6-EK336 |
MY-IMX6-EK140 | kernel-modules-myimx6g.tar.bz2 |
$ cp ../modules.tar.bz2 ~/my-imx6/04_image/image-linux-31452/kernel-modules-myimx6.tar.bz2
注意:如果是编译内核时配置文件使用的是 myimx6_defconfig,在这里要把 modules.tar.bz2 复制为 kernel-modules-myimx6.tar.bz2;如果是编译内核时配置文件使用的是 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)编写应用程序(write an application)
- 创建应用程序的源码目录和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
write source code
$ cd ~/my-demo/source_code
$ vi hello.c
写入以下代码并保存
write following code and save
#includecom.cn/images/6/68/Myimx6linux3.14_build_6.5.0.3.png[/img][/url]
- Copy module package to image directory
Copy module package to image directory
Evaluation board model(development board model) | Target module package(target module package) |
MY-IMX6-EK200 | kernel-modules-myimx6.tar.bz2 |
MY-IMX6-EK314 |
MY-IMX6-EK336 |
MY-IMX6-EK140 | kernel-modules-myimx6g.tar.bz2 |
$ cp ../modules.tar.bz2 ~/my-imx6/04_image/image-linux-31452/kernel-modules-myimx6.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.
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 write source code $ cd ~/my-demo/source_code $ vi hello.c
write following code and save #includecom.cn/images/6/68/Myimx6linux3.14_build_6.5.0.3.png[/img][/url]
- Copy module package to image directory
Copy module package to image directory
Evaluation board model(development board model) | Target module package(target module package) |
MY-IMX6-EK200 | kernel-modules-myimx6.tar.bz2 |
MY-IMX6-EK314 |
MY-IMX6-EK336 |
MY-IMX6-EK140 | kernel-modules-myimx6g.tar.bz2 |
$ cp ../modules.tar.bz2 ~/my-imx6/04_image/image-linux-31452/kernel-modules-myimx6.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.
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 write source code $ cd ~/my-demo/source_code $ vi hello.c
write following code and save #include249)] Evaluation board model(development board model)
Target module package(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 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 1. 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 write source code $ cd ~/my-demo/source_code $ vi hello.c
write following code and save #include249)] [tr][td]Evaluation board model(development board model)
[/td][td]Target module package(target module package)
[/td][/tr] [tr][td]MY-IMX6-EK200[/td][td=1,3]kernel-modules-myimx6.tar.bz2[/td][/tr] [tr][td]MY-IMX6-EK314[/td][/tr] [tr][td]MY-IMX6-EK336[/td][/tr] [tr][td]MY-IMX6-EK140[/td][td]kernel-modules-myimx6g.tar.bz2[/td][/tr] [/table]$ cp ../modules.tar.bz2 ~/my-imx6/04_image/image-linux-31452/kernel-modules-myimx6.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 1. 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 write source code $ cd ~/my-demo/source_code $ vi hello.c
write following code and save #include52安装modules.tar.bz2。
Application compilation
Linux application compilationWrite an application - 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 write source code $ cd ~/my-demo/source_code $ vi hello.c
write following code and save #include52安装modules.tar.bz2。
Application compilation
Linux application compilationWrite an application - 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 write source code $ cd ~/my-demo/source_code $ vi hello.c
write following code and save #include
int main(int argc, char **argv)
{
printf("Hello, MYZR!\n");
return;
}
view code
$ cat hello.c
编译应用程序(compife application)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时产生的环境变量。
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”进行演示。
Tips:Here We demonstrate with “Qt5_NMap_CarouselDemo_1.0.tgz".
1)将代码包复制到Linux开发主机
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". This step is completed by yourself. complete this step by yourself in a proper way.
2) Decompress code package decompress code package $ cd ~/my-demo/source_code $ tar zxf Qt5_NMap_CarouselDemo_1.0.tgz Compile QT5 application(compile QT5 application)Tips: We compile with commands. 1)Enter the code directoryenter code directory 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) Check QMake check QMake $ qmake –v If the current terminal outputs "QMake version 3.0" after executing the command, it means that the cross-compilation tool is configured normally. , 37)]3)Generate Makefile create Makefile $ qmake [color=rgb(11, 0, you can see an extra Makefile with ls after execution of qmake you can see an extra Makefile with ls after execution of qmake 4)Compile compile $ make 5) Target file target file
target file $ file Qt5_NMap_CarouselDemo source file Running QT5 needs the corresponding qml file and content Running QT5 needs the corresponding qml file and content Save target executable fileBecause 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 Application packaging(package application)Instructions(instruction)The burning tool supports burning the file package “my-demo.tar.xz” to the evaluation board. 1) Package package Here we package the whole my-demo directory. $ cd ~ $ tar cjf my-demo.tar.bz2 my-demo Copy application package as target programming file $ cp my-demo.tar.bz2 ~/my-imx6/04_image/image-linux-31452/ target programming file
So far,we get a set of programming file except file system from“~/my-imx6/04_image/image-linux-31452/”. including“uboot*.imx”,myimx6*.dtb”,zImage-myimx6”,kernel-modules.tar.bz2”,my-demo.tar.bz2”,So far,we get a set of programming file except file system from“~/my-imx6/04_image/image-linux-31452/”. including“uboot*.imx”,myimx6*.dtb”,zImage-myimx6”,kernel-modules.tar.bz2”,my-demo.tar.bz2”,Now we can program the image we compiled by ourselves referring to programming manual.
Run application on the evaluation boardAfter burning the system, power on the evaluation board again, log in to the system and execute the following commands. : After the burning, supply power for evaluation board,login system and execute commands below.
- /home/root/my-demo/bin-l31452/hello.out
- export DISPLAY=:0
- /home/root/my-demo/bin-l31452/Qt5_NMap_CarouselDemo_1.0/Qt5_NMap_CarouselDemo
Appendix: file system compilationNotes and instructions: 1) The download amount during the original compilation process will exceed 4G. (Hint: You can use some of the files we downloaded to reduce the download amount and save time, which will be mentioned in 7.4). The download of the original compilation exceed 4G. (tips: you can use files we have downloaded in order to reduce downloads and save time, which is going to be mentioned in 7.4). 2) The network connection of the compilation host should preferably use a network that can access www.fackbook.com, otherwise it may be restricted by the domestic firewall and unable to download the software packages required for compilation. 3)The initial compilation may take 2 hours to unlimited time.It depends on the network state and the configuration of the host.(After a rough statistics, It took about 100 minutes to compile QT5 system on the 16-core CPU 16 G memory host except download time。) Customers are requested to decide whether to compile the file system by themselves or use the file system provided by us according to the actual situation. If the file system we provide meets the requirements, it is recommended not to compile by yourself, because the compilation process may cause many errors. Customer may decide whether to compile the file system or use the file system We provide based on the actual situation. If the file system we provide meets the requirements, you had better not to compile by yourself. Since It may be a lot of errors during compilation.
Prepare for compilationInstall software packageInstruction, 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
准备源码(prepare source code)1)下载源码
download source code
在网盘中下载 yocto__imx-3.14.52-1.1.0_ga.tar.xz
from network disk download yocto__imx-3.14.52-1.1.0_ga.tar.xz
2)创建工作目录
create working directory
$ mkdir ~/yocto
3)将源码包复制到工作目录
Copy source code package to working directory
复制“yocto__imx-3.14.52-1.1.0_ga.tar.xz”到“~/my-imx6/02_source”。
copy“yocto__imx-3.14.52-1.1.0_ga.tar.xz”to“~/my-imx6/02_source”。
这一步骤自己采取相应的方式进行
complete this step by yourself in a proper way
4) 解压源码包
decompress source code package
$ cd ~/yocto/
$ tar xf yocto__imx-3.14.52-1.1.0_ga.tar.xz
准备编译需要的软件包(Prepare software package required for compilation)提示1:如果自己网络状况好且能访问境外网站,可以跳过这一节内容。
tips1:If you have a good network and can access a foreign website ,you can skip this section.
提示2:如果是使用我们下载好的一些包,请继续往下。
tips2:If you use the package we have downloaded, please go on to the next step.
提示3:限于网络上传速度的影响及软件包的更新,我们下载的软件包目录中可能不包括
编译需要的全部软件包,但是编译中缺少的软件包编译程序会在编译过程中自行下载。
tips3:As a result of the upload speed and the update of software package , the software package directory we downloaded may not include all the required software packages for compilation.But the compiler package that is missing from compilation will be downloaded on its own during compilation process.1) Download software packagedownload software package Download downloads folder on the network disk(Path: MYZR-通用资源/yocto/downloads. Currently, the folder size is 6~8G). 2) Copy software package to BSP directory copy software package to BSP directory move downloads to “~/yocto/imx-3.14.52-1.1.0_ga” directory complete this step by yourself in a proper way.
Compilation(compilation)Update BSP(update BSP)$ cd ~/yocto/imx-3.14.52-1.1.0_ga/ $ ./bin/repo sync Compilation configuration (compilation configuration)$ DISTRO=fsl-imx-x11 MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-x11 After executing the command,the terminal will receive the output message, keep pressing "space" ,enter "y" in the final dialog Example: Do you accept the EULA you just read? (y/n) y example: Do you accept the EULA you just read? (y/n) y
Compile QT5 file system1) Execute compilation commandexecute compilation command $ bitbake fsl-image-qt5 2)Target filetarget file $ ls ./tmp/deploy/images/imx6qsabresd/fsl-image-qt5-imx6qsabresd.tar.bz2 3) Copy target filecopy target file The QT5 system file we burned is named "distro-fsl-image-qt5.tar.bz2", so you need to copy the compiled file system to "distro-fsl-image-qt5.tar.bz2". The QT5 file system name we programmed is “distro-fsl-image-qt5.tar.bz2”, So we need to copy the compiled file as “distro-fsl-image-qt5.tar.bz2”. $ cp ./tmp/deploy/images/imx6qsabresd/fsl-image-qt5-imx6qsabresd.tar.bz2 ~/my-imx6/04_image/image-linux-31452/distro-fsl-image-qt5.tar.bz2 Compile Linux file system1)Execute compile commandexecute compile command $ bitbake fsl-image-machine-test
2)Target filetarget file $ ls ./tmp/deploy/images/imx6qsabresd/fsl-image-machine-test-imx6qsabresd.tar.bz2 3) Copy target filecopy target file The QT5 system file we burned is named "distro-fsl-image.tar.bz2", so you need to copy the compiled file system to "distro-fsl-image.tar.bz2". The QT5 file system name We programmed is “distro-fsl-image.tar.bz2”, So we need to copy the compiled file as “distro-fsl-image.tar.bz2” $ cp ./tmp/deploy/images/imx6qsabresd/fsl-image-machine-test-imx6qsabresd.tar.bz2 ~/my-imx6/04_image/image-linux-31452/distro-fsl-image.tar.bz2 Compile the cross-compiler tool for QT5If you do not need a customized QT5 cross-compiler tool, skip this section. If you do not need to customize QT5 cross-compiler tool ,skip this section.
1) Execute compilation commandexecute compilation command $ bitbake meta-toolchain-qt5
2) Target filetarget file You can find the target file we compiled in the “./tmp/deploy/sdk/” directory. 3) Save target file 4)Install QT5 cross-compiler toolInstall QT5 cross-compiler tool if you need to use QT5 cross-compiler tool compiled by yourself, you have to remove QT5 cross-compiler tool which has been already Installed. Install it referring to the "Install QT5 cross-compile tool" of "Install and Configure cross-compile tool chain."