MY-IMX6-EK140P Linux-4.1.15 Build Manual
目录
- 1 Document instruction
- 2 Prepare source code and relevant file
- 3 Install cross compiler tool chain
- 4 U-Boot compilation
- 5 Compile kernel
- 6 Application compilation
- 7 Target programming file
Document instruction
System environment instruction
- CUP architeture of host used for compilation:64bit
- System of host:Linux
- Linux release version:Ubuntu
- Ubuntu version type:server version
- Ubuntu version no.:12.04.5
- Ubuntu system type:x86-64
Note: The development host should use ubuntu 12.04.5 x86-64(desktop and server version are available),Using other distribution of Linux and other versions of
Ubuntu may encounter unnecessary problems .
0peration instruction
1)The line in the document which begins with “$”,which is followed by the Linux command.
2)All the Linux commands in the document are recommended to be entered into the host manually for execution.(Copying ,pasting to the host directly to execute may fail).
3)In all the Linux execution commands of the document,if the next character after the space is "-",(example:sudo apt-get –y install),please enter into Linux host to execute manually.(Copying ,pasting to the host directly to execute may fail ).
4)Any line of Linux commands whichi is not finished is recommended to be entered into the host for execution. (Because copy or paste commands cannot contain special character such as "line breaks").
5)Note whether the execution result is consistent with the document image when you enter and execute the command. check the command was entered incorrectly or failed to execute.
6)Please follow the document strictly to compile for the first time.Otherwise ,there may be unexpected error.
Screenshots instruction
To make the view look neat and tidy , the command prompt in the screenshot should use myzr$ uniformly.
Linux command in the image
In the image of the document, you can see the input Linux command visually from the lines that start with “myzr$”.
Important information instruction
To avoid our customers wasting time and energy when they encounter unnecessary problems in building development environment and compiling process,it is recommended to use “vb43-u12045-serv-amd64” virtual machine system released by MYZR.
Details refered to 《MYZR virtual machine system instruction》
Prepare source code and relevant file
Source code
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 Source code | linux Source code |
---|---|---|
MY-IMX6-EK200 | u-boot-2016.03.tar.xz | linux-4.1.15.tar.xz |
MY-IMX6-EK314 | ||
MY-IMX6-EK336 | ||
MY-IMX6-EK140 | ||
MY-IMX6-EK140P |
Cross compiler tool file
Linux program cross compiler tool:gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar
Linux cross compiler tool configuration file:gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf-env
Creat working directory
1)Cource 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-4115 –p
4)Application directory
$ mkdir ~/my-demo
Install cross compiler tool chain
Install Linux cross compiler tool chain
1)Enter cross compiler tool chain directory
$ cd ~/my-imx6/03_tools/
2)Copy Linux cross compiler tool to directory
copy gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar to“~/my-imx6/03_tools”,complete this step by yourself in a proper way.
3)Uncompress Linux Cross Compilation Tools
$ tar xf gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar
4)Copy cross compiler tool configuration file
Copy gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf-env to“~/my-imx6/03_tools”,complete this step by yourself in a proper way.
5)Check installation
$ source gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf-env
$ ${CROSS_COMPILE}gcc –v
U-Boot compilation
Prepare compilation
Copy source code package to development host
Copy“u-boot source code”downloaded to “~/my-imx6/02_source”of Linux development host.
Complete this step by yourself in a proper way.
Decompress u-boot source code package
$ cd ~/my-imx6/02_source/
$ tar xf u-boot-2016.03__svn121.tar.xz
Compilation
Validate compiler configuration file
$ source ~/my-imx6/03_tools/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf-env
Enter u-boot source code directory
$ cd ~/my-imx6/02_source/u-boot-2016.03
Remove u-boot temporary files
Configure u-boot
- Configuration of development and its corresponding compiler:
Development board main model | CPU type-memory capacity | Architeture of processor | Corresponding u-boot configuration |
---|---|---|---|
MY-IMX6-EK200 | i.MX 6Quad - 1G | Cortex-A9 | myimx6ek200-6q-1g_defconfig |
i.MX 6Quad - 2G | Cortex-A9 | myimx6ek200-6q-2g_defconfig | |
i.MX 6Quad - 512M | Cortex-A9 | myimx6ek200-6q-512m_defconfig | |
i.MX 6QuadPlus - 1G | Cortex-A9 | myimx6ek200-6qp-1g_defconfig | |
i.MX 6QuadPlus - 2G | Cortex-A9 | myimx6ek200-6qp-2g_defconfig | |
i.MX 6QuadPlus - 512M | Cortex-A9 | myimx6ek200-6qp-512m_defconfig | |
i.MX 6Solo - 1G | Cortex-A9 | myimx6ek200-6s-1g_defconfig | |
i.MX 6Solo - 256M | Cortex-A9 | myimx6ek200-6s-256m_defconfig | |
i.MX 6Solo - 512M | Cortex-A9 | myimx6ek200-6s-512m_defconfig | |
i.MX 6DualLite - 1G | Cortex-A9 | myimx6ek200-6u-1g_defconfig | |
i.MX 6DualLite - 2G | Cortex-A9 | myimx6ek200-6u-2g_defconfig | |
i.MX 6DualLite - 512M | Cortex-A9 | myimx6ek200-6u-512m_defconfig | |
MY-IMX6-EK314 | i.MX 6Quad - 1G | Cortex-A9 | myimx6ek314-6q-1g_defconfig |
i.MX 6Quad - 2G | Cortex-A9 | myimx6ek314-6q-2g_defconfig | |
i.MX 6Quad- 512M | Cortex-A9 | myimx6ek314-6q-512m_defconfig | |
i.MX 6QuadPlus - 1G | Cortex-A9 | myimx6ek314-6qp-1g_defconfig | |
i.MX 6QuadPlus - 2G | Cortex-A9 | myimx6ek314-6qp-2g_defconfig | |
i.MX 6QuadPlus - 512M | Cortex-A9 | myimx6ek314-6qp-512m_defconfig | |
i.MX 6Solo- 1G | Cortex-A9 | myimx6ek314-6s-1g_defconfig | |
i.MX 6Solo - 256M | Cortex-A9 | myimx6ek314-6s-256m_defconfig | |
i.MX 6Solo - 512M | Cortex-A9 | myimx6ek314-6s-512m_defconfig | |
i.MX 6DualLite - 1G | Cortex-A9 | myimx6ek314-6u-1g_defconfig | |
i.MX 6DualLite - 2G | Cortex-A9 | myimx6ek314-6u-2g_defconfig | |
i.MX 6DualLite - 512M | Cortex-A9 | myimx6ek314-6u-512m_defconfig | |
MY-IMX6-EK336 | i.MX 6Quad - 1G | Cortex-A9 | myimx6ek336-6q-1g_defconfig |
i.MX 6Quad - 2G | Cortex-A9 | myimx6ek336-6q-2g_defconfig | |
i.MX 6Quad - 512M | Cortex-A9 | myimx6ek336-6q-512m_defconfig | |
MY-IMX6-EK140 | i.MX 6UltraLite -256M -eMMC | Cortex-A7 | myimx6ek140-6g-256m-emmc_defconfig |
i.MX 6UltraLite -256M -Nand | Cortex-A7 | myimx6ek140-6g-256m-nand_defconfig | |
i.MX 6UltraLite - 512M -eMMC | Cortex-A7 | myimx6ek140-6g-512m-emmc_defconfig | |
i.MX 6UltraLite - 512M -Nand | Cortex-A7 | myimx6ek140-6g-512m-nand_defconfig | |
i.MX 6UlltraLite Full - 256M-eMMC | Cortex-A7 | myimx6ek140-6y-256m-emmc_defconfig | |
i.MX 6UlltraLite Full - 512M-Nand | Cortex-A7 | myimx6ek140-6y-256m-nand_defconfig | |
i.MX 6UlltraLite Full - 512M-eMMC | Cortex-A7 | myimx6ek140-6y-512m-emmc_defconfig | |
i.MX 6UlltraLite Full - 512M-Nand | Cortex-A7 | myimx6ek140-6y-512m-nand_defconfig | |
MY-IMX6-EK140P | i.MX 6UltraLite -256M -eMMC | Cortex-A7 | myimx6ek140p-6g-256m-emmc_defconfig |
i.MX 6UltraLite -256M -Nand | Cortex-A7 | myimx6ek140p-6g-256m-nand_defconfig | |
i.MX 6UltraLite - 512M -eMMC | Cortex-A7 | myimx6ek140p-6g-512m-emmc_defconfig | |
i.MX 6UltraLite - 512M -Nand | Cortex-A7 | myimx6ek140p-6g-512m-nand_defconfig | |
i.MX 6ULL - 256M-eMMC | Cortex-A7 | myimx6ek140p-6y-256m-emmc_defconfig | |
i.MX 6ULL - 512M-Nand | Cortex-A7 | myimx6ek140p-6y-256m-nand_defconfig | |
i.MX 6ULL - 512M-eMMC | Cortex-A7 | myimx6ek140p-6y-512m-emmc_defconfig | |
i.MX 6ULL - 512M-Nand | Cortex-A7 | myimx6ek140p-6y-512m-nand_defconfig |
- MYIMX6EK200-6Q-1G configuration example:
$ make myimx6ek200-6q_defconfig
Execute compilation
$ make
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
Tips: u-boot compiling process may take one or two minutes.
Target file
- Compile file
You can get the compiled file u-boot .imx with ls command after compilation.
$ ls
- Target file
The corresponding target file name for u-boot configuration of MY-IMX6 series evaluation board is shown in the table below:
myimx6ek200-6q-1g_defconfig | uboot-myimx6ek200-6q-1g.imx |
myimx6ek200-6q-2g_defconfig | uboot-myimx6ek200-6q-2g.imx |
myimx6ek200-6q-512m_defconfig | uboot-myimx6ek200-6q-512m.imx |
myimx6ek200-6qp-1g_defconfig | uboot-myimx6ek200-6qp-1g.imx |
myimx6ek200-6qp-2g_defconfig | uboot-myimx6ek200-6qp-2g.imx |
myimx6ek200-6qp-512m_defconfig | uboot-myimx6ek200-6qp-512m.imx |
myimx6ek200-6s-1g_defconfig | uboot-myimx6ek200-6s-1g.imx |
myimx6ek200-6s-256m_defconfig | uboot-myimx6ek200-6s-256m.imx |
myimx6ek200-6s-512m_defconfig | uboot-myimx6ek200-6s-512m.imx |
myimx6ek200-6u-1g_defconfig | uboot-myimx6ek200-6u-1g.imx |
myimx6ek200-6u-2g_defconfig | uboot-myimx6ek200-6u-2g.imx |
myimx6ek200-6u-512m_defconfig | uboot-myimx6ek200-6u-512m.imx |
myimx6ek314-6q-1g_defconfig | uboot-myimx6ek314-6q-1g.imx |
myimx6ek314-6q-2g_defconfig | uboot-myimx6ek314-6q-2g.imx |
myimx6ek314-6q-512m_defconfig | uboot-myimx6ek314-6q-512m.imx |
myimx6ek314-6qp-1g_defconfig | uboot-myimx6ek314-6qp-1g.imx |
myimx6ek314-6qp-2g_defconfig | uboot-myimx6ek314-6qp-2g.imx |
myimx6ek314-6qp-512m_defconfig | uboot-myimx6ek314-6qp-512m.imx |
myimx6ek314-6s-1g_defconfig | uboot-myimx6ek314-6s-1g.imx |
myimx6ek314-6s-256m_defconfig | uboot-myimx6ek314-6s-256m.imx |
myimx6ek314-6s-512m_defconfig | uboot-myimx6ek314-6s-512m.imx |
myimx6ek314-6u-1g_defconfig | uboot-myimx6ek314-6u-1g.imx |
myimx6ek314-6u-2g_defconfig | uboot-myimx6ek314-6u-2g.imx |
myimx6ek314-6u-512m_defconfig | uboot-myimx6ek314-6u-512m.imx |
myimx6ek336-6q-1g_defconfig | uboot-myimx6ek336-6q-1g.imx |
myimx6ek336-6q-2g_defconfig | uboot-myimx6ek336-6q-2g.imx |
myimx6ek336-6q-512m_defconfig | uboot-myimx6ek336-6q-512m.imx |
myimx6ek140-6g-256m-emmc_defconfig | uboot-myimx6ek140-6g-256m-emmc.imx |
myimx6ek140-6g-256m-nand_defconfig | uboot-myimx6ek140-6g-256m-nand.imx |
myimx6ek140-6g-512m-emmc_defconfig | uboot-myimx6ek140-6g-512m-emmc.imx |
myimx6ek140-6g-512m-nand_defconfig | uboot-myimx6ek140-6g-512m-nand.imx |
myimx6ek140-6y-256m-emmc_defconfig | uboot-myimx6ek140-6y-256m-emmc.imx |
myimx6ek140-6y-256m-nand_defconfig | uboot-myimx6ek140-6y-256m-nand.imx |
myimx6ek140-6y-512m-emmc_defconfig | uboot-myimx6ek140-6y-512m-emmc.imx |
myimx6ek140-6y-512m-nand_defconfig | uboot-myimx6ek140-6y-512m-nand.imx |
myimx6ek140p-6g-256m-emmc_defconfig | uboot-myimx6ek140p-6g-256m-emmc.imx |
myimx6ek140p-6g-256m-nand_defconfig | uboot-myimx6ek140p-6g-256m-nand.imx |
myimx6ek140p-6g-512m-emmc_defconfig | uboot-myimx6ek140p-6g-512m-emmc.imx |
myimx6ek140p-6g-512m-nand_defconfig | uboot-myimx6ek140p-6g-512m-nand.imx |
myimx6ek140p-6y-256m-emmc_defconfig | uboot-myimx6ek140p-6y-256m-emmc.imx |
myimx6ek140p-6y-256m-nand_defconfig | uboot-myimx6ek140p-6y-256m-nand.imx |
myimx6ek140p-6y-512m-emmc_defconfig | uboot-myimx6ek140p-6y-512m-emmc.imx |
myimx6ek140p-6y-512m-nand_defconfig | uboot-myimx6ek140p-6y-512m-nand.imx |
We need to copy the compilied file u-boot.imx as our target file name.:
Copy the generated file u-boot.imx from the compilation of myimx6ek200-6q_defconfig as target file.):
$ cp u-boot.imx ~/my-imx6/04_image/image-linux-4115/uboot-myimx6ek200-6q.imx
Compile kernel
Prepare compilation
Copy source code package to development host
Copy “linux source code”downloaded to “~/my-imx6/02_source”of Linux development host.
Complete this step by yourself in a proper way.
Decompress linux source code package
$ cd ~/my-imx6/02_source/
$ tar xf linux-4.1.15__svn189.tar.xz
Kernel compilation configuration
Validate compilfer configuration file
$ source ~/my-imx6/03_tools/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf-env
Remove kernel temporary file
- Enter linux source code directory
$ cd ~/my-imx6/02_source/linux-4.1.15
- Remove temporary file
Kernel configuration
- Kernel configuration file
Evaluation board model | Configuration file |
---|---|
MY-IMX6-EK200 | myimx6a9_defconfig |
MY-IMX6-EK314 | |
MY-IMX6-EK336 | |
MY-IMX6-EK140 | myimx6a7_defconfig |
MY-IMX6-EK140P |
$ make myimx6a9_defconfig
If what compified is kernel of MY-IMX6-EK140,please use $ make myimx6a7_defconfig.
Take myimx6a9_defconfig as an example.
Compile kernel
- Execute compilation
- Complete compilation
- Target file
arch/arm/boot/zImage is the kernel file Compiled,you can check file information with ls command.
$ ls arch/arm/boot/zImage -la
Note: The kernel file name which is going to be programed and started is “zImage-myimx6” or “zImage-myimx6a7”, So we should copy zImage as zImage-myimx6a9 or zImage-myimx6a7
$ cp arch/arm/boot/zImage ~/my-imx6/04_image/image-linux-4115/zImage-myimx6a9 (A9)
or
$ cp arch/arm/boot/zImage ~/my-imx6/04_image/image-linux-4115/zImage-myimx6a7 (A7)
Compile device tree
The correspondence between the type of evaluation board and device tree is shown below:
Development main model | CPU type-memory capacity | Corresponding device tree file |
---|---|---|
MY-IMX6-EK200 | i.MX 6Quad - 1G | myimx6ek200-6q-1g.dtb |
i.MX 6Quad - 2G | myimx6ek200-6q-2g.dtb | |
i.MX 6Quad - 512M | myimx6ek200-6q-512m.dtb | |
i.MX 6QuadPlus - 1G | myimx6ek200-6qp-1g.dtb | |
i.MX 6DualLite - 2G | myimx6ek200-6qp-2g.dtb | |
i.MX 6DualLite - 512M | myimx6ek200-6qp-512m.dtb | |
i.MX 6Solo - 1G | myimx6ek200-6s-1g.dtb | |
i.MX 6Solo - 256M | myimx6ek200-6s-256m.dtb | |
i.MX 6Solo - 512M | myimx6ek200-6s-512m.dtb | |
i.MX 6DualLite - 1G | myimx6ek200-6u-1g.dtb | |
i.MX 6DualLite - 2G | myimx6ek200-6u-2g.dtb | |
i.MX 6DualLite - 512M | myimx6ek200-6u-512m.dtb | |
MY-IMX6-EK314 | i.MX 6Quad - 1G | myimx6ek314-6q-1g.dtb |
i.MX 6Quad - 2G | myimx6ek314-6q-2g.dtb | |
i.MX 6Quad - 512M | myimx6ek314-6q-512m.dtb | |
i.MX 6QuadPlus - 1G | myimx6ek314-6qp-1g.dtb | |
i.MX 6DualLite - 2G | myimx6ek314-6qp-2g.dtb | |
i.MX 6DualLite - 512M | myimx6ek314-6qp-512m.dtb | |
i.MX 6Solo - 1G | myimx6ek314-6s-1g.dtb | |
i.MX 6Solo - 256M | myimx6ek314-6s-256m.dtb | |
i.MX 6Solo - 512M | myimx6ek314-6s-512m.dtb | |
i.MX 6DualLite - 1G | myimx6ek314-6u-1g.dtb | |
i.MX 6DualLite - 2G | myimx6ek314-6u-2g.dtb | |
i.MX 6DualLite - 512M | myimx6ek314-6u-512m.dtb | |
MY-IMX6-EK336 | i.MX 6Quad - 1G | myimx6ek336-6q-1g.dtb |
i.MX 6Quad - 2G | myimx6ek336-6q-2g.dtb | |
i.MX 6Quad - 512M | myimx6ek336-6q-512m.dtb | |
MY-IMX6-EK140 | i.MX 6UltraLite - 256M -eMMC | myimx6ek140-6g-256m-emmc.dtb |
i.MX 6UltraLite - 256M -Nand | myimx6ek140-6g-256m-nand.dtb | |
i.MX 6UltraLite - 512M -eMMC | myimx6ek140-6g-512m-emmc.dtb | |
i.MX 6UltraLite - 512M -Nand | myimx6ek140-6g-512m-nand.dtb | |
i.MX 6ULL - 256M -eMMC | myimx6ek140-6y-256m-emmc.dtb | |
i.MX 6ULL - 256M -Nand | myimx6ek140-6y-256m-nand.dtb | |
i.MX 6ULL - 512M -eMMC | myimx6ek140-6y-512m-emmc.dtb | |
i.MX 6ULL - 512M -Nand | myimx6ek140-6y-512m-nand.dtb | |
MY-IMX6-EK140P | i.MX 6UltraLite - 256M -eMMC | myimx6ek140p-6g-256m-emmc.dtb |
i.MX 6UltraLite - 256M -Nand | myimx6ek140p-6g-256m-nand.dtb | |
i.MX 6UltraLite - 512M -eMMC | myimx6ek140p-6g-512m-emmc.dtb | |
i.MX 6UltraLite - 512M -Nand | myimx6ek140p-6g-512m-nand.dtb | |
i.MX 6ULL - 256M -eMMC | myimx6ek140p-6y-256m-emmc.dtb | |
i.MX 6ULL - 256M -Nand | myimx6ek140p-6y-256m-nand.dtb | |
i.MX 6ULL - 512M -eMMC | myimx6ek140p-6y-512m-emmc.dtb | |
i.MX 6ULL - 512M -Nand | myimx6ek140p-6y-512m-nand.dtb |
- Take MY-IMX6-EK200-6Q-1G as example
- Target file
You can browse the target device tree file information from compilation with ls command:
$ ls arch/arm/boot/dts/myimx6ek*.dtb
- Copy device tree file to image directory
$ cp arch/arm/boot/dts/myimx6ek*.dtb ~/my-imx6/04_image/image-linux-4115/
Compile module
- Compile module command
- 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-EK200 | kernel-modules-myimx6a9.tar.bz2 |
MY-IMX6-EK314 | |
MY-IMX6-EK336 | |
MY-IMX6-EK140 | kernel-modules-myimx6a7.tar.bz2 |
MY-IMX6-EK140P |
$ cp ../modules.tar.bz2 ~/my-imx6/04_image/image-linux-4115/kernel-modules-myimx6a9.tar.bz2
Note:when you compile the Kernel If the configuration file you use is myimx6a9_defconfig, here you should
- Copy modules.tar.bz2 as kernel-modules-myimx6a9.tar.bz2.If the configuration file is myimx6a7_defconfig,you should Copy modules.tar.bz2 as kernel-modules-myimx6a7.tar.bz2.
Application compilation
Linux application compilation
Write an application
- Create application source code directory and Linux-4.1.15 executable program directory
$ mkdir ~/my-demo/source_code -p
$ mkdir ~/my-demo/bin-l4115 -p
- Write source code
$ cd ~/my-demo/source_code
$ vi hello.c
Write following code and save
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello, MYZR!\n");
return;
}
- View code
$ cat hello.c
Compile application
- Configure environment variables
$ source ~/my-imx6/03_tools/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf-env
- Compile
$ ${CROSS_COMPILE}gcc hello.c -o hello.out
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
You can see the property of target file hello.out.
Save target executable file
$ mv hello.out ~/my-demo/bin-l31452/
Package application
Instruction
Programming tool supports to program “my-demo.tar.xz” file package to evaluation board.So We package applications We need as “my-demo.tar.xz”.while where “my-demo.tar.xz” will be programmed ,refer to 《programming manual》。
Package application
1)Package
Here We package the whole my-demo directory.
$ cd ~
$ tar cjf my-demo.tar.bz2 my-demo
2)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”.
Now we can program the image we compiled by ourselves referring to 《 programming instruction》.