“MYZR-SAMA5 Linux-3.18 编译手册”的版本间的差异

来自明远智睿的wiki
跳转至: 导航搜索
第1行: 第1行:
 
<div>
 
<div>
  
= '''文档说明(document instruction)''' =
+
= '''文档说明''' =
 
----
 
----
== '''系统环境说明(system environment instruction)''' ==
+
== '''系统环境说明''' ==
 
* 编译主机CPU架构:64位 <br>
 
* 编译主机CPU架构:64位 <br>
<span style="background:#CCCCCC">CUP architeture of host used for compilation:64bit</span><br>
 
 
* 编译主机系统:Linux <br>
 
* 编译主机系统:Linux <br>
<span style="background:#CCCCCC">system of compilation host:</span><br>
 
 
* Linux发行版:Ubuntu <br>
 
* Linux发行版:Ubuntu <br>
<span style="background:#CCCCCC">Linux release version: </span><br>
 
 
* Ubuntu版本类型:服务器版 <br>
 
* Ubuntu版本类型:服务器版 <br>
<span style="background:#CCCCCC">Ubuntu version type: saver version</span><br>
 
 
* Ubuntu版本号:12.04.5 <br>
 
* Ubuntu版本号:12.04.5 <br>
<span style="background:#CCCCCC">Ubuntu version no.:</span><br>
 
 
* Ubuntu系统类型:x86-64 <br>
 
* Ubuntu系统类型:x86-64 <br>
<span style="background:#CCCCCC">Ubuntu system type:</span><br>
 
 
  <span style="color:red">注意:开发主机请使用ubuntu 12.04.5 x86-64(桌面版或服务器版均可),使用其他发行版的Linux或Ubuntu的其它版本可能会遇到的不必要的问题。 <br>
 
  <span style="color:red">注意:开发主机请使用ubuntu 12.04.5 x86-64(桌面版或服务器版均可),使用其他发行版的Linux或Ubuntu的其它版本可能会遇到的不必要的问题。 <br>
<span style="background:#CCCCCC">The development host should use ubuntu 12.04.5 x86-64(desktop and server version are available),Using other distribution of Linux and other versions of Ubuntu may encounter unnecessary problems</span><br>
 
  
== '''操作说明 (operation instruction)''' ==
+
== '''操作说明 ''' ==
 
1)文档中以“$”开头的行,其后是Linux命令。 <br>
 
1)文档中以“$”开头的行,其后是Linux命令。 <br>
<span style="background:#CCCCCC">The line in the document which begins with “$”,which is followed by the Linux command.</span><br>
 
 
2)文档中所有的Linux命令建议手动输入到Linux主机执行(直接复制、粘贴到Linux主机上执行,可能会执行失败)。 <br>
 
2)文档中所有的Linux命令建议手动输入到Linux主机执行(直接复制、粘贴到Linux主机上执行,可能会执行失败)。 <br>
<span style="background:#CCCCCC">All the Linux commands in the document are recommended to be entered into the host manually for execution.(Copying ,pasting to the host directly to execute may fail)</span><br>
 
 
3)文档中的Linux执行命令,如果空格后的下一个字符是“-”的(如:sudo apt-get –y install之类的),请手动输入到Linux主机执行(直接复制、粘贴到Linux主机上执行,通常会执行失败)。 <br>
 
3)文档中的Linux执行命令,如果空格后的下一个字符是“-”的(如:sudo apt-get –y install之类的),请手动输入到Linux主机执行(直接复制、粘贴到Linux主机上执行,通常会执行失败)。 <br>
<span style="background:#CCCCCC">In all the Linux execution commands of the document,if the next character after the space is "-",(example:sudo apt-get –y install),please enter into Linux host to execute manually.(Copying ,pasting to the host directly to execute may fail )</span><br>
 
 
4)文档中所有一行没写完的Linux命令请手动输入到Linux主机执行,(因为复制、粘贴命令不能包含类似“换行符”之类的特殊字符)。 <br>
 
4)文档中所有一行没写完的Linux命令请手动输入到Linux主机执行,(因为复制、粘贴命令不能包含类似“换行符”之类的特殊字符)。 <br>
<span style="background:#CCCCCC">any line of Linux commands whichi is not finished is recommended to be entered into the host for execution. (Because copy or paste commands cannot contain special character such as "line breaks")</span><br>
 
 
5)按文档输入并执行Linux命令时注意观察命令的执行结果与文档图片中的是否一致,以确认命令是否输入有误及是否执行失败。 <br>
 
5)按文档输入并执行Linux命令时注意观察命令的执行结果与文档图片中的是否一致,以确认命令是否输入有误及是否执行失败。 <br>
<span style="background:#CCCCCC">Note whether the execution result is  consistent with the document image when you enter and execute the command. check the command was entered incorrectly or failed to execute.。 )</span><br>
 
 
6)第一遍编译请严格按照文档进行,否则可能出现莫名其妙的错误。<br>
 
6)第一遍编译请严格按照文档进行,否则可能出现莫名其妙的错误。<br>
<span style="background:#CCCCCC">Please follow the document strictly to compile for the first time.Otherwise ,there may be unexpected error。</span><br>
 
  
== '''截图说明(screenshots instruction)''' ==
+
== '''截图说明''' ==
 
为使视图看起来简洁整齐,截图中的命令提示符统一使用myzr$。<br>
 
为使视图看起来简洁整齐,截图中的命令提示符统一使用myzr$。<br>
<span style="background:#CCCCCC">To make the view look neat and tidy , the command prompt in the screenshot should use myzr$ uniformly。</span><br>
 
  
== '''图片中的Linux命令(Linux command in the image)''' ==
+
== '''图片中的Linux命令''' ==
 
在文档的图片中观察“myzr$”开头的行可以直观的看到输入的Linux命令。<br>
 
在文档的图片中观察“myzr$”开头的行可以直观的看到输入的Linux命令。<br>
<span style="background:#CCCCCC">In the image of the document, you can see the input Linux command visually from the lines that start with “myzr$”。</span><br>
 
  
== <span style="color:red">'''重要信息说明(important information instruction)'''</span> ==
+
== <span style="color:red">'''重要信息说明'''</span> ==
 
<span style="color:red">为避免各位客户在搭建开发环境及编译过程中遇到不必要的问题浪费时间和精力,推荐使用明远智睿发布的“vb43-u12045-serv-amd64”虚拟机系统。<br></span>
 
<span style="color:red">为避免各位客户在搭建开发环境及编译过程中遇到不必要的问题浪费时间和精力,推荐使用明远智睿发布的“vb43-u12045-serv-amd64”虚拟机系统。<br></span>
<span style="background:#CCCCCC">To avoid our customers wasting time and energy when they encounter unnecessary problems in building development environment and compiling process,it is recommended to use “vb43-u12045-serv-amd64” virtual machine system released by MYZR。)</span><br>
+
'''具体参见 [[MYZR虚拟机系统指导|《MYZR虚拟机系统指导》]]'''
'''具体参见 [[MYZR虚拟机系统指导]]'''
 
<span style="background:#CCCCCC">details refered to [[MYZR virtual machine system guidance]]</span><br>
 
  
= '''安装并配置交叉编译工具链(install and configure cross compilation tool chain)''' =
+
= '''安装并配置交叉编译工具链''' =
 
----
 
----
== '''准备交叉编译工具链安装包(prepare installation package of cross compilation tool chain)''' ==
+
== '''准备交叉编译工具链安装包''' ==
 
1)下载交叉编译工具<br>
 
1)下载交叉编译工具<br>
<span style="background:#CCCCCC">download cross compilation tool</span><br>
 
 
交叉编译工具:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz<br>
 
交叉编译工具:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz<br>
<span style="background:#CCCCCC">cross compilation tool:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz</span><br>
 
 
交叉编译工具配置文件:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
交叉编译工具配置文件:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
<span style="background:#CCCCCC">configured file of cross compilation tool:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config</span><br>
 
 
2)在虚拟机系统创建工具目录<br>
 
2)在虚拟机系统创建工具目录<br>
<span style="background:#CCCCCC">create tool directory in virtual machine system</span><br>
 
 
$ mkdir ~/my-sama5/03_tools -p <br>
 
$ mkdir ~/my-sama5/03_tools -p <br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.1.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.1.0.1.png|642px]]<br>
 
3)复制文件到虚拟机系统<br>
 
3)复制文件到虚拟机系统<br>
<span style="background:#CCCCCC">copy file to virtual machine sytem</span><br>
 
 
把交叉编译工具和配置文件复制到 ~/my-sama5/03_tools<br>
 
把交叉编译工具和配置文件复制到 ~/my-sama5/03_tools<br>
<span style="background:#CCCCCC">copy cross compilation tool and configured file to ~/my-sama5/03_tools</span><br>
 
 
自己采取合适的方式完成。
 
自己采取合适的方式完成。
<span style="background:#CCCCCC">this step should be done in your own way</span><br>
 
  
== '''安装交叉编译工具(install cross compilation tool)''' ==
+
== '''安装交叉编译工具''' ==
 
1)进入交叉编译工具链目录<br>
 
1)进入交叉编译工具链目录<br>
<span style="background:#CCCCCC">enter cross compilation tool chain diretory</span><br>
 
 
$ cd ~/my-sama5/03_tools/ <br>
 
$ cd ~/my-sama5/03_tools/ <br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.2.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.2.0.1.png|642px]]<br>
 
2)解压(安装)交叉编译工具<br>
 
2)解压(安装)交叉编译工具<br>
<span style="background:#CCCCCC">decompress(install) cross compilation tool</span><br>
 
 
$ tar xf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz<br>
 
$ tar xf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.2.0.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.2.0.2.png|642px]]<br>
 
3)检查安装 <br>
 
3)检查安装 <br>
<span style="background:#CCCCCC">check installation</span><br>
 
 
查看交叉编译工具链的版本信息以验证交叉编译工具链安装正常。<br>
 
查看交叉编译工具链的版本信息以验证交叉编译工具链安装正常。<br>
<span style="background:#CCCCCC">check the version information of cross compilation tool chain to verify the normality of the installation</span><br>
 
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
$ ${CROSS_COMPILE}gcc –v<br>
 
$ ${CROSS_COMPILE}gcc –v<br>
 
执行命令后会出现类似如下的信息:<br>
 
执行命令后会出现类似如下的信息:<br>
<span style="background:#CCCCCC">after execution of command,there will be following message:</span><br>
 
 
[[文件:MY-SAMA5 Linux-3.18_build_3.3.0.7.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_3.3.0.7.png|642px]]<br>
 
以及在最后一行会出现 gcc 版本相关的信息<br>
 
以及在最后一行会出现 gcc 版本相关的信息<br>
<span style="background:#CCCCCC">and there will come out with information related to gcc version in the last line</span><br>
 
 
gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)
 
gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)
  
= '''AT91Bootstrap编译(AT91Bootstrap compilation)''' =
+
= '''AT91Bootstrap编译''' =
 
----
 
----
== '''准备源码(prepare source code)''' ==
+
== '''准备源码''' ==
 
1)下载源码<br>
 
1)下载源码<br>
<span style="background:#CCCCCC">download source code</span><br>
 
 
文件名:at91bootstrap-3.7.2.tar.bz2<br>
 
文件名:at91bootstrap-3.7.2.tar.bz2<br>
<span style="background:#CCCCCC">name of file:at91bootstrap-3.7.2.tar.bz2</span><br>
 
 
AT91Bootstrap 是二级引导装载程序,为Atmel AT91 SoC提供了一套算法来管理硬件初始化。如时钟速度配置,PIO设置,内存初始化,从指定的引导介质下载主应用程序到主内存并启动。<br>
 
AT91Bootstrap 是二级引导装载程序,为Atmel AT91 SoC提供了一套算法来管理硬件初始化。如时钟速度配置,PIO设置,内存初始化,从指定的引导介质下载主应用程序到主内存并启动。<br>
<span style="background:#CCCCCC">AT91Bootstrap is a two stage boot loader,which provide a set of algorithm to manage hardware initialization,such as configuration of clock and speed,setting of PIO,initialization of memory.
 
download main application to main memory and boot from specified boot media</span><br>
 
 
2)创建工作目录<br>
 
2)创建工作目录<br>
<span style="background:#CCCCCC">create working directory</span><br>
 
 
$ mkdir ~/my-sama5/02_source -p <br>
 
$ mkdir ~/my-sama5/02_source -p <br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.1.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.1.0.1.png|642px]]<br>
 
3)将源码复制到工作目录<br>
 
3)将源码复制到工作目录<br>
<span style="background:#CCCCCC">copy source code to working directory</span><br>
 
 
这一步自己采取合适的方式将AT91Bootstrap源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。<br>
 
这一步自己采取合适的方式将AT91Bootstrap源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。<br>
<span style="background:#CCCCCC">copy in your own way AT91Bootstrap to “~/my-sama5/02_source”,or refer to “2.3 demo of common function”</span><br>
 
 
4)解压源码<br>
 
4)解压源码<br>
<span style="background:#CCCCCC">decompress source code</span><br>
 
 
* 进入工作目录<br>
 
* 进入工作目录<br>
<span style="background:#CCCCCC">enter working directory</span><br>
 
 
$ cd ~/my-sama5/02_source/<br>
 
$ cd ~/my-sama5/02_source/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.1.0.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.1.0.2.png|642px]]<br>
 
* 执行解压命令<br>
 
* 执行解压命令<br>
<span style="background:#CCCCCC">execute decompress command</span><br>
 
 
$ tar jxf at91bootstrap-3.7.2.tar.bz2<br>
 
$ tar jxf at91bootstrap-3.7.2.tar.bz2<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.1.0.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.1.0.3.png|642px]]<br>
  
== '''编译(compile)''' ==
+
== '''编译''' ==
 
1)进入源码目录<br>
 
1)进入源码目录<br>
<span style="background:#CCCCCC">enter source code directory</span><br>
 
 
$ cd ~/my-sama5/02_source/at91bootstrap-3.7.2/<br>
 
$ cd ~/my-sama5/02_source/at91bootstrap-3.7.2/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.1.png|642px]]<br>
 
2)使编译配置文件生效<br>
 
2)使编译配置文件生效<br>
<span style="background:#CCCCCC">validate configured file of compilation</span><br>
 
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
3)清除代码中可能存在的临时文件<br>
 
3)清除代码中可能存在的临时文件<br>
<span style="background:#CCCCCC">remove temporary file which may exist in the code</span><br>
 
 
$ make mrproper<br>
 
$ make mrproper<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.3.png|642px]]<br>
 
4)生成配置文件<br>
 
4)生成配置文件<br>
<span style="background:#CCCCCC">generate configuration file</span><br>
 
 
$ make mysama5ek200_defconfig<br>
 
$ make mysama5ek200_defconfig<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.4.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.4.png|642px]]<br>
 
5)执行编译<br>
 
5)执行编译<br>
<span style="background:#CCCCCC">execute compilation</span><br>
 
 
$ make –j4<br>
 
$ make –j4<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.5.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.5.png|642px]]<br>
 
6)编译完成<br>
 
6)编译完成<br>
<span style="background:#CCCCCC">complete compilation</span><br>
 
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.6.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.2.0.6.png|642px]]<br>
  
== '''目标文件(target file)''' ==
+
== '''目标文件''' ==
 
1)目标文件<br>
 
1)目标文件<br>
<span style="background:#CCCCCC">target file</span><br>
 
 
编译完成后会在源码的binaries目录下产生我们需要的目标文件。<br>
 
编译完成后会在源码的binaries目录下产生我们需要的目标文件。<br>
<span style="background:#CCCCCC">target file needed by us will be generated under directory of binaries of source code after compilation is completed</span><br>
 
 
通过ls命令可以看到,其中mysama5ek200-dataflashboot-uboot-3.7.2.bin 即是我们需要的文件。<br>
 
通过ls命令可以看到,其中mysama5ek200-dataflashboot-uboot-3.7.2.bin 即是我们需要的文件。<br>
<span style="background:#CCCCCC">you can see through ls command that mysama5ek200-dataflashboot-uboot-3.7.2.bin is the file what we need.</span><br>
 
 
$ ls binaries/<br>
 
$ ls binaries/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.3.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.3.0.1.png|642px]]<br>
 
2)重命令目标文件<br>
 
2)重命令目标文件<br>
<span style="background:#CCCCCC">re-name target file</span><br>
 
 
我们在烧录的时候需要使用到这些目标文件。为了烧录的方便,我们需要将目标文件修改为我们需要的文件名,即bootstrap-mysama5ek200.*。<br>
 
我们在烧录的时候需要使用到这些目标文件。为了烧录的方便,我们需要将目标文件修改为我们需要的文件名,即bootstrap-mysama5ek200.*。<br>
<span style="background:#CCCCCC">these target files will be used by us in programming,to make programming convenient,we need to change the name of these files to be as bootstrap-mysama5ek200.* </span><br>
 
 
$ cd binaries/<br>
 
$ cd binaries/<br>
 
$ rename 's/mysama5ek200-dataflashboot-uboot-3.7.2/bootstrap-mysama5ek200/' *<br>
 
$ rename 's/mysama5ek200-dataflashboot-uboot-3.7.2/bootstrap-mysama5ek200/' *<br>
第160行: 第109行:
 
[[文件:MY-SAMA5 Linux-3.18_build_4.3.0.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_4.3.0.2.png|642px]]<br>
 
3)保存目标文件<br>
 
3)保存目标文件<br>
<span style="background:#CCCCCC">save target file</span><br>
 
 
将bootstrap-mysama5ek200.* 保存。<br>
 
将bootstrap-mysama5ek200.* 保存。<br>
<span style="background:#CCCCCC">save bootstrap-mysama5ek200.*</span><br>
 
  
= '''u-boot编译(u-boot compilation)''' =
+
= '''u-boot编译''' =
 
----
 
----
== '''准备源码(prepare source code)''' ==
+
== '''准备源码''' ==
 
1)下载源码<br>
 
1)下载源码<br>
<span style="background:#CCCCCC">download source code</span><br>
 
 
文件名:u-boot-at91-linux4sam_4.7.tar.bz2<br>
 
文件名:u-boot-at91-linux4sam_4.7.tar.bz2<br>
<span style="background:#CCCCCC">name of file: u-boot-at91-linux4sam_4.7.tar.bz2</span><br>
 
 
U-Boot在Atmel AT91 SoC上作为第三阶段引导加载程序。它负责配置主要接口,并引导Linux系统。<br>
 
U-Boot在Atmel AT91 SoC上作为第三阶段引导加载程序。它负责配置主要接口,并引导Linux系统。<br>
<span style="background:#CCCCCC">U-boot is the third stage bootloader on Atmel AT91 SoC, it is engaged in configuring main interfaces and booting Linux system</span><br>
 
 
2)将源码复制到工作目录<br>
 
2)将源码复制到工作目录<br>
<span style="background:#CCCCCC">copy source code to working directory</span><br>
 
 
这一步自己采取合适的方式将u-boot源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。<br>
 
这一步自己采取合适的方式将u-boot源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。<br>
<span style="background:#CCCCCC">copy in your own way source code of u-boot to “~/my-sama5/02_source”,or refer to “2.3 demo of common function”</span><br>
 
 
3)解压源码<br>
 
3)解压源码<br>
<span style="background:#CCCCCC">decompress source code</span><br>
 
 
* 进入工作目录<br>
 
* 进入工作目录<br>
<span style="background:#CCCCCC">enter working directory</span><br>
 
 
$ cd ~/my-sama5/02_source/<br>
 
$ cd ~/my-sama5/02_source/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.1.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.1.0.1.png|642px]]<br>
 
* 执行解压命令<br>
 
* 执行解压命令<br>
<span style="background:#CCCCCC">execute decompress command</span><br>
 
 
$ tar jxf u-boot-at91-linux4sam_4.7.tar.bz2<br>
 
$ tar jxf u-boot-at91-linux4sam_4.7.tar.bz2<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.1.0.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.1.0.2.png|642px]]<br>
  
== '''编译 (compile)''' ==
+
== '''编译 ''' ==
 
1)进入u-boot源码目录<br>
 
1)进入u-boot源码目录<br>
<span style="background:#CCCCCC">enter directory of u-boot source code</span><br>
 
 
$ cd ~/my-sama5/02_source/u-boot-at91-linux4sam_4.7/<br>
 
$ cd ~/my-sama5/02_source/u-boot-at91-linux4sam_4.7/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.1.png|642px]]<br>
 
2)使编译配置文件生效<br>
 
2)使编译配置文件生效<br>
<span style="background:#CCCCCC">validate configured file of compilation</span><br>
 
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
3)清除代码中可能存在的临时文件<br>
 
3)清除代码中可能存在的临时文件<br>
<span style="background:#CCCCCC">remove temporary file which may exist in code</span><br>
 
 
$ make distclean<br>
 
$ make distclean<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.3.png|642px]]<br>
 
4)生成配置文件<br>
 
4)生成配置文件<br>
<span style="background:#CCCCCC">generate configured file</span><br>
 
 
$ make mysama5ek200_defconfig<br>
 
$ make mysama5ek200_defconfig<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.4.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.4.png|642px]]<br>
 
5)执行编译<br>
 
5)执行编译<br>
<span style="background:#CCCCCC">execute compilation</span><br>
 
 
$ make –j4<br>
 
$ make –j4<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.5.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.5.png|642px]]<br>
 
6)编译完成<br>
 
6)编译完成<br>
<span style="background:#CCCCCC">complete compilation</span><br>
 
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.6.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.2.0.6.png|642px]]<br>
  
== '''目标文件(target file)''' ==
+
== '''目标文件''' ==
 
编译完成后会在源码的目录下产生我们需要的目标文件。<br>
 
编译完成后会在源码的目录下产生我们需要的目标文件。<br>
<span style="background:#CCCCCC">target file needed by us will be generated under directory of source code after compilation is completed</span><br>
 
 
通过ls命令可以看到。其中u-boot.bin 即是我们需要的文件。<br>
 
通过ls命令可以看到。其中u-boot.bin 即是我们需要的文件。<br>
<span style="background:#CCCCCC">you can see through ls command that u-boot.bin  is the file what we need.</span><br>
 
 
$ ls u-boot* -1<br>
 
$ ls u-boot* -1<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.3.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.3.0.1.png|642px]]<br>
 
2)重命令目标文件<br>
 
2)重命令目标文件<br>
<span style="background:#CCCCCC">re-name target file</span><br>
 
 
我们在烧录的时候需要使用到这些目标文件。为了烧录的方便,我们需要将目标文件修改为我们需要的文件名,即uboot-mysama5ek200.bin。<br>
 
我们在烧录的时候需要使用到这些目标文件。为了烧录的方便,我们需要将目标文件修改为我们需要的文件名,即uboot-mysama5ek200.bin。<br>
<span style="background:#CCCCCC">these target files will be used by us in programming,to make programming convenient,we need to change the name of these files to be as uboot-mysama5ek200.bin.</span><br>
 
 
$ mv u-boot.bin uboot-mysama5ek200.bin<br>
 
$ mv u-boot.bin uboot-mysama5ek200.bin<br>
 
$ ls uboot-mysama5ek200.bin<br>
 
$ ls uboot-mysama5ek200.bin<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.3.0.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_5.3.0.2.png|642px]]<br>
 
3)保存目标文件<br>
 
3)保存目标文件<br>
<span style="background:#CCCCCC">save target file</span><br>
 
 
将uboot-mysama5ek200.bin 保存。<br>
 
将uboot-mysama5ek200.bin 保存。<br>
<span style="background:#CCCCCC">save uboot-mysama5ek200.bin</span><br>
 
  
= '''内核编译(compile kernel)''' =
+
= '''内核编译''' =
 
----
 
----
== '''准备源码(prepare source code)''' ==
+
== '''准备源码''' ==
 
1)下载源码<br>
 
1)下载源码<br>
<span style="background:#CCCCCC">download source code</span><br>
 
 
文件名:linux-at91-linux4sam_4.7.tar.bz2<br>
 
文件名:linux-at91-linux4sam_4.7.tar.bz2<br>
<span style="background:#CCCCCC">name of file:linux-at91-linux4sam_4.7.tar.bz2</span><br>
 
 
2)将源码复制到工作目录<br>
 
2)将源码复制到工作目录<br>
<span style="background:#CCCCCC">copy source code to the working directory</span><br>
 
 
这一步自己采取合适的方式将内核源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。<br>
 
这一步自己采取合适的方式将内核源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。<br>
<span style="background:#CCCCCC">copy in your own way source code of kernel to “~/my-sama5/02_source”,or refer to “2.3 demo of common function”</span><br>
 
 
3)解压源码<br>
 
3)解压源码<br>
<span style="background:#CCCCCC">decompress source code</span><br>
 
 
* 进入工作目录<br>
 
* 进入工作目录<br>
<span style="background:#CCCCCC">enter working directory</span><br>
 
 
$ cd ~/my-sama5/02_source/<br>
 
$ cd ~/my-sama5/02_source/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.1.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.1.0.1.png|642px]]<br>
 
* 执行解压命令<br>
 
* 执行解压命令<br>
<span style="background:#CCCCCC">execute decompress command</span><br>
 
 
$ tar jxf linux-at91-linux4sam_4.7.tar.bz2<br>
 
$ tar jxf linux-at91-linux4sam_4.7.tar.bz2<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.1.0.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.1.0.2.png|642px]]<br>
  
== '''编译(compile)''' ==
+
== '''编译''' ==
 
1)进入内核源码目录<br>
 
1)进入内核源码目录<br>
<span style="background:#CCCCCC">enter directory of kernel source code</span><br>
 
 
$ cd ~/my-sama5/02_source/linux-at91-linux4sam_4.7/<br>
 
$ cd ~/my-sama5/02_source/linux-at91-linux4sam_4.7/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.0.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.0.1.png|642px]]<br>
 
2)使编译配置文件生效<br>
 
2)使编译配置文件生效<br>
<span style="background:#CCCCCC">validate configured file of compilation</span><br>
 
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config<br>
 
3)清除代码中可能存在的临时文件<br>
 
3)清除代码中可能存在的临时文件<br>
<span style="background:#CCCCCC">remove temporary file which may exist in the code</span><br>
 
 
$ make distclean<br>
 
$ make distclean<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.0.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.0.3.png|642px]]<br>
  
=== 编译内核文件(compile kernel file) ===
+
=== 编译内核文件 ===
 
1)生成内核配置文件<br>
 
1)生成内核配置文件<br>
<span style="background:#CCCCCC">generate kernel configuration file</span><br>
 
 
$ make ARCH=arm mysama5ek200_defconfig<br>
 
$ make ARCH=arm mysama5ek200_defconfig<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.1.png|642px]]<br>
 
2)执行内核文件编译命令<br>
 
2)执行内核文件编译命令<br>
<span style="background:#CCCCCC">execute compilation command of kernel file</span><br>
 
 
$ make -j4 ARCH=arm zImage<br>
 
$ make -j4 ARCH=arm zImage<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.2.png|642px]]<br>
 
3)内核文件编译完成<br>
 
3)内核文件编译完成<br>
<span style="background:#CCCCCC">complete compilation of kernel file</span><br>
 
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.3.png|642px]]<br>
 
4)内核目标文件<br>
 
4)内核目标文件<br>
<span style="background:#CCCCCC">kernel target file</span><br>
 
 
$ ls arch/arm/boot/zImage<br>
 
$ ls arch/arm/boot/zImage<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.4.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.1.4.png|642px]]<br>
  
=== 编译设备树文件(compile file of device tree) ===
+
=== 编译设备树文件 ===
 
1)执行设备树文件编译命令<br>
 
1)执行设备树文件编译命令<br>
<span style="background:#CCCCCC">execute compilation command for device tree file</span><br>
 
 
$ make ARCH=arm mysama5ek200-d36.dtb<br>
 
$ make ARCH=arm mysama5ek200-d36.dtb<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.2.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.2.1.png|642px]]<br>
 
2)设备树目标文件<br>
 
2)设备树目标文件<br>
<span style="background:#CCCCCC">target file of device tree</span><br>
 
 
$ ls arch/arm/boot/dts/mysama5ek200-d36.dtb<br>
 
$ ls arch/arm/boot/dts/mysama5ek200-d36.dtb<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.2.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.2.2.png|642px]]<br>
  
=== 编译内核模块(compile kernel module) ===
+
=== 编译内核模块 ===
 
1)执行内核模块编译命令<br>
 
1)执行内核模块编译命令<br>
<span style="background:#CCCCCC">execute compilation command for kernel module</span><br>
 
 
$ make ARCH=arm modules<br>
 
$ make ARCH=arm modules<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.1.png|642px]]<br>
 
2)内核模块编译完成<br>
 
2)内核模块编译完成<br>
<span style="background:#CCCCCC">complete compilation of kernel module</span><br>
 
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.2.png|642px]]<br>
 
3)安装内核模块到指定目录<br>
 
3)安装内核模块到指定目录<br>
<span style="background:#CCCCCC">install kernel module to specified directory</span><br>
 
 
$ make ARCH=arm modules_install INSTALL_MOD_PATH=./modules<br>
 
$ make ARCH=arm modules_install INSTALL_MOD_PATH=./modules<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.3.png|642px]]<br>
 
4)打包内核模块<br>
 
4)打包内核模块<br>
<span style="background:#CCCCCC">package nernel module</span><br>
 
 
$ tar cjf modules_mysama5ek200.tar.bz2 modules/*<br>
 
$ tar cjf modules_mysama5ek200.tar.bz2 modules/*<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.4.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.4.png|642px]]<br>
 
5)模块包<br>
 
5)模块包<br>
<span style="background:#CCCCCC">module package</span><br>
 
 
$ ls modules_mysama5ek200.tar.bz2<br>
 
$ ls modules_mysama5ek200.tar.bz2<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.5.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_6.2.3.5.png|642px]]<br>
  
= '''文件系统编译(compile file system)''' =
+
= '''文件系统编译''' =
 
----
 
----
== '''注意及说明(note and instruction)''' ==
+
== '''注意及说明''' ==
 
a) 原始编译的过程中的下载量大约4G。(提示:可以使用我们下载好的一些文件,以减少下载量,节约时间,在7.4中会说到)。 <br>
 
a) 原始编译的过程中的下载量大约4G。(提示:可以使用我们下载好的一些文件,以减少下载量,节约时间,在7.4中会说到)。 <br>
<span style="background:#CCCCCC">The download of the original compilation exceed 4G。(tips:you can use files we have downloaded in order to reduce downloads and save time,which is going to be mentioned in 7.4)</span><br>
 
 
b) 编译主机的网络连接最好使用能访问www.fackbook.com 的网络,不然可能会受到境内防火墙的限制而无法下载编译需要的软件包。 <br>
 
b) 编译主机的网络连接最好使用能访问www.fackbook.com 的网络,不然可能会受到境内防火墙的限制而无法下载编译需要的软件包。 <br>
<span style="background:#CCCCCC">The network of the compilation host is good to access to  www.fackbook.com .Otherwise It  may be subject to the condition of the  domestic firewall and  It is unable to download the software for compilation.。</span><br>
 
 
c) 初次编译需要的时间根据网络状态及编译主机的配置需要2小时到无限时间(经粗略统计除去下载时间,在16核CPU、16G内存的主机上编译QT5系统用了大约100分钟。) <br>
 
c) 初次编译需要的时间根据网络状态及编译主机的配置需要2小时到无限时间(经粗略统计除去下载时间,在16核CPU、16G内存的主机上编译QT5系统用了大约100分钟。) <br>
<span style="background:#CCCCCC">The initial compilation may take 2  hours  to unlimited time.It depends on the network state and the configuration of the host.(After a rough statistics, It took about 100 minutes to compile QT5 system on the 16-core CPU 16 G memory host  except download time。</span><br>
 
 
客户请根据实际情况决定是否自行编译文件系统或使用我们提供的文件系统。 <br>
 
客户请根据实际情况决定是否自行编译文件系统或使用我们提供的文件系统。 <br>
<span style="background:#CCCCCC">Customer may decide whether to compile the file system or use the file system We provide based on the actual situation. If the file system we provide meets the requirements, you had better not to compile by yourself. Since It may be a lot of errors during compilation.。</span><br>
 
  
== '''编译前的准备(preparation before compilation)''' ==
+
== '''编译前的准备''' ==
=== 准备Yocto编译环境(prepare compliation environment for Yocto) ===
+
=== 准备Yocto编译环境===
 
说明,Yocto编译依赖一些软件包,所以需要在开发主机上进行安装。 <br>
 
说明,Yocto编译依赖一些软件包,所以需要在开发主机上进行安装。 <br>
<span style="background:#CCCCCC">instruction: Yocto compilation depends on some software packages, so they need to be installed on development host.</span><br>
 
 
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath  socat <br>
 
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath  socat <br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.1.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.1.1.png|642px]]<br>
第337行: 第238行:
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.1.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.1.3.png|642px]]<br>
  
=== 准备源码(prepare source code) ===
+
=== 准备源码 ===
 
1)下载源码<br>
 
1)下载源码<br>
<span style="background:#CCCCCC">download source code</span><br>
 
 
源码包文件名:atmel_fido.tar.bz2<br>
 
源码包文件名:atmel_fido.tar.bz2<br>
<span style="background:#CCCCCC"></span><br>
 
 
2)创建yocto工作目录<br>
 
2)创建yocto工作目录<br>
<span style="background:#CCCCCC">create working directory of yocto</span><br>
 
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.2.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.2.1.png|642px]]<br>
 
3)将源码复制到开发主机<br>
 
3)将源码复制到开发主机<br>
<span style="background:#CCCCCC">copy source code to devleopment host</span><br>
 
 
这一步自己采取合适的方式将源码复制到yocto工作目录(即:/home/myzr/yocto)。也可以参照“2.3 常用功能演示”。<br>
 
这一步自己采取合适的方式将源码复制到yocto工作目录(即:/home/myzr/yocto)。也可以参照“2.3 常用功能演示”。<br>
<span style="background:#CCCCCC">copy in your own way source code to yocto directory(e.g /home/myzr/yocto),or refer to “2.3 demo fo common functions"</span><br>
 
 
4)解压源码包<br>
 
4)解压源码包<br>
<span style="background:#CCCCCC">decompress source code package</span><br>
 
 
* 进入用户主目录<br>
 
* 进入用户主目录<br>
<span style="background:#CCCCCC">enter main directory of user</span><br>
 
 
$ cd ~/yocto<br>
 
$ cd ~/yocto<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.2.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.2.2.png|642px]]<br>
 
* 执行解压命令<br>
 
* 执行解压命令<br>
<span style="background:#CCCCCC">execute decompress command</span><br>
 
 
$ tar jxf atmel_fido.tar.bz2<br>
 
$ tar jxf atmel_fido.tar.bz2<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.2.3.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.2.3.png|642px]]<br>
  
=== 准备软件包(prepare software package) ===
+
=== 准备软件包 ===
 
1)创建“/opt/yocto”目录用于存放软件包<br>
 
1)创建“/opt/yocto”目录用于存放软件包<br>
<span style="background:#CCCCCC">create directory of “/opt/yocto”for saving software package</span><br>
 
 
$ sudo mkdir /opt/yocto<br>
 
$ sudo mkdir /opt/yocto<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.3.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.3.1.png|642px]]<br>
第368行: 第260行:
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.3.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.2.3.2.png|642px]]<br>
 
2)下载软件包<br>
 
2)下载软件包<br>
<span style="background:#CCCCCC">download software package</span><br>
 
 
在网盘中下载yocto的软件包。<br>
 
在网盘中下载yocto的软件包。<br>
<span style="background:#CCCCCC">download yocto software package from network disk</span><br>
 
 
软件包相对路径:yocto/downloads,将downloads下载到Windows。<br>
 
软件包相对路径:yocto/downloads,将downloads下载到Windows。<br>
<span style="background:#CCCCCC">relative path of software package:yocto/downloads,download downloads to Windows。</span><br>
 
 
3)将软件包复制到开发主机<br>
 
3)将软件包复制到开发主机<br>
<span style="background:#CCCCCC">copy software package to devleopment host</span><br>
 
 
将下载好的“downloads”目录复制到开发主机的“/opt/yocto”。<br>
 
将下载好的“downloads”目录复制到开发主机的“/opt/yocto”。<br>
<span style="background:#CCCCCC">copy directory of “downloads”downloaded to “/opt/yocto”of development host</span><br>
 
  
== '''编译文件系统 (compile file system)''' ==
+
== '''编译文件系统 ''' ==
=== 编译前的配置(configuration before compilation) ===
+
=== 编译前的配置===
 
1)准备编译配置文件<br>
 
1)准备编译配置文件<br>
<span style="background:#CCCCCC">prepare configuration file of compilation</span><br>
 
 
文件目录:conf。下载conf目录到Windows。<br>
 
文件目录:conf。下载conf目录到Windows。<br>
<span style="background:#CCCCCC">file directory:conf。download directory of conf to Windows</span><br>
 
 
2)进入poky目录 <br>
 
2)进入poky目录 <br>
<span style="background:#CCCCCC">enter directory of poky</span><br>
 
 
$ cd ~/yocto/atmel_fido/poky/<br>
 
$ cd ~/yocto/atmel_fido/poky/<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.1.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.1.1.png|642px]]<br>
第391行: 第275行:
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.1.2.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.1.2.png|642px]]<br>
 
3)初始化编译目录<br>
 
3)初始化编译目录<br>
<span style="background:#CCCCCC">initiate directory of compilatio</span><br>
 
 
$ source oe-init-build-env build-atmel<br>
 
$ source oe-init-build-env build-atmel<br>
 
4)复制编译配置文件到编译目录<br>
 
4)复制编译配置文件到编译目录<br>
<span style="background:#CCCCCC">copy confirured file of compilation to drectory of compilation</span><br>
 
 
将 conf 目录复制到 /home/myzr/yocto/poky/build-atmel 。<br>
 
将 conf 目录复制到 /home/myzr/yocto/poky/build-atmel 。<br>
<span style="background:#CCCCCC">copy conf directory to /home/myzr/yocto/poky/build-atmel</span><br>
 
  
=== 编译QT5文件系统(compile file system of QT5) ===
+
=== 编译QT5文件系统 ===
 
$ bitbake atmel-qt5-demo-image<br>
 
$ bitbake atmel-qt5-demo-image<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.2.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.2.1.png|642px]]<br>
 
提示:整个编译过程除去下载时间,在16核CPU、16G内存的主机上需要1小时左右。 <br>
 
提示:整个编译过程除去下载时间,在16核CPU、16G内存的主机上需要1小时左右。 <br>
<span style="background:#CCCCCC">Tips: the whole compilation process will  take about one hour to compile on the 16-core CPU and 16G memory host except download time.</span><br>
 
 
* 目标文件<br>
 
* 目标文件<br>
<span style="background:#CCCCCC">target file</span><br>
 
 
在./tmp/deploy/images/sama5d3xek/目录下可以找到我们编译生成的目标文件。 <br>
 
在./tmp/deploy/images/sama5d3xek/目录下可以找到我们编译生成的目标文件。 <br>
<span style="background:#CCCCCC">you can find the target file we compiled in the directory of ./tmp/deploy/images/sama5d3xek/</span><br>
 
  
=== 编译QT5交叉编译工具(compile the cross-compiler tool for QT5) ===
+
=== 编译QT5交叉编译工具 ===
 
$ bitbake meta-toolchain-qt5<br>
 
$ bitbake meta-toolchain-qt5<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.3.1.png|642px]]<br>
 
[[文件:MY-SAMA5 Linux-3.18_build_7.3.3.1.png|642px]]<br>
 
* 目标文件 <br>
 
* 目标文件 <br>
<span style="background:#CCCCCC">target file</span><br>
 
 
在./tmp/deploy/images/sama5d3xek/目录下可以找到我们编译生成的目标文件。 <br>
 
在./tmp/deploy/images/sama5d3xek/目录下可以找到我们编译生成的目标文件。 <br>
<span style="background:#CCCCCC">you can find the target file we compiled in the directory of ./tmp/deploy/images/sama5d3xek</span><br>
+
 
 
</div>
 
</div>

2018年7月27日 (五) 11:44的版本

文档说明


系统环境说明

  • 编译主机CPU架构:64位
  • 编译主机系统:Linux
  • Linux发行版:Ubuntu
  • Ubuntu版本类型:服务器版
  • Ubuntu版本号:12.04.5
  • Ubuntu系统类型:x86-64

  注意:开发主机请使用ubuntu 12.04.5 x86-64(桌面版或服务器版均可),使用其他发行版的Linux或Ubuntu的其它版本可能会遇到的不必要的问题。

操作说明

1)文档中以“$”开头的行,其后是Linux命令。
2)文档中所有的Linux命令建议手动输入到Linux主机执行(直接复制、粘贴到Linux主机上执行,可能会执行失败)。
3)文档中的Linux执行命令,如果空格后的下一个字符是“-”的(如:sudo apt-get –y install之类的),请手动输入到Linux主机执行(直接复制、粘贴到Linux主机上执行,通常会执行失败)。
4)文档中所有一行没写完的Linux命令请手动输入到Linux主机执行,(因为复制、粘贴命令不能包含类似“换行符”之类的特殊字符)。
5)按文档输入并执行Linux命令时注意观察命令的执行结果与文档图片中的是否一致,以确认命令是否输入有误及是否执行失败。
6)第一遍编译请严格按照文档进行,否则可能出现莫名其妙的错误。

截图说明

为使视图看起来简洁整齐,截图中的命令提示符统一使用myzr$。

图片中的Linux命令

在文档的图片中观察“myzr$”开头的行可以直观的看到输入的Linux命令。

重要信息说明

为避免各位客户在搭建开发环境及编译过程中遇到不必要的问题浪费时间和精力,推荐使用明远智睿发布的“vb43-u12045-serv-amd64”虚拟机系统。
具体参见 《MYZR虚拟机系统指导》

安装并配置交叉编译工具链


准备交叉编译工具链安装包

1)下载交叉编译工具
交叉编译工具:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
交叉编译工具配置文件:gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config
2)在虚拟机系统创建工具目录
$ mkdir ~/my-sama5/03_tools -p
MY-SAMA5 Linux-3.18 build 3.1.0.1.png
3)复制文件到虚拟机系统
把交叉编译工具和配置文件复制到 ~/my-sama5/03_tools
自己采取合适的方式完成。

安装交叉编译工具

1)进入交叉编译工具链目录
$ cd ~/my-sama5/03_tools/
MY-SAMA5 Linux-3.18 build 3.2.0.1.png
2)解压(安装)交叉编译工具
$ tar xf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
MY-SAMA5 Linux-3.18 build 3.2.0.2.png
3)检查安装
查看交叉编译工具链的版本信息以验证交叉编译工具链安装正常。
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config
$ ${CROSS_COMPILE}gcc –v
执行命令后会出现类似如下的信息:
MY-SAMA5 Linux-3.18 build 3.3.0.7.png
以及在最后一行会出现 gcc 版本相关的信息
gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)

AT91Bootstrap编译


准备源码

1)下载源码
文件名:at91bootstrap-3.7.2.tar.bz2
AT91Bootstrap 是二级引导装载程序,为Atmel AT91 SoC提供了一套算法来管理硬件初始化。如时钟速度配置,PIO设置,内存初始化,从指定的引导介质下载主应用程序到主内存并启动。
2)创建工作目录
$ mkdir ~/my-sama5/02_source -p
MY-SAMA5 Linux-3.18 build 4.1.0.1.png
3)将源码复制到工作目录
这一步自己采取合适的方式将AT91Bootstrap源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。
4)解压源码

  • 进入工作目录

$ cd ~/my-sama5/02_source/
MY-SAMA5 Linux-3.18 build 4.1.0.2.png

  • 执行解压命令

$ tar jxf at91bootstrap-3.7.2.tar.bz2
MY-SAMA5 Linux-3.18 build 4.1.0.3.png

编译

1)进入源码目录
$ cd ~/my-sama5/02_source/at91bootstrap-3.7.2/
MY-SAMA5 Linux-3.18 build 4.2.0.1.png
2)使编译配置文件生效
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config
3)清除代码中可能存在的临时文件
$ make mrproper
MY-SAMA5 Linux-3.18 build 4.2.0.3.png
4)生成配置文件
$ make mysama5ek200_defconfig
MY-SAMA5 Linux-3.18 build 4.2.0.4.png
5)执行编译
$ make –j4
MY-SAMA5 Linux-3.18 build 4.2.0.5.png
6)编译完成
MY-SAMA5 Linux-3.18 build 4.2.0.6.png

目标文件

1)目标文件
编译完成后会在源码的binaries目录下产生我们需要的目标文件。
通过ls命令可以看到,其中mysama5ek200-dataflashboot-uboot-3.7.2.bin 即是我们需要的文件。
$ ls binaries/
MY-SAMA5 Linux-3.18 build 4.3.0.1.png
2)重命令目标文件
我们在烧录的时候需要使用到这些目标文件。为了烧录的方便,我们需要将目标文件修改为我们需要的文件名,即bootstrap-mysama5ek200.*。
$ cd binaries/
$ rename 's/mysama5ek200-dataflashboot-uboot-3.7.2/bootstrap-mysama5ek200/' *
$ ls -1
MY-SAMA5 Linux-3.18 build 4.3.0.2.png
3)保存目标文件
将bootstrap-mysama5ek200.* 保存。

u-boot编译


准备源码

1)下载源码
文件名:u-boot-at91-linux4sam_4.7.tar.bz2
U-Boot在Atmel AT91 SoC上作为第三阶段引导加载程序。它负责配置主要接口,并引导Linux系统。
2)将源码复制到工作目录
这一步自己采取合适的方式将u-boot源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。
3)解压源码

  • 进入工作目录

$ cd ~/my-sama5/02_source/
MY-SAMA5 Linux-3.18 build 5.1.0.1.png

  • 执行解压命令

$ tar jxf u-boot-at91-linux4sam_4.7.tar.bz2
MY-SAMA5 Linux-3.18 build 5.1.0.2.png

编译

1)进入u-boot源码目录
$ cd ~/my-sama5/02_source/u-boot-at91-linux4sam_4.7/
MY-SAMA5 Linux-3.18 build 5.2.0.1.png
2)使编译配置文件生效
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config
3)清除代码中可能存在的临时文件
$ make distclean
MY-SAMA5 Linux-3.18 build 5.2.0.3.png
4)生成配置文件
$ make mysama5ek200_defconfig
MY-SAMA5 Linux-3.18 build 5.2.0.4.png
5)执行编译
$ make –j4
MY-SAMA5 Linux-3.18 build 5.2.0.5.png
6)编译完成
MY-SAMA5 Linux-3.18 build 5.2.0.6.png

目标文件

编译完成后会在源码的目录下产生我们需要的目标文件。
通过ls命令可以看到。其中u-boot.bin 即是我们需要的文件。
$ ls u-boot* -1
MY-SAMA5 Linux-3.18 build 5.3.0.1.png
2)重命令目标文件
我们在烧录的时候需要使用到这些目标文件。为了烧录的方便,我们需要将目标文件修改为我们需要的文件名,即uboot-mysama5ek200.bin。
$ mv u-boot.bin uboot-mysama5ek200.bin
$ ls uboot-mysama5ek200.bin
MY-SAMA5 Linux-3.18 build 5.3.0.2.png
3)保存目标文件
将uboot-mysama5ek200.bin 保存。

内核编译


准备源码

1)下载源码
文件名:linux-at91-linux4sam_4.7.tar.bz2
2)将源码复制到工作目录
这一步自己采取合适的方式将内核源码复制到“~/my-sama5/02_source”。也可以参照“2.3 常用功能演示”。
3)解压源码

  • 进入工作目录

$ cd ~/my-sama5/02_source/
MY-SAMA5 Linux-3.18 build 6.1.0.1.png

  • 执行解压命令

$ tar jxf linux-at91-linux4sam_4.7.tar.bz2
MY-SAMA5 Linux-3.18 build 6.1.0.2.png

编译

1)进入内核源码目录
$ cd ~/my-sama5/02_source/linux-at91-linux4sam_4.7/
MY-SAMA5 Linux-3.18 build 6.2.0.1.png
2)使编译配置文件生效
$ source ~/my-sama5/03_tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.config
3)清除代码中可能存在的临时文件
$ make distclean
MY-SAMA5 Linux-3.18 build 6.2.0.3.png

编译内核文件

1)生成内核配置文件
$ make ARCH=arm mysama5ek200_defconfig
MY-SAMA5 Linux-3.18 build 6.2.1.1.png
2)执行内核文件编译命令
$ make -j4 ARCH=arm zImage
MY-SAMA5 Linux-3.18 build 6.2.1.2.png
3)内核文件编译完成
MY-SAMA5 Linux-3.18 build 6.2.1.3.png
4)内核目标文件
$ ls arch/arm/boot/zImage
MY-SAMA5 Linux-3.18 build 6.2.1.4.png

编译设备树文件

1)执行设备树文件编译命令
$ make ARCH=arm mysama5ek200-d36.dtb
MY-SAMA5 Linux-3.18 build 6.2.2.1.png
2)设备树目标文件
$ ls arch/arm/boot/dts/mysama5ek200-d36.dtb
MY-SAMA5 Linux-3.18 build 6.2.2.2.png

编译内核模块

1)执行内核模块编译命令
$ make ARCH=arm modules
MY-SAMA5 Linux-3.18 build 6.2.3.1.png
2)内核模块编译完成
MY-SAMA5 Linux-3.18 build 6.2.3.2.png
3)安装内核模块到指定目录
$ make ARCH=arm modules_install INSTALL_MOD_PATH=./modules
MY-SAMA5 Linux-3.18 build 6.2.3.3.png
4)打包内核模块
$ tar cjf modules_mysama5ek200.tar.bz2 modules/*
MY-SAMA5 Linux-3.18 build 6.2.3.4.png
5)模块包
$ ls modules_mysama5ek200.tar.bz2
MY-SAMA5 Linux-3.18 build 6.2.3.5.png

文件系统编译


注意及说明

a) 原始编译的过程中的下载量大约4G。(提示:可以使用我们下载好的一些文件,以减少下载量,节约时间,在7.4中会说到)。
b) 编译主机的网络连接最好使用能访问www.fackbook.com 的网络,不然可能会受到境内防火墙的限制而无法下载编译需要的软件包。
c) 初次编译需要的时间根据网络状态及编译主机的配置需要2小时到无限时间(经粗略统计除去下载时间,在16核CPU、16G内存的主机上编译QT5系统用了大约100分钟。)
客户请根据实际情况决定是否自行编译文件系统或使用我们提供的文件系统。

编译前的准备

准备Yocto编译环境

说明,Yocto编译依赖一些软件包,所以需要在开发主机上进行安装。
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat
MY-SAMA5 Linux-3.18 build 7.2.1.1.png
$ sudo apt-get install libsdl1.2-dev xterm sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
MY-SAMA5 Linux-3.18 build 7.2.1.2.png
$ sudo apt-get install uboot-mkimage
MY-SAMA5 Linux-3.18 build 7.2.1.3.png

准备源码

1)下载源码
源码包文件名:atmel_fido.tar.bz2
2)创建yocto工作目录
MY-SAMA5 Linux-3.18 build 7.2.2.1.png
3)将源码复制到开发主机
这一步自己采取合适的方式将源码复制到yocto工作目录(即:/home/myzr/yocto)。也可以参照“2.3 常用功能演示”。
4)解压源码包

  • 进入用户主目录

$ cd ~/yocto
MY-SAMA5 Linux-3.18 build 7.2.2.2.png

  • 执行解压命令

$ tar jxf atmel_fido.tar.bz2
MY-SAMA5 Linux-3.18 build 7.2.2.3.png

准备软件包

1)创建“/opt/yocto”目录用于存放软件包
$ sudo mkdir /opt/yocto
MY-SAMA5 Linux-3.18 build 7.2.3.1.png
$ sudo chmod 777 /opt/yocto
MY-SAMA5 Linux-3.18 build 7.2.3.2.png
2)下载软件包
在网盘中下载yocto的软件包。
软件包相对路径:yocto/downloads,将downloads下载到Windows。
3)将软件包复制到开发主机
将下载好的“downloads”目录复制到开发主机的“/opt/yocto”。

编译文件系统

编译前的配置

1)准备编译配置文件
文件目录:conf。下载conf目录到Windows。
2)进入poky目录
$ cd ~/yocto/atmel_fido/poky/
MY-SAMA5 Linux-3.18 build 7.3.1.1.png
$ source oe-init-build-env build-atmel
MY-SAMA5 Linux-3.18 build 7.3.1.2.png
3)初始化编译目录
$ source oe-init-build-env build-atmel
4)复制编译配置文件到编译目录
将 conf 目录复制到 /home/myzr/yocto/poky/build-atmel 。

编译QT5文件系统

$ bitbake atmel-qt5-demo-image
MY-SAMA5 Linux-3.18 build 7.3.2.1.png
提示:整个编译过程除去下载时间,在16核CPU、16G内存的主机上需要1小时左右。

  • 目标文件

在./tmp/deploy/images/sama5d3xek/目录下可以找到我们编译生成的目标文件。

编译QT5交叉编译工具

$ bitbake meta-toolchain-qt5
MY-SAMA5 Linux-3.18 build 7.3.3.1.png

  • 目标文件

在./tmp/deploy/images/sama5d3xek/目录下可以找到我们编译生成的目标文件。

</div>