MY-IMX6 Linux-4.1.15 Compilation Reference Manual

来自明远智睿的wiki
跳转至: 导航搜索

Download related files

A7 series cross-compilation tool chain

The A7 series includes: MY-IMX6-EK140、MY-IMX6-EK140P
Location of network disc: 2.1_OS_Linux-4.1.15 -> 03_Toolchain
Installation file: fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0.sh
Description document 1: fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0.target.manifest
Description document 2: fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0.host.manifest

A9 series cross-compilation tool chain

The A9 series includes: MY-IMX6-EK200、MY-IMX6-EK314、MY-IMX6-EK336
Location of network disc: 2.1_OS_Linux-4.1.15 -> 03_Toolchain
Installation file: fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh
Description document 1: fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.target.manifest
Description document 2: fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.host.manifest

u-boot sound code

Location of network disc: 2.1_OS_Linux-4.1.15 -> 02_Source
File name: u-boot-2016.03-*.tar.bz2 (** source package version number required svn315 and above **)

Kernel sound code

Location of network disc: 2.1_OS_Linux-4.1.15 -> 02_Source
File name: linux-4.1.15-*.tar.bz2 (** source package version number needs svn368 and above **)


Install cross-compilation toolchain

MY-IMX6-A7 Series cross - compilation tool chain installation

  • Perform installation
=====> Input:
./fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0.sh 

=====> Output: 
Freescale i.MX Release Distro SDK installer version 4.1.15-2.1.0
================================================================
Enter target directory for SDK (default: /opt/fsl-imx-fb/4.1.15-2.1.0): 
=====> Input:
/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0
=====> Output: 
You are about to install the SDK to "/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0". Proceed[Y/n]? 
=====> Input:
y
=====> Output: 
Extracting SDK..................done
Setting it up...done
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-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
  • source Tool chain configuration file
=====> Input:
source /opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
  • Verify cross - compilation tool installation
=====> Input:
$CC -v

=====> Output: 
Using built-in specs.
COLLECT_GCC=arm-poky-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-cortexa7hf-neon-toolchain-4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/lto-wrapper
Target: arm-poky-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-5.3.0-r0/gcc-5.3.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr --bindir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --sbindir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --libexecdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi --datadir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/com --localstatedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/var --libdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi --includedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6ull14x14evk__fsl-imx-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/5.3.0 --with-build-time-tools=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6ull14x14evk__fsl-imx-fb/tmp/sysroots/x86_64-linux/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/not/exist --with-build-sysroot=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6ull14x14evk__fsl-imx-fb/tmp/sysroots/imx6ull14x14evk --enable-poison-system-directories --with-mpfr=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6ull14x14evk__fsl-imx-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-mpc=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6ull14x14evk__fsl-imx-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --enable-nls --with-arch=armv7-a
Thread model: posix
gcc version 5.3.0 (GCC)

MY-IMX6-A9 series cross compilation tool chain installation

  • Perform the installation
=====> Input:
./fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh

=====> Output: 
Freescale i.MX Release Distro SDK installer version 4.1.15-2.1.0
================================================================
Enter target directory for SDK (default: /opt/fsl-imx-fb/4.1.15-2.1.0)
=====> Input:
/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0
=====> Output: 
You are about to install the SDK to "/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0". Proceed[Y/n]?
=====> Input:
y
=====> Output: 
Extracting SDK..............................................................................................................................................................done
Setting it up...done
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-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
  • source Tool chain configuration file
=====> Input:
source /opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
  • Verify cross - compilation tool installation
=====> Input:
$CC -v

=====> Output: 
Using built-in specs.
COLLECT_GCC=arm-poky-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/lto-wrapper
Target: arm-poky-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-5.3.0-r0/gcc-5.3.0/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr --bindir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --sbindir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --libexecdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi --datadir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/com --localstatedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/var --libdir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi --includedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6qdlsolo__fsl-imx-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/5.3.0 --with-build-time-tools=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6qdlsolo__fsl-imx-fb/tmp/sysroots/x86_64-linux/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/not/exist --with-build-sysroot=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6qdlsolo__fsl-imx-fb/tmp/sysroots/imx6qdlsolo --enable-poison-system-directories --with-mpfr=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6qdlsolo__fsl-imx-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-mpc=/home/myzr/my-yocto/imx-4.1.15-2.1.0/imx6qdlsolo__fsl-imx-fb/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --enable-nls --with-arch=armv7-a
Thread model: posix
gcc version 5.3.0 (GCC)


u-boot Compile

Preparation before compilation

  • Create the compile working directory
=====> Input:
mkdir ~/my-work/02_source/ -p
  • Unzip the source package to the working directory
=====> Input:
tar xf u-boot-2016.03-svn*.tar.bz2 -C ~/my-work/02_source/

Compile the u-boot target file

  • Source directory
=====> Input:
cd ~/my-work/02_source/u-boot-2016.03
  • Generate the .config file for the target development board
=====> Input:
make myimx6ek200-6q-1g_defconfig

=====> Output: 
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
  • Execute compilation
=====> Input:
make 

=====> Output: 
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config.h
  UPD     include/config.h
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CHK     include/config/uboot.release
  UPD     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  ......
  LD      u-boot
  OBJCOPY u-boot-nodtb.bin
  OBJCOPY u-boot.srec
  SYM     u-boot.sym
  COPY    u-boot.bin
  CFGS    board/myzr/myimx6/myimx6a9-6q-ddr3.cfg.cfgtmp
  MKIMAGE u-boot.imx

Note: If there is a prompt "cc1: error", usually the configuration of the cross-compiler tool does not take effect. You can perform this step after the "source toolchain configuration file" in the previous "cross-compilation toolchain installation".

  • Rename target file
=====> Input:
cp u-boot.imx uboot-myimx6ek200-6q-1g.imx

Compile the u-boot environment variable script

=====> Input:
./tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "MYZR script" -d my_env_src/myimx6a9_4115_script.cmd my_env_script.scr

=====> Output: 
Image Name:   MYZR script
Created:      Thu Nov  8 11:05:19 2018
Image Type:   ARM Linux Script (uncompressed)
Data Size:    2101 Bytes = 2.05 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 2093 Bytes = 2.04 kB = 0.00 MB

object file

    • uboot-myimx6ek200-6q-1g.imx 和 my_env_script.scr .That is the compiled target file, save the two files **


Kernel compilation

Preparation before compilation

  • Create the compile working directory
=====> Input:
mkdir ~/my-work/02_source/ -p
  • Unzip the source package to the working directory
=====> Input:
tar xf linux-4.1.15-svn*.tar.bz2 -C ~/my-work/02_source/

Compile the kernel target file

  • Enter the kernel source directory
=====> Input:
cd ~/my-work/02_source/linux-4.1.15
  • Generate the.config file for the target platform
=====> Input:
make myimx6a9_defconfig

=====> Output: 
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
    • If there is an error in "Can't find default configuration "arch/x86/configs, because the configuration of the cross-compilation tool chain is not in effect, you Can perform this step after the" source tool chain configuration file "operation in the previous" cross-compilation tool chain installation **
  • Compile the kernel target file
=====> Input:
make zImage

=====> Output: 
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
  WRAP    arch/arm/include/generated/asm/auxvec.h
  ......
  AS      arch/arm/boot/compressed/piggy.lzo.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  • Kernel target file renamed
=====> Input:
cp arch/arm/boot/zImage zImage-myimx6a9

Compile the device tree object file

  • Execute the compile command
=====> Input:
make myimx6ek200-6q-1g.dtb

=====> Output: 
  DTC     arch/arm/boot/dts/myimx6ek200-6q-1g.dtb
  • Copy the device tree target file
=====> Input:
cp arch/arm/boot/dts/myimx6ek200-6q-1g.dtb ./

Compile the kernel module package

  • Execute compilation
=====> Input:
make modules

=====> Output: 
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/current.h
  ......
  LD [M]  sound/usb/snd-usb-audio.ko
  LD [M]  sound/usb/snd-usbmidi-lib.ko
  LD [M]  sound/core/snd-rawmidi.ko
  • Create the save directory for the kernel module
=====> Input:
mkdir modules
  • Install the kernel module to the specified directory
=====> Input:
make modules_install INSTALL_MOD_PATH=./modules

=====> Output: 
  INSTALL crypto/tcrypt.ko
  INSTALL drivers/dma/dmatest.ko
  INSTALL drivers/i2c/algos/i2c-algo-pca.ko
  ......
  INSTALL sound/usb/snd-usb-audio.ko
  INSTALL sound/usb/snd-usbmidi-lib.ko
  DEPMOD  4.1.15-myimx6-svn368
  • Package the kernel module file
=====> Input:
tar cjf kernel-modules-myimx6a9.tar.bz2 -C modules lib

File destination

zImage-myimx6a9、myimx6ek200-6q-1g.dtb and kernel-modules-myimx6a9.tar.bz2 are the compiled object files, save these three files

Linux C Program compilation

Prepare the source code

  • Download Demo source
    Position: 2.3_OS_Linux-4.1.15 -> 04_MY-Demo -> MY-Linux-C-Demo
    File name:hello.c
  • Copy the source code to the development host

MY-IMX6-A9 Linux C Program compilation

  • Compile the target file
=====> Input:
$CC hello.c -o hello.out

Note: If you have "not found command" information because the configuration of the cross-compilation tool chain is not in effect, you can follow the "source tool chain configuration file" action in the previous "cross-compilation tool chain installation" before performing this step

Run the Linux C target program

  • Copy the compiled hello. Out to the development board
  • Run the Linux C target program on the development board
=====> Input:
./hello.out

=====> Output:
MYZR Technology Co.,Ltd.

Web:  http://www.myzr.com.cn/
Wiki: http://wiki.myzr.com.cn/
BBS:  http://bbs.myzr.com.cn/

Tel: 0756-3628023/3628021
E-mail: [email protected]

Note: If you have “Permission denied” information,usually the target program does not have executable rights.you can add the executable rights of the target file according to the following instructions before running the program.

=====> Input:
chmod +x ./hello.out


Linux QT5 Program compilation

Prepare the source code

  • Download Demo source
    Position:2.3_OS_Linux-4.1.15 -> 04_MY-Demo
    File Names:MY-Linux-QT5-Demo-AboutUs-svn*.tar.bz2
  • Unzip the source package to the working directory
=====> Input:
tar xf MY-Linux-QT5-Demo-AboutUs-svn*.tar.bz2 -C ~/my-work/02_source/

MY-IMX6-A9 QT Program compilation

  • Source directory
=====> Input:
cd ~/my-work/02_source/AboutUs/
  • Generate a Makefile
=====> Input:
qmake

Note1: If there is message“the'qamke' command was not found ,because the configuration of cross-compilation toolchain does not take effect **

    • Note2: If there is message “oe-device-extra.pri: No such file or directory” ,Execute 'qmake'after executing the following command:
=====> Input:
touch /opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/oe-device-extra.pri
  • Compile the target file
=====> Input:
make

=====> Output: 
/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/uic widget.ui -o ui_widget.h
......
arm-poky-linux-gnueabi-g++  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-O1 -o AboutUs main.o widget.o qrc_source.o moc_widget.o   -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lEGL -lpthread

Run the Linux QT5 target program

  • Copy the compiled AboutUs onto the development board
  • Run the QT5 target program on the development board
=====> Input:
./AboutUs -platform eglfs

Note: If you have "Permission denied" information, usually the target program does not have executable rights, you can add the executable rights of the target file according to the following instructions before running the program

=====> Input:
chmod +x ./AboutUs
  • Operation result You can see the Logo of MYZR and some information on the development board display.


-------------------------------------------------------------------------------- 
* ZhuHai MYZR Technology CO.,LTD.
* Latest Update: 2018/11/08  
* Supporter: Tang Bin
--------------------------------------------------------------------------------