MY-LS1012A-EK200 Linux-4.1.35 Linux-4.1.15 compilation reference manual

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

Download related files

Cross compilation toolchain

LS1012A series: Open the network disk to MY-LS1012A-EK200-> 03_Cross compilation tool, download fsl-qoriq-glibc-x86_64-aarch64-toolchain-2.0.sh.

Source

rcw: Open the network disk to MY-LS1012A-EK200-> 02_source code, download rcw.tar.bz2.
u-boot: Open the network disk to MY-LS1012A-EK200-> 02_source code, download u-boot-2016.09.tar.bz2.
Kernel: Open the network disk to MY-LS1012A-EK200-> 02_source code, download linux-4.1.35.tar.bz2.
ppa: Open the network disk to MY-LS1012A-EK200-> 02_source code, download ppa.tar.bz2.


Install Cross Compilation Toolchain

  • Perform installation
=====> Input:
./fsl-qoriq-glibc-x86_64-aarch64-toolchain-2.0.sh  (Do not install to the /opt directory)

=====> Output: 
Freescale i.MX Release Distro SDK installer version 4.1.15-2.1.0
================================================================
Enter target directory for SDK (default: /opt/fsl-imx-x11/4.1.15-2.1.0): 
=====> Input:
/home/myzr/my-work/03_toolchain/fsl-qoriq/2.0/
=====> Output: 
You are about to install the SDK to "/home/myzr/my-work/03_toolchain/fsl-qoriq/2.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.
 $ . /home/myzr/my-work/03_toolchain/fsl-qoriq/2.0/environment-setup-aarch64-fsl-linux
  • Modify configuration file
=====> Input:
echo "unset LDFLAGS" >> ~/my-work/03_toolchain/fsl-qoriq/2.0/environment-setup-aarch64-fsl-linux
  • source toolchain configuration file
=====> Input:
source  /home/myzr/my-work/03_toolchain/fsl-qoriq/2.0/environment-setup-aarch64-fsl-linux
  • Verify cross compilation tool installation
=====> Input:
$CC -v

=====> Output: 
Using built-in specs.
COLLECT_GCC=aarch64-fsl-linux-gcc
COLLECT_LTO_WRAPPER=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/libexec/aarch64-fsl-linux/gcc/aarch64-fsl-linux/4.9.3/lto-wrapper
Target: aarch64-fsl-linux
Configured with: /home/linyn/ls1012/QorIQ-SDK-V2.0-20160527-yocto/build_ls1012ardb/tmp/work-shared/gcc-linaro-4.9-r2015.03/gcc-linaro-4.9-2015.03/configure --build=x86_64-linux --host=x86_64-fslsdk-linux --target=aarch64-fsl-linux --prefix=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr --exec_prefix=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr --bindir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/bin/aarch64-fsl-linux --sbindir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/bin/aarch64-fsl-linux --libexecdir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/libexec/aarch64-fsl-linux --datadir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/share --sysconfdir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/etc --sharedstatedir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/com --localstatedir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/var --libdir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/lib/aarch64-fsl-linux --includedir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/include --oldincludedir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/include --infodir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/share/info --mandir=/opt/fsl-qoriq/2.0/sysroots/x86_64-fslsdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/linyn/ls1012/QorIQ-SDK-V2.0-20160527-yocto/build_ls1012ardb/tmp/sysroots/x86_64-nativesdk-fslsdk-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=aarch64-fsl-linux- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --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 --with-gxx-include-dir=/not/exist/usr/include/c++/4.9.3 --with-build-time-tools=/home/linyn/ls1012/QorIQ-SDK-V2.0-20160527-yocto/build_ls1012ardb/tmp/sysroots/x86_64-linux/usr/aarch64-fsl-linux/bin --with-sysroot=/not/exist --with-build-sysroot=/home/linyn/ls1012/QorIQ-SDK-V2.0-20160527-yocto/build_ls1012ardb/tmp/sysroots/ls1012ardb --enable-poison-system-directories --with-mpfr=/home/linyn/ls1012/QorIQ-SDK-V2.0-20160527-yocto/build_ls1012ardb/tmp/sysroots/x86_64-nativesdk-fslsdk-linux --with-mpc=/home/linyn/ls1012/QorIQ-SDK-V2.0-20160527-yocto/build_ls1012ardb/tmp/sysroots/x86_64-nativesdk-fslsdk-linux --enable-nls --enable-__cxa_atexit
Thread model: posix
gcc version 4.9.3 20150311 (prerelease) (Linaro GCC 4.9-2015.03) 


RCW Compilation

Preparation before compilation

  • Create compilation working directory
=====> Input:
mkdir ~/my-work/02_source/ -p
  • Extract the source package to a working directory
=====> Input:
tar jxf rcw.tar.bz2 -C ~/my-work/02_source/

Compile rcw object file

  • Enter the source directory
=====> Input:
cd ~/my-work/02_source/rcw
  • Perform compilation
=====> Input:
make 

=====> Output: 
make[1]: Entering directory `/home/linyn/MY-LS1012A/my-test/reslese/rcw/ls1012a-ek200'
python2 ../rcw.py -i N_SSNP_3305/rcw_800.rcw -o N_SSNP_3305/rcw_800.bin
/home/linyn/MY-LS1012A/my-test/reslese/rcw/ls1012a-ek200/../qspi_swap.sh /home/linyn/MY-LS1012A/my-test/reslese/rcw/ls1012a-ek200/../qspi_swap_list.txt
N_SSNP_3305/rcw_800.bin N_SSNP_3305/rcw_800.bin.swapped 8

make[1]: Leaving directory `/home/linyn/MY-LS1012A/my-test/reslese/rcw/ls1012a-ek200'

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

  • rcw object file
    rcw_800.bin.swapped is the target file.


u-boot compilation

Preparation before compilation

  • Create compilation working directory
=====> Input:
mkdir ~/my-work/02_source/ -p
  • Extract the source package to a working directory
=====> Input:
tar jxf u-boot-2016.09.tar.bz2 -C ~/my-work/02_source/

Compile u-boot object file

  • Enter the source directory
=====> Input:
cd ~/my-work/02_source/u-boot-2016.09
  • Clear configuration
=====> Input:
./ek200_build.sh clean  

=====> Output: 
============Start build clean============
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   .config
====Build clean ok!====
  • Generate the .config file for the target board
=====> Input:
./ek200_build.sh config

=====> Output: 
  ============Start build config============
  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
#
====Build config ok!====
  • Perform compilation
=====> Input:
./ek200_build.sh uboot

=====> Output: 
SHIPPED dts/dt.dtb
  CAT     u-boot-dtb.bin
  COPY    u-boot.dtb
  COPY    u-boot.bin
====Build uboot ok!====

Global compilation

=====> Input:
./ek200_build.sh all

=====> Output: 
SHIPPED dts/dt.dtb
  CAT     u-boot-dtb.bin
  COPY    u-boot.dtb
  COPY    u-boot.bin
====Build uboot ok!====
=========build all ok========= 

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

  • u-boot object file
    ls1012a-ek200-uboot.bin is the target file.

PPA compilation

Preparation before compilation

  • Create compilation working directory
=====> Input:
mkdir ~/my-work/02_source/ -p
  • Extract the source package to a working directory
=====> Input:
tar jxf ppa.tar.bz2 -C ~/my-work/02_source/

Compile the PPA object file

  • Enter the source directory
=====> Input:
cd ~/my-work/02_source/ppa/soc-ls1012
  • Perform compilation
=====> Input:
make rdb-fit 

=====> Output: 
mkimage -f build/src/ppa.its build/obj/ppa.itb
FIT description: PPA Firmware
Created:         Fri Nov  1 10:58:17 2019
 Image 0 ([email protected])
  Description:  PPA Firmware: Version 0.2
  Created:      Fri Nov  1 10:58:17 2019
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    88064 Bytes = 86.00 kB = 0.08 MB
  Architecture: AArch64
  Load Address: unavailable
 Default Configuration: '[email protected]'
 Configuration 0 ([email protected])
  Description:  Boot PPA firmware
  Kernel:       unavailable

Note: If there is a prompt "cc1: error", usually the configuration of the cross compilation tool does not take effect. You can perform this step after performing the operation once according to the "source tool chain configuration file" in "Cross compilation tool chain installation".

  • ppa object file
    ppa.itb is the target file.

Kernel Compilation

Preparation before compilation

  • Create compilation working directory
=====> Input:
mkdir ~/my-work/02_source/ -p
  • Extract the source package to a working directory
=====> Input:
tar xf linux-4.1.35.tar.bz2 -C ~/my-work/02_source/

Compile the kernel object file

  • Enter the kernel source directory
=====> Input:
cd ~/my-work/02_source/linux-4.1.35
  • Clear configuration
=====> Input:
./ek200_build.sh clean  

=====> Output: 
============Start build clean============
  CLEAN   scripts/basic
  CLEAN   scripts/dtc
  CLEAN   scripts/genksyms
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts
  CLEAN   include/config include/generated arch/arm64/include/generated
  CLEAN   .config .config.old .version Module.symvers
====Build clean ok!====
  • Compile the kernel object file
=====> Input:
./ek200_build.sh kernel

=====> Output: 
SYSMAP  System.map
  OBJCOPY arch/arm64/boot/Image
Image Name:   Linux-4.1.35(MYZR)
Created:      Mon Nov  4 11:59:34 2019
Image Type:   AArch64 Linux Kernel Image (uncompressed)
Data Size:    14014976 Bytes = 13686.50 kB = 13.37 MB
Load Address: 80080000
Entry Point:  80080000
====Build kerenl ok!====
  • Kernel object file
    EK200_IMAGE/uImage-ek200 is the kernel object file

Compile the device tree object file

  • Execute the compile command
=====> Input:
./ek200_build.sh dtb

=====> Output: 
Warning (reg_format): "reg" property in /[email protected]/[email protected] has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Warning (reg_format): "reg" property in /[email protected]/[email protected] has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Warning (ranges_format): "ranges" property in /[email protected] has invalid length (32 bytes) (parent #address-cells == 2, child #address-cells == 2, #size-cells == 1)
Warning (avoid_default_addr_size): Relying on default #address-cells value for /[email protected]/[email protected]
Warning (avoid_default_addr_size): Relying on default #size-cells value for /[email protected]/[email protected]
Warning (avoid_default_addr_size): Relying on default #address-cells value for /[email protected]/[email protected]
Warning (avoid_default_addr_size): Relying on default #size-cells value for /[email protected]/[email protected]
====Build dtb ok!====
  • Device tree object file
    EK200_IMAGE/ls1012a-ek200.dtb is Device tree object file

Compile the kernel module package

  • Perform compilation
=====> Input:
./ek200_build.sh modules

=====> Output: 
INSTALL drivers/staging/fsl_ppfe/pfe.ko
  INSTALL net/802/p8022.ko
  INSTALL net/802/psnap.ko
  INSTALL net/802/stp.ko
  INSTALL net/bridge/br_netfilter.ko
  INSTALL net/bridge/bridge.ko
  INSTALL net/llc/llc.ko
  DEPMOD  4.1.35-rt41
====Build modules ok!====
  • Kernel module object file
    EK200_IMAGE/modules.tar is Kernel module object file

Global compilation

=====> Input:
./ek200_build.sh all


Linux C program compilation

Prepare source code

Open the network disk to ** 5_MY-Demo-> MY-Linux-C-Demo **, download the ** hello.c ** file,and copy it to the virtual machine.

Compile Object File

=====> Input:
$CC hello.c -o hello.out

Note: If there is a “command not found” message, it is because the configuration of the cross-compilation toolchain has not taken effect. You can follow the “source toolchain configuration file” in “Cross-compilation toolchain installation” to perform this operation again Steps

Run Linux C target program

  • Copy the compiled hello.out to the development board
  • Run Linux C target program on development board
=====> Input:
chmod +x ./hello.out
./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]



--------------------------------------------------------------------------------
* 珠海明远智睿科技有限公司  
* ZhuHai MYZR Technology CO.,LTD.
* Latest Update: 2019/11/08  
* Supporter: Tang Bin
--------------------------------------------------------------------------------