MY-IMX6-A9 Linux-3.0.35 Compile reference manual

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

Download relevant documents

Cross-compilation tool chain

Location of network disc: 2.1_OS_Linux-3.0.35 -> 03_Toolchain
File one: gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2
File two: environment-setup-cortexa9hf-neon-fsl-linux-gnueabi

u-boot source code

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

Kernel source code

Location of network disc: 2.1_OS_Linux-3.0.35 -> 02_Source
File Names: linux-3.0.35-*.tar.bz2 (** source package version number required svn31 and above **)


Install the cross-compilation tool chain

  • Unzip the cross - compilation tool chain
=====> Input:
tar xf gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2 -C /opt/
  • Copy the tool chain configuration file
=====> Input:
cp environment-setup-cortexa9hf-neon-fsl-linux-gnueabi /opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/
  • source Tool chain configuration file
=====> Input:
source /opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/environment-setup-cortexa9hf-neon-fsl-linux-gnueabi
  • Verify cross compilation tool installation
=====> Input:
$CC -v

=====> Output: 
Using built-in specs.
COLLECT_GCC=arm-fsl-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper
Target: arm-fsl-linux-gnueabi
Configured with: /work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --disable-nls --enable-c99 --enable-long-long --with-system-zlib
Thread model: posix
gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20) 


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
#
  • Perform 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 you are prompted with "cc1: error", the configuration of the cross-compilation tool is not in effect. You can follow the "source toolchain configuration file" in the previous "cross-compilation toolchain installation" before performing this step.* *
  • 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_3035_script.cmd my_env_script.scr

=====> Output: 
Image Name:   MYZR script
Created:      Tue Nov  6 17:24:27 2018
Image Type:   ARM Linux Script (uncompressed)
Data Size:    1900 Bytes = 1.86 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 1892 Bytes = 1.85 kB = 0.00 MB

Object file

uboot-myimx6ek200-6q-1g.imx 和 my_env_script.scr 即编译得到的目标文件,保存这两个文件


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-3.0.35-svn*.tar.bz2 -C ~/my-work/02_source/

Compile the kernel target file

  • Source directory
=====> Input:
cd ~/my-work/02_source/linux-3.0.35
  • 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/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

Note: 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/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  ......
  AS      arch/arm/boot/compressed/piggy.gzip.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 kernel module package

  • Compiling
=====> Input:
make modules

=====> Output: 
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h” It's the latest.
  CALL    scripts/checksyscalls.sh
  CC [M]  fs/autofs4/init.o
  ......
  LD [M]  drivers/usb/gadget/g_serial.ko
  LD [M]  fs/nls/nls_ascii.ko
  LD [M]  fs/autofs4/autofs4.ko
  LD [M]  fs/nls/nls_utf8.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/gpu/drm/drm.ko
  INSTALL drivers/gpu/drm/vivante/vivante.ko
  ......
  INSTALL fs/autofs4/autofs4.ko
  INSTALL fs/nls/nls_ascii.ko
  INSTALL fs/nls/nls_utf8.ko
  DEPMOD  3.0.35-myimx6a9
  • Package the kernel module file
=====> Input:
tar cjf kernel-modules-myimx6a9.tar.bz2 -C modules lib

Object file

zImage-myimx6a9 和 kernel-modules-myimx6a9.tar.bz2 即编译得到的目标文件,保存这两个文件


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