IMX6 L3035编译手册.doc

上传人:白大夫 文档编号:3252971 上传时间:2019-08-06 格式:DOC 页数:11 大小:47.50KB
返回 下载 相关 举报
IMX6 L3035编译手册.doc_第1页
第1页 / 共11页
亲,该文档总共11页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《IMX6 L3035编译手册.doc》由会员分享,可在线阅读,更多相关《IMX6 L3035编译手册.doc(11页珍藏版)》请在三一文库上搜索。

1、IMX6 L3035编译手册明远智睿MY-IMX6L3035编译手册2018年03月15日10:03myzr123准备源码包(preparesourcecodepacakge)3.0.35版本代码(3.0.35versioncode)u-boot源码(u-bootsourcecode)文件名:u-boot-2009.08-svn*.tar.xznameoffile:u-boot-2009.08-svn*.tar.xzkernel源码(kernelsourcecode)文件名:linux-3.0.35-svn*.tar.xznameoffile:linux-3.0.35-svn*.tar.xz交

2、叉编译工具(crosscompifertool)文件名:gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2nameoffile:gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2配置编译环境(configurationofcompiferenvironment)准备源码(preparesourcecode)准备源码包(preparesourcecodepackage)1)创建工作目录createworkingdirectory创建/my-imx6作为工作目录create/my-imx6a

3、sworkingdirectory$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-p2)复制源码包到开发主机中copysourcecodepackag

4、etothedevelopmenthost这一步骤自己采取相应的方式进行。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“

5、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.xz2)解压交叉编译工具decompresscrosscompilertool$cd/my-imx

6、6/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-libsinstallaptitudepackagemanagementtoolandia32-l

7、ibs提示:如果编译主机的Linux是32位的,可以跳过此步骤。tips:ifLinuxofcompilerhostis32bit,youcanskipthisstep。安装aptitude包管理工具installaptitudepackagemanagementtool$sudoapt-getyinstallaptitude使用aptitude安装ia32-libsinstallia32-libswithaptitude$sudoaptitudeyinstallia32-libs提示:下图为安装过aptitude和ia32-libs后,再次执行安装命令的截图。tips:followingis

8、thescreenshotswithre-executionofinstallationcommandafterinstallationofaptitudeandia32-libsisfinished。3)安装mkimage工具installmkimagetool$sudoapt-get-yinstalluboot-mkimage提示:下图为安装过mkimage工具后,再次执行安装命令的截图。tips:followingisthescreenshotswithre-executionofinstallationcommandafterinstallationofmkimagetoolisfin

9、ished。4)安装ncurses-devinstallncurses-dev说明:makemenuconfig对其具有依赖性质。instruction:makemenuconfigisdependentonit。$sudoaptitude-yinstallncurses-dev提示:下图为安装过ncurses-dev工具后,再次执行安装命令的截图。tips:followingisthescreenshotswithre-executionofinstallationcommandafterinstallationofncurses-devtoolisfinished。配置MY-IMX6编译的

10、环境变量(configureenvironmentvariablesofMY-IMX6compilation)1)将平台信息写入到一个新的配置文件writeplatforminformationtoanewconfiguredfile$echo“exportARCH=arm”/my-imx6/03_tools/myimx6_3035_build_env2)将交叉编译工具链路径写入到配置文件writecompilertoolchainpathtoconfiguredfile进入交叉编译工具目录entercrosscompilertooldirectory$cd/my-imx6/03_tools/

11、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-”/m

12、y-imx6/03_tools/myimx6_3035_build_env3)查看配置文件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

13、-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和CROS

14、S_COMPILE被设置tips:youcanseethatARCH和CROSS_COMPILEisconfigured验证交叉编译工具配置verifycrosscompilertoolconfiguration$CROSS_COMPILEgccv提示:执行命令后可以看到终端显示出交叉编译工具的版本信息。如下图:tips:youcanseeversioninformationofcrosscompilertoolshownonterminalafterexecutionofcommand.asbelow:清除u-boot配置(removeu-bootconfiguration)$makedis

15、tcleanu-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_config6Q(四核)-2G(6Q(

16、quadcore)-2G)myimx6ek200_6q_2g_config6U(双核简化)-1G(6U(dualcoretile)-1G)myimx6ek200_6u_config6S(单核)-512M(6S(singlecore)-512M)myimx6ek200_6s_configMY-IMX6-EK3146Q(四核)-1G(6Q(quad.core)-1G)myimx6ek314_6q_config6Q(四核)-2G(6Q(quad.core)-2G)myimx6ek314_6q_2g_config6U(双核简化)-1G(6U(dualcoretile)-1G)myimx6ek314_6

17、u_config6S(单核)-512M(6S(singlecore)-512M)myimx6ek314_6s_configMYIMX6EK200-6Qxx-1G配置示例:MYIMX6EK200-6Qxx-1Gconfigurationexample:$makemyimx6ek200_6q_config编译(compilation)执行编译executecompilation$make提示:这里为了提高编译速度,在make后面加了“-j4”。这里编译的Linux主机是双核4线程的,所以“-j”后面用了4,也就是采用4线程编译。“-j”后面的数字可以根据系统资源分配,但是不应该超过编译主机最大支持

18、的线程数。Tips:Tospeedupthecompilation,add“-j4”aftermake.TheLinuxhostusedtocompileisdual-core,4threads.So“-j”isfollowedby4,whichtakes4threadstocompile.Thenumberbehind“-j”isallocatedbasedonsystemresources,butItshouldnotexceedthemaximumthreadsthehostsupport。编译完成completecompilation提示:u-boot编译过程大概需要几分钟时间。tip

19、s:u-bootcompilationprocesswilltakeafewminustesorso。目标文件(targetfile)编译完成后通过ls命令即可看到编译得到的目标文件u-boot.binyoucangetthecompiledfileu-boot.binwithlscommandaftercompilation$ls编译内核(compilekernel)进入内核源码目录(enterkernelsourcedirectory)$cd/my-imx6/02_source/imx_3.0.35_4.1.0/linux-3.0.35/使配置文件生效(validateconfigured

20、file)执行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_COMPILEgccv提示:执行命令后可以看到终端显示出交叉编

21、译工具的版本信息。如下图:tips:youcanseeversioninformationofcrosscompilertoolshownonterminalafterexecutionofcommand.asbelow:准备配置内核(prepareforkernelconfiguration)清除内核配置removekernelconfiguration$makedistclean生成.config文件generated.configfile说明:MY-IMX6-EK200系列评估板及MY-IMX6-EK314系列评估板使用的配置文件是myimx6_defconfiginstructions

22、:configurationfilesusedforMY-IMX6-EK200seiresofevaluationboardandMY-IMX6-EK314seriesofevaluationboardismyimx6_defconfig$makemyimx6_defconfig编译内核(compilekernel)编译uImagecompileuImage$makeuImage说明:截图中使用了4线程编译。instruction:4threadscompilationisusedinthescreenshots。编译完成completecompilation目标文件targetfilearc

23、h/arm/boot/uImage即为编译得到的目标文件,使用ls命令可查看文件信息。arch/arm/boot/uImageisthetargetfilethroughcompilation,youcanviewthefileinformationwithlscommand。$lsarch/arm/boot/uImagela编译模块(compilemodule)编译compile$make说明:截图中使用了4线程编译。instruction:4threadscompilationisusedinthescreenshots。编译完成completecompilation目标文件targetf

24、ile编译完成后各模块的.ko文件位于代码所在的目录,通过find命令可以找出编译完成的模块,参考命令如下:.kofileofeachmoduleisinthedirectorywherecodeislocatedaftercompilation,youcanfindthemodulecompiledwithfindcommandaftercompilation,referingcommandasbelow:$find-name*.koLinux应用程序编译(Linuxapplicationcompilation)编写应用程序(writeapplication)1)创建应用程序目录create

25、applicationdirectory$mkdir/my-imx6/02_source/application/-p$cd/my-imx6/02_source/application/2)编写应用程序(这里以hello.c为例)创建hello.c文件写入以下代码并保存:includeintmain(intargc,char*argv)printf(“Hello,MYZR!n”);return;3)查看代码$cathello.c使编译配置文件生效(validatecompilerconfiguredfile)执行source命令$source/my-imx6/03_tools/myimx6_3

26、035_build_env查看编译配置$echo$ARCH$echo$CROSS_COMPILE提示:可看到ARCH和CROSS_COMPILE被设置验证交叉编译工具配置$CROSS_COMPILEgccv提示:执行命令后可以看到终端显示出交叉编译工具的版本信息。如下图:编译应用程序(compileapplication)2)编译$CROSS_COMPILEgcchello.c-ohello.out注意:上面的命令有包含“$”号,即“$CROSS_COMPILEgcc”,是引用我们source时产生的环境变量。3)查看目标文件类型$filehello.out可以看到目标文件hello.out的

27、属性。文件系统(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文件,其它请参照“添加应用到文件系统”。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1