ARM技术论坛
直播中

明远智睿科技

7年用户 521经验值
擅长:嵌入式技术 存储技术 处理器/DSP 控制/MCU
私信 关注
[资料]

明远智睿MY-IMX6 L3035编译手册(2)

使配置文件生效(validate configured file)
  • 执行source命令
execute source command
$ source ~/my-imx6/03_tools/myimx6_3035_build_env

  • 查看编译配置
view compiler configuration
$ echo $ARCH
$ echo $CROSS_COMPILE
提示:可看到ARCH和CROSS_COMPILE被设置
tips:you can see that ARCH和CROSS_COMPILE is configured

  • 验证交叉编译工具配置
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:


清除u-boot配置(remove u-boot configuration)
$ make distclean


u-boot配置(u-boot configuration)
  • 评估板及对应的 u-boot 编译配置:
evaluation board and its corresponding u-boot compiler configuration:
评估板主型号
(evaluation board main model)
CPU类型-内存容量
(CPU type-memory capacity)
对应的u-boot配置
(corresponding u-boot configuration)
MY-IMX6-EK2006Q(四核)- 1G       
(6Q(quad. core)- 1G)
myimx6ek200_6q_config
6Q(四核)- 2G       
(6Q(quad core)- 2G)
myimx6ek200_6q_2g_config
6U(双核简化)- 1G
(6U(dual core tile)- 1G)
myimx6ek200_6u_config
6S(单核)- 512M
(6S(single core)- 512M)
myimx6ek200_6s_config
MY-IMX6-EK3146Q(四核)- 1G       
(6Q(quad.core)- 1G)
myimx6ek314_6q_config
6Q(四核)- 2G       
(6Q(quad.core)- 2G)
myimx6ek314_6q_2g_config
6U(双核简化)- 1G
(6U(dual core tile)- 1G)
myimx6ek314_6u_config
6S(单核)- 512M
(6S(single core)- 512M)
myimx6ek314_6s_config
  • MYIMX6EK200-6Qxx-1G配置示例:
MYIMX6EK200-6Qxx-1G configuration example:
$ make myimx6ek200_6q_config


编译(compilation)
  • 执行编译
execute compilation
$ make
提示:这里为了提高编译速度,在make后面加了“-j4”。这里编译的Linux主机是双核4线程的,所以“-j”后面用了4,也就是采用4线程编译。“-j”后面的数字可以根据系统资源分配,但是不应该超过编译主机最大支持的线程数。
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
提示:u-boot编译过程大概需要几分钟时间。
tips:u-boot compilation process will take a few minustes or so。


目标文件(target file)
编译完成后通过ls命令即可看到编译得到的目标文件u-boot.bin
you can get the compiled file u-boot.bin with ls command after compilation
$ ls


编译内核(compile kernel)
进入内核源码目录(enter kernel source directory)
$ cd ~/my-imx6/02_source/imx_3.0.35_4.1.0/linux-3.0.35/


使配置文件生效(validate configured file)
  • 执行source命令
execute source command
$ source ~/my-imx6/03_tools/myimx6_3035_build_env

  • 查看编译配置
view compiler configuration
$ echo $ARCH
$ echo $CROSS_COMPILE
提示:可看到ARCH和CROSS_COMPILE被设置
tips:you can see that ARCH和CROSS_COMPILE is configured

  • 验证交叉编译工具配置
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:


准备配置内核(prepare for kernel configuration)
  • 清除内核配置
remove kernel configuration
$ make distclean

  • 生成.config文件
generated.config file
说明:MY-IMX6-EK200系列评估板及MY-IMX6-EK314系列评估板使用的配置文件是myimx6_defconfig
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


编译内核(compile kernel)
  • 编译uImage
compile uImage
$ make uImage
说明:截图中使用了4线程编译。
instruction:4 threads compilation is used in the screenshots。

  • 编译完成
complete compilation

  • 目标文件
target file
arch/arm/boot/uImage即为编译得到的目标文件,使用ls命令可查看文件信息。
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


编译模块(compile module)
  • 编译
compile
$ make
说明:截图中使用了4线程编译。
instruction:4 threads compilation is used in the screenshots。

  • 编译完成
complete compilation

  • 目标文件
target file
编译完成后各模块的.ko文件位于代码所在的目录,通过find命令可以找出编译完成的模块,参考命令如下:
.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


Linux应用程序编译(Linux application compilation)
编写应用程序(write application)
1) 创建应用程序目录
create application directory
$ mkdir ~/my-imx6/02_source/application/ -p
$ cd ~/my-imx6/02_source/application/

2) 编写应用程序(这里以hello.c为例)
write application(here take hello.c as example
创建 hello.c 文件写入以下代码并保存:
create hello.c and write following code and save:
  • include
int main(int argc, char **argv)
{
   printf("Hello, MYZR!n");
   
   return;
}
3) 查看代码
view code
$ cat hello.c


使编译配置文件生效(validate compiler configured file)
  • 执行source命令
execute source command
$ source ~/my-imx6/03_tools/myimx6_3035_build_env

  • 查看编译配置
view compiler configuration
$ echo $ARCH
$ echo $CROSS_COMPILE
提示:可看到ARCH和CROSS_COMPILE被设置
tips:you can see that ARCH和CROSS_COMPILE is configured

  • 验证交叉编译工具配置
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:


编译应用程序 (compile application)
2) 编译
compile
$ ${CROSS_COMPILE}gcc hello.c -o hello.out
注意:上面的命令有包含“$”号,即“${CROSS_COMPILE}gcc”,是引用我们source时产生的环境变量。
note:the above commands contain charater“$”,e.g“${CROSS_COMPILE}gcc”,which is the environment variable generated when referring to our source。

3) 查看目标文件类型
view type of target file
$ file hello.out
可以看到目标文件 hello.out 的属性。
you can get the property of target file hello.out。


文件系统(file system)
文件系统说明(file system instruction)
文件系统包位于网盘对应的镜像文件夹中。支持的文件系统类型及下载方式可参照《MY-IMX6 烧录指导》。
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/

2)将文件系统复制到~/my-imx6/04_rootfs/目录
copy file system to ~/my-imx6/04_rootfs/directory
这一步骤自己采取相应的方式进行
this step ***ould be done in your own way
3)解压文件系统到指定目录
decompress file system to specified directory
$ mkdir rootfs
$ sudo tar jxf rootfs-linux.tar.bz2 -C rootfs


添加应用到文件系统(add application to file system)
$ cp ~/my-imx6/02_source/application/hello.out rootfs/app_test/

5)重新打包文件系统
re-pakcage file system
$ rm -rf rootfs-linux.tar.bz2
$ cd rootfs/
$ sudo tar cjf ../rootfs-linux.tar.bz2 *


添加模块到文件系统(add module to file system)
准备需要模块的.ko文件,其它请参照“添加应用到文件系统”。
prepare .ko file of module needed,as to other operations please refer to“add application to file system”。

更多回帖

发帖
×
20
完善资料,
赚取积分