MY-IMX6 Linux-3.0.35 compilation manual

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MY-IMX6 Linux-3.0.35 compilation manual

996 次查看
cherryzheng
Contributor II

prepare source code pacakge


3.0.35 version code

u-boot source code
name of file:u-boot-2009.08--svn*.tar.xz

kernel source code
name of file:linux-3.0.35--svn*.tar.xz

cross compifer tool
name of file:gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2

configuration of compifer environment

prepare source code

prepare source code package

1)create working directory
create ~/my-imx6 as working directory

$ mkdir ~/my-imx6
Myimx6l3035 build 2.1.1.1.jpg
create ~/my-imx6/02_source/imx_3.0.35_4.1.0 as source code directory

$ mkdir ~/my-imx6/02_source/imx_3.0.35_4.1.0 -p
Myimx6l3035 build 2.1.1.2.jpg
create ~/my-imx6/03_tools as tool directory

$ mkdir ~/my-imx6/03_tools -p
Myimx6l3035 build 2.1.1.3.jpg

2)copy source code package to the development host
do it in this step in your own way。
tip:this step is to copy “02_source code”from network disk to “~/my-imx6/02_source/imx_3.0.35_4.1.0”in development host,and copy “03_tool/toolchain”to “~/my-imx6/03_tools”。in development host

Decompress source code package

1)decompress u-boot source code and kernel source code

$ cd ~/my-imx6/02_source/imx_3.0.35_4.1.0
$ tar xf u-boot-2009.08--svn*.tar.xz
$ tar xf linux-3.0.35--svn*.tar.xz
Myimx6l3035 build 2.1.2.1.jpg

2)decompress cross compiler tool

$ cd ~/my-imx6/03_tools/
$ tar jxf gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2
Myimx6l3035 build 2.1.2.2.jpg

development environment configuration

install package needed

1)list of updated source

$ sudo apt-get update
Myimx6l3035 build 2.2.1.1.jpg
after update,it will look like below:

Myimx6l3035 build 2.2.1.2.jpg

2)install aptitude package management tool and ia32-libs
tips:if Linux of compiler host is 32bit,you can skip this step。

  • install aptitude package management tool

Myimx6l3035 build 2.2.1.3.jpg

$ sudo apt-get –y install aptitude

  • install ia32-libs with aptitude

$ sudo aptitude –y install ia32-libs
tips:following is the screenshots with re-execution of installation command after installation of aptitude and ia32-libs is finished。
Myimx6l3035 build 2.2.1.4.jpg

3)install mkimage tool

$ sudo apt-get -y install uboot-mkimage
tips:following is the screenshots with re-execution of installation command after installation of mkimage tool is finished。
Myimx6l3035 build 2.2.1.5.jpg

4)install ncurses-dev
instruction:make menuconfig is dependent on it。
$ sudo aptitude -y install ncurses-dev
tips:following is the screenshots with re-execution of installation command after installation of ncurses-dev tool is finished。
Myimx6l3035 build 2.2.1.6.jpg

configure environment variables of MY-IMX6 compilation

1)write platform information to a new configured file

$ echo "export ARCH=arm" > ~/my-imx6/03_tools/myimx6_3035_build_env

2)write compiler tool chain path to configured file

  • enter cross compiler tool directory

$ cd ~/my-imx6/03_tools/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/

  • write path to configured file

$ sed -i "\$a IMX6_GCC462_PATH=$PWD" ~/my-imx6/03_tools/myimx6_3035_build_env

  • write cross compiler tool to configured file

$ sed -i "\$a export CROSS_COMPILE=\$IMX6_GCC462_PATH/arm-none-linux-gnueabi-" ~/my-imx6/03_tools/myimx6_3035_build_env

3)view configured file

$ cat ~/my-imx6/03_tools/myimx6_3035_build_env

4)figures
Myimx6l3035 build 2.2.2.1.jpg

note:if an error occurs in any step, need to delect ~/my-imx6/03_tools/myimx6_3035_build_env ,and operate again all steps of this segment。

compile u-boot

enter u-boot source code directory

$ cd ~/my-imx6/02_source/imx_3.0.35_4.1.0/u-boot-2009.08/
Myimx6l3035 build 3.1.0.1.jpg

validate configured file

  • execute source command

$ source ~/my-imx6/03_tools/myimx6_3035_build_env
Myimx6l3035 build 3.2.0.1.jpg

  • view compiler configuration

$ echo $ARCH
$ echo $CROSS_COMPILE
tips:you can see that ARCH和CROSS_COMPILE is configured
Myimx6l3035 build 3.2.0.2.jpg

  • verify cross compiler tool configuration

$${CROSS_COMPILE}gcc –v
tips:you can see version information of cross compiler tool shown on terminal after execution of command.as below:
Myimx6l3035 build 3.2.0.3.jpg

remove u-boot configuration

$ make distclean
Myimx6l3035 build 3.3.0.1.jpg

u-boot configuration

  • evaluation board and its corresponding u-boot compiler configuration:
evaluation board main model)CPU type-memory capacitycorresponding u-boot configuration
MY-IMX6-EK2006Q(quad. core)- 1Gmyimx6ek200_6q_config
6Q(quad core)- 2Gmyimx6ek200_6q_2g_config
6U(dual core tile)- 1Gmyimx6ek200_6u_config
6S(single core)- 512Mmyimx6ek200_6s_config
MY-IMX6-EK3146Q(quad.core)- 1Gmyimx6ek314_6q_config
6Q(quad.core)- 2Gmyimx6ek314_6q_2g_config
6U(dual core tile)- 1Gmyimx6ek314_6u_config
6S(single core)- 512Mmyimx6ek314_6s_config
  • MYIMX6EK200-6Qxx-1G configuration example:

$ make myimx6ek200_6q_config
Myimx6l3035 build 3.3.0.2.jpg

compilation

  • 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。
Myimx6l3035 build 3.5.0.1.jpg

  • complete compilation

tips:u-boot compilation process will take a few minustes or so。
Myimx6l3035 build 3.5.0.2.jpg

target file
you can get the compiled file u-boot.bin with ls command after compilation

$ ls
Myimx6l3035 build 3.6.0.1.jpg

compile kernel


enter kernel source directory

$ cd ~/my-imx6/02_source/imx_3.0.35_4.1.0/linux-3.0.35/
Myimx6l3035 build 4.1.0.1.jpg

validate configured file

  • execute source command

$ source ~/my-imx6/03_tools/myimx6_3035_build_env
Myimx6l3035 build 4.2.0.1.jpg

  • view compiler configuration

$ echo $ARCH
$ echo $CROSS_COMPILE
tips:you can see that ARCH和CROSS_COMPILE is configured
Myimx6l3035 build 4.2.0.2.jpg

  • verify cross compiler tool configuration

$ ${CROSS_COMPILE}gcc –v
tips:you can see version information of cross compiler tool shown on terminal after execution of command.as below:
Myimx6l3035 build 4.2.0.3.jpg

prepare for kernel configuration

  • remove kernel configuration

$ make distclean
Myimx6l3035 build 4.3.0.1.jpg

  • generated.config file

instructions:configuration files used for MY-IMX6-EK200 seires of evaluation board and MY-IMX6-EK314 series of evaluation board is myimx6_defconfig
$ make myimx6_defconfig
Myimx6l3035 build 4.3.0.2.jpg

compile kernel

  • compile uImage

$ make uImage
instruction:4 threads compilation is used in the screenshots。
Myimx6l3035 build 4.4.0.1.jpg

  • complete compilation

Myimx6l3035 build 4.4.0.2.jpg

  • target file

arch/arm/boot/uImage is the target file through compilation,you can view the file information with ls command。

$ ls arch/arm/boot/uImage –la
Myimx6l3035 build 4.4.0.3.jpg

compile module

  • compile

$ make
instruction:4 threads compilation is used in the screenshots。
Myimx6l3035 build 4.5.0.1.jpg

  • complete compilation

Myimx6l3035 build 4.5.0.2.jpg

  • target file

.ko file of each module is in the directory where code is located after compilation ,you can find the module compiled with find command after compilation,refering command as below:
$ find -name *.ko
Myimx6l3035 build 4.5.0.3.jpg

Linux application compilation


write application

1)create application directory

$ mkdir ~/my-imx6/02_source/application/ -p
$ cd ~/my-imx6/02_source/application/
Myimx6l3035 build 5.1.0.1.jpg

2) write application(here take hello.c as example
create hello.c and write following code and save:

  1. include <stdio.h>

int main(int argc, char **argv)
{
   printf("Hello, MYZR!\n");
   
   return;
}

3) view code
$ cat hello.c
Myimx6l3035 build 5.1.0.2.jpg

validate compiler configured file

  • execute source command

$ source ~/my-imx6/03_tools/myimx6_3035_build_env
Myimx6l3035 build 5.2.0.1.jpg

  • view compiler configuration

$ echo $ARCH
$ echo $CROSS_COMPILE
tips:you can see that ARCH和CROSS_COMPILE is configured
Myimx6l3035 build 5.2.0.2.jpg

  • verify cross compiler tool configuration

$ ${CROSS_COMPILE}gcc –v
tips:you can see version information of cross compiler tool shown on terminal after execution of command.as below:
Myimx6l3035 build 5.2.0.3.jpg

compile application

2) compile
$ ${CROSS_COMPILE}gcc hello.c -o hello.out
note:the above commands contain charater“$”,e.g“${CROSS_COMPILE}gcc”,which is the environment variable generated when referring to our source。
Myimx6l3035 build 5.3.0.1.jpg

3) view type of target file
$ file hello.out
you can get the property of target file hello.out。
Myimx6l3035 build 5.3.0.2.jpg

file system


file system instruction
file system package is located in image file folder in the network disk。as to type of file system supported and way of download please refer to《MY-IMX6 buring guide》。

decompress file system to compiler host

1)create directory of file system and enter

$ mkdir ~/my-imx6/04_rootfs/ -p
$ cd ~/my-imx6/04_rootfs/
Myimx6l3035 build 6.2.0.1.jpg

2)copy file system to ~/my-imx6/04_rootfs/directory
this step sbould be done in your own way

3)decompress file system to specified directory
$ mkdir rootfs
$ sudo tar jxf rootfs-linux.tar.bz2 -C rootfs
Myimx6l3035 build 6.2.0.2.jpg

add application to file system

$ cp ~/my-imx6/02_source/application/hello.out rootfs/app_test/
Myimx6l3035 build 6.3.0.1.jpg

5)re-pakcage file system
$ rm -rf rootfs-linux.tar.bz2
$ cd rootfs/
$ sudo tar cjf ../rootfs-linux.tar.bz2 *
Myimx6l3035 build 6.3.0.2.jpg

add module to file system

prepare .ko file of module needed,as to other operations please refer to“add application to file system”。

If you would like to you know more about our products, please visit www.myzr.com.cn for email to enquiry@myzr.com.cn.

标签 (1)
0 回复数