0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

IMX6 L3035编译手册

电子工程师 2018-03-17 11:59 次阅读

明远智睿MY-IMX6L3035编译手册

2018年03月15日10:03myzr123

准备源码包(preparesourcecodepacakge)3.0.35版本代码(3.0.35versioncode)u-boot源码(u-bootsourcecode)

文件名:u-boot-2009.08--svn*.tar.xz

nameoffile:u-boot-2009.08--svn*.tar.xz

kernel源码(kernelsourcecode)

文件名:linux-3.0.35--svn*.tar.xz

nameoffile:linux-3.0.35--svn*.tar.xz

交叉编译工具(crosscompifertool)

文件名:gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2

nameoffile:gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2

配置编译环境(configurationofcompiferenvironment)准备源码(preparesourcecode)准备源码包(preparesourcecodepackage)

1)创建工作目录

createworkingdirectory

创建~/my-imx6作为工作目录

create~/my-imx6asworkingdirectory

$mkdir~/my-imx6

创建~/my-imx6/02_source/imx_3.0.35_4.1.0作为源码目录

create~/my-imx6/02_source/imx_3.0.35_4.1.0assourcecodedirectory

$mkdir~/my-imx6/02_source/imx_3.0.35_4.1.0-p

创建~/my-imx6/03_tools作为工具目录

create~/my-imx6/03_toolsastooldirectory

$mkdir~/my-imx6/03_tools-p

2)复制源码包到开发主机中

copysourcecodepackagetothedevelopmenthost

这一步骤自己采取相应的方式进行。

doitinthisstepinyourownway。

提示:这里将网盘中“02_源码”复制到Linux开发主机的“~/my-imx6/02_source/imx_3.0.35_4.1.0”,将网盘中“03_工具/toolchain”复制到Linux开发主机的“~/my-imx6/03_tools”。

tip:thisstepistocopy“02_sourcecode”fromnetworkdiskto“~/my-imx6/02_source/imx_3.0.35_4.1.0”indevelopmenthost,andcopy“03_tool/toolchain”to“~/my-imx6/03_tools”。indevelopmenthost

解压源码包(decompresssourcecodepackage)

1)解压u-boot源码和内核源码

decompressu-bootsourcecodeandkernelsourcecode

$cd~/my-imx6/02_source/imx_3.0.35_4.1.0

$tarxfu-boot-2009.08--svn*.tar.xz

$tarxflinux-3.0.35--svn*.tar.xz

2)解压交叉编译工具

decompresscrosscompilertool

$cd~/my-imx6/03_tools/

$tarjxfgcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2

开发环境配置(developmentenvironmentconfiguration)安装需要的包(installpackageneeded)

1)更新源列表

listofupdatedsource

$sudoapt-getupdate

更新完成后如下图所示:

afterupdate,itwilllooklikebelow:

2)安装aptitude包管理工具和ia32-libs

installaptitudepackagemanagementtoolandia32-libs

提示:如果编译主机的Linux是32位的,可以跳过此步骤。

tips:ifLinuxofcompilerhostis32bit,youcanskipthisstep。

安装aptitude包管理工具

installaptitudepackagemanagementtool

$sudoapt-get–yinstallaptitude

使用aptitude安装ia32-libs

installia32-libswithaptitude

$sudoaptitude–yinstallia32-libs

提示:下图为安装过aptitude和ia32-libs后,再次执行安装命令的截图。

tips:followingisthescreenshotswithre-executionofinstallationcommandafterinstallationofaptitudeandia32-libsisfinished。

3)安装mkimage工具

installmkimagetool

$sudoapt-get-yinstalluboot-mkimage

提示:下图为安装过mkimage工具后,再次执行安装命令的截图。

tips:followingisthescreenshotswithre-executionofinstallationcommandafterinstallationofmkimagetoolisfinished。

4)安装ncurses-dev

installncurses-dev

说明:makemenuconfig对其具有依赖性质。

instruction:makemenuconfigisdependentonit。

$sudoaptitude-yinstallncurses-dev

提示:下图为安装过ncurses-dev工具后,再次执行安装命令的截图。

tips:followingisthescreenshotswithre-executionofinstallationcommandafterinstallationofncurses-devtoolisfinished。

配置MY-IMX6编译的环境变量(configureenvironmentvariablesofMY-IMX6compilation)

1)将平台信息写入到一个新的配置文件

writeplatforminformationtoanewconfiguredfile

$echo“exportARCH=arm”》~/my-imx6/03_tools/myimx6_3035_build_env

2)将交叉编译工具链路径写入到配置文件

writecompilertoolchainpathtoconfiguredfile

进入交叉编译工具目录

entercrosscompilertooldirectory

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

将路径写入到配置文件

writepathtoconfiguredfile

$sed-i“\$aIMX6_GCC462_PATH=$PWD”~/my-imx6/03_tools/myimx6_3035_build_env

将交叉编译工具写入到配置文件

writecrosscompilertooltoconfiguredfile

$sed-i“\$aexportCROSS_COMPILE=\$IMX6_GCC462_PATH/arm-none-linux-gnueabi-”~/my-imx6/03_tools/myimx6_3035_build_env

3)查看配置文件

viewconfiguredfile

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

注意:如果在某一步操作错误,则需要删除~/my-imx6/03_tools/myimx6_3035_build_env文件,并重新按照本小节操作。

note:ifanerroroccursinanystep,needtodelect~/my-imx6/03_tools/myimx6_3035_build_env,andoperateagainallstepsofthissegment。

编译u-boot(compileu-boot)进入u-boot源码目录(enteru-bootsourcecodedirectory)

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

使配置文件生效(validateconfiguredfile)

执行source命令

executesourcecommand

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

查看编译配置

viewcompilerconfiguration

$echo$ARCH

$echo$CROSS_COMPILE

提示:可看到ARCH和CROSS_COMPILE被设置

tips:youcanseethatARCH和CROSS_COMPILEisconfigured

验证交叉编译工具配置

verifycrosscompilertoolconfiguration

$${CROSS_COMPILE}gcc–v

提示:执行命令后可以看到终端显示出交叉编译工具的版本信息。如下图:

tips:youcanseeversioninformationofcrosscompilertoolshownonterminalafterexecutionofcommand.asbelow:

清除u-boot配置(removeu-bootconfiguration)

$makedistclean

u-boot配置(u-bootconfiguration)

评估板及对应的u-boot编译配置:

evaluationboardanditscorrespondingu-bootcompilerconfiguration:

评估板主型号

(evaluationboardmainmodel)

CPU类型-内存容量

(CPUtype-memorycapacity)

对应的u-boot配置

(correspondingu-bootconfiguration)

MY-IMX6-EK2006Q(四核)-1G

(6Q(quad.core)-1G)myimx6ek200_6q_config

6Q(四核)-2G

(6Q(quadcore)-2G)myimx6ek200_6q_2g_config

6U(双核简化)-1G

(6U(dualcoretile)-1G)myimx6ek200_6u_config

6S(单核)-512M

(6S(singlecore)-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(dualcoretile)-1G)myimx6ek314_6u_config

6S(单核)-512M

(6S(singlecore)-512M)myimx6ek314_6s_config

MYIMX6EK200-6Qxx-1G配置示例:

MYIMX6EK200-6Qxx-1Gconfigurationexample:

$makemyimx6ek200_6q_config

编译(compilation)

执行编译

executecompilation

$make

提示:这里为了提高编译速度,在make后面加了“-j4”。这里编译的Linux主机是双核4线程的,所以“-j”后面用了4,也就是采用4线程编译。“-j”后面的数字可以根据系统资源分配,但是不应该超过编译主机最大支持的线程数。

Tips:Tospeedupthecompilation,add“-j4”aftermake.TheLinuxhostusedtocompileisdual-core,4threads.So“-j”isfollowedby4,whichtakes4threadstocompile.Thenumberbehind“-j”isallocatedbasedonsystemresources,butItshouldnotexceedthemaximumthreadsthehostsupport。

编译完成

completecompilation

提示:u-boot编译过程大概需要几分钟时间。

tips:u-bootcompilationprocesswilltakeafewminustesorso。

目标文件(targetfile)

编译完成后通过ls命令即可看到编译得到的目标文件u-boot.bin

youcangetthecompiledfileu-boot.binwithlscommandaftercompilation

$ls

编译内核(compilekernel)进入内核源码目录(enterkernelsourcedirectory)

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

使配置文件生效(validateconfiguredfile)

执行source命令

executesourcecommand

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

查看编译配置

viewcompilerconfiguration

$echo$ARCH

$echo$CROSS_COMPILE

提示:可看到ARCH和CROSS_COMPILE被设置

tips:youcanseethatARCH和CROSS_COMPILEisconfigured

验证交叉编译工具配置

verifycrosscompilertoolconfiguration

$${CROSS_COMPILE}gcc–v

提示:执行命令后可以看到终端显示出交叉编译工具的版本信息。如下图:

tips:youcanseeversioninformationofcrosscompilertoolshownonterminalafterexecutionofcommand.asbelow:

准备配置内核(prepareforkernelconfiguration)

清除内核配置

removekernelconfiguration

$makedistclean

生成.config文件

generated.configfile

说明:MY-IMX6-EK200系列评估板及MY-IMX6-EK314系列评估板使用的配置文件是myimx6_defconfig

instructions:configurationfilesusedforMY-IMX6-EK200seiresofevaluationboardandMY-IMX6-EK314seriesofevaluationboardismyimx6_defconfig

$makemyimx6_defconfig

编译内核(compilekernel)

编译uImage

compileuImage

$makeuImage

说明:截图中使用了4线程编译。

instruction:4threadscompilationisusedinthescreenshots。

编译完成

completecompilation

目标文件

targetfile

arch/arm/boot/uImage即为编译得到的目标文件,使用ls命令可查看文件信息。

arch/arm/boot/uImageisthetargetfilethroughcompilation,youcanviewthefileinformationwithlscommand。

$lsarch/arm/boot/uImage–la

编译模块(compilemodule)

编译

compile

$make

说明:截图中使用了4线程编译。

instruction:4threadscompilationisusedinthescreenshots。

编译完成

completecompilation

目标文件

targetfile

编译完成后各模块的.ko文件位于代码所在的目录,通过find命令可以找出编译完成的模块,参考命令如下:

.kofileofeachmoduleisinthedirectorywherecodeislocatedaftercompilation,youcanfindthemodulecompiledwithfindcommandaftercompilation,referingcommandasbelow:

$find-name*.ko

Linux应用程序编译(Linuxapplicationcompilation)编写应用程序(writeapplication)

1)创建应用程序目录

createapplicationdirectory

$mkdir~/my-imx6/02_source/application/-p

$cd~/my-imx6/02_source/application/

2)编写应用程序(这里以hello.c为例)

创建hello.c文件写入以下代码并保存:

include

intmain(intargc,char**argv)

{

printf(“Hello,MYZR!\n”);

return;

}

3)查看代码

$cathello.c

使编译配置文件生效(validatecompilerconfiguredfile)

执行source命令

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

查看编译配置

$echo$ARCH

$echo$CROSS_COMPILE

提示:可看到ARCH和CROSS_COMPILE被设置

验证交叉编译工具配置

$${CROSS_COMPILE}gcc–v

提示:执行命令后可以看到终端显示出交叉编译工具的版本信息。如下图:

编译应用程序(compileapplication)

2)编译

$${CROSS_COMPILE}gcchello.c-ohello.out

注意:上面的命令有包含“$”号,即“${CROSS_COMPILE}gcc”,是引用我们source时产生的环境变量。

3)查看目标文件类型

$filehello.out

可以看到目标文件hello.out的属性。

文件系统(filesystem)文件系统说明(filesysteminstruction)

文件系统包位于网盘对应的镜像文件夹中。支持的文件系统类型及下载方式可参照《MY-IMX6烧录指导》。

解压文件系统到编译主机(decompressfilesystemtocompilerhost)

1)创建文件系统的目录并进入

$mkdir~/my-imx6/04_rootfs/-p

$cd~/my-imx6/04_rootfs/

2)将文件系统复制到~/my-imx6/04_rootfs/目录

这一步骤自己采取相应的方式进行

3)解压文件系统到指定目录

$mkdirrootfs

$sudotarjxfrootfs-linux.tar.bz2-Crootfs

添加应用到文件系统(addapplicationtofilesystem)

$cp~/my-imx6/02_source/application/hello.outrootfs/app_test/

5)重新打包文件系统

$rm-rfrootfs-linux.tar.bz2

$cdrootfs/

$sudotarcjf。。/rootfs-linux.tar.bz2*

添加模块到文件系统(addmoduletofilesystem)

准备需要模块的.ko文件,其它请参照“添加应用到文件系统”。

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
收藏 人收藏

    评论

    相关推荐

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

    source command$ source ~/my-imx6/03_tools/myimx6_3035_build_env查看编译配置view compiler configuration
    发表于 03-09 15:29

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

    ; ~/my-imx6/03_tools/myimx6_3035_build_env将交叉编译工具写入到配置文件write cross compiler tool to configured file
    发表于 03-15 09:05

    MY-IMX6 L3035编译手册

    linux-3.0.35--svn*.tar.xz2)解压交叉编译工具decompress cross compiler tool$ cd ~/my-imx6/03_tools/$ tar jxf gcc-4.6.2-glibc-2.13-linaro-multilib
    发表于 03-16 15:53

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

    MY-IMX6 L3035编译手册3.0.35版本代码(3.0.35 version code)u-boot源码(u-boot source code)文件名:u-boot-2009.
    发表于 03-27 13:49

    IMX6 Linux-4.1.15编译参考手册

    MY-IMX6 Linux-4.1.15 编译参考手册[size=0.87em]目录 [隐藏] 1下载相关文件1.1A7系列交叉编译工具链1.2A9系列交叉
    发表于 11-29 17:24

    明远智睿MY-IMX6-EK200 L3035测试手册(1)

    ”+“C”可结束按键测试程序。注:按下SW1(系统会复位重启)。 附图 【下章节为明远智睿MY-IMX6-EK200 L3035测试手册(2)】
    发表于 12-11 16:37

    明远智睿MY-IMX6-EK200 L3035测试手册(3)

    `【接上一章节明远智睿MY-IMX6-EK200 L3035测试手册(1)】2.7 串口测试  MY-I.MX6评估板有5个串口,其中4个为用户串口(位于底板正面“J1”位置,丝印名称
    发表于 12-13 09:42

    IMX6 L3035编译手册

    MY-IMX6 L3035编译手册目录 [隐藏] 1准备源码包1.13.0.35版本代码1.1.1u-boot源码1.1.2kernel源码1.1.3交叉
    发表于 12-29 15:25

    IMX6挂载exFAT移动硬盘

    ://github.com/rxrz/exfat-nofuse.git2.编译源码cd exfat-nofuse/修改makefile:KDIR ?= /home/linyn/imx6/4.1/linux-4.1.15
    发表于 03-04 10:31

    IMX6开发板的优势

    IMX6开发板的优势
    发表于 03-04 07:27

    如何在IMX6嵌入式平台搭建VNC环境

    X11VNC,可是没有直接可以给imx6 arm32可用的版本,没办法就自己编译移植咯。整个在IMX6嵌入式平台搭建VNC环境的过程如下:方式1:IMX6开发板上安装VNC服务端:通过
    发表于 12-24 07:57

    iMX6常见 Android系统问题

    方法修改后重新编译镜像后,将新编译的镜像烧写到imx6开发板上: 修改/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
    发表于 08-29 10:32

    iMX6雷克斯开发板详细介绍

    iMX6雷克斯开发板详细介绍
    发表于 01-19 09:10 8次下载

    iMX6 Rex开发板详解介绍

    iMX6 Rex开发板详解介绍
    发表于 01-18 17:27 55次下载

    iMX6系列-iMX6Q 开发板 Python 移植

    本文基于飞凌OKMX6Q/DL开发板为基础讲解,主要使用平台是imx6系列,linux3.0.35操作系统,其他平台也可以参考,不同平台之间会存在差异,需自行修改适应自己的使用iMX6 Python移植
    的头像 发表于 10-28 18:24 787次阅读
    <b class='flag-5'>iMX6</b>系列-<b class='flag-5'>iMX</b>6Q 开发板 Python 移植