MYZR-RK3288-EK314 L31079 编译手册

来自明远智睿的wiki
Admin讨论 | 贡献2018年6月11日 (一) 16:03的版本

跳转至: 导航搜索

目录

准备源码包(prepare source code pacakge)


3.10.79版本代码(3.10.79 version code)

u-boot源码(u-boot source code)

文件名:rk32-myzr_uboot_2014.10_201803028.tar.bz2
name of file:rk32-myzr_uboot_2014.10_201803028.tar.bz2


kernel源码(kernel source code)

文件名:rk32-myzr_kernel_3.10_201803028.tar.bz2
name of file:rk32-myzr_kernel_3.10_201803028.tar.bz2


交叉编译工具 (cross compifer tool)

文件名:gcc-arm-eabi-4.6.tar.bz2
name of file:gcc-arm-eabi-4.6.tar.bz2


配置编译环境(configuration of compifer environment)


准备源码(prepare source code)

准备源码包 (prepare source code package)

1)创建工作目录
create working directory
创建 ~/my-rk3288 作为工作目录
create ~/my-rk3288 as working directory

$ mkdir ~/my-rk3288
My-rk32-ek314build 2.1.1.1.jpg

创建 ~/my-rk3288/02_source 作为源码目录
create ~/my-rk3288/02_source as source code directory

$ mkdir ~/my-rk3288/02_source
My-rk32-ek314build 2.1.1.2.jpg

创建 ~/my-rk3288/03_tools 作为工具目录
create ~/my-rk3288/03_tools as tool directory

$ mkdir ~/my-rk3288/03_tools
My-rk32-ek314build 2.1.1.3.jpg

2)复制源码包到开发主机中
copy source code package to the development host
这一步骤自己采取相应的方式进行。
do it in this step in your own way。
  提示:这里将网盘中“02_源码”复制到Linux开发主机的“~/my-rk3288/02_source”,将网盘中“03_工具”复制到Linux开发主机的“~/my-rk3288/03_tools”,将网盘中“01_应用”复制到Linux开发主机的“~/my-rk3288/01_application”。
tip:this step is to copy “02_source code”from network disk to “~/my-rk3288/02_source”in development host, copy “03_tool”to “~/my-rk3288/03_tools, and copy “01_application”to “~/my-rk3288/01_application”。in development host


解压源码包 (decompress source code package)

1)解压u-boot源码和内核源码
decompress u-boot source code and kernel source code

$ cd ~/my-rk3288/02_source
$ tar jxf rk32-myzr_uboot_2014.10_201803028.tar.bz2
$ tar jxf rk32-myzr_kernel_3.10_201803028.tar.bz2
My-rk32-ek314build 2.1.2.1.jpg

2)解压交叉编译工具
decompress cross compiler tool

$ cd ~/my-rk3288/03_tools/
$ tar jxf gcc-arm-eabi-4.6.tar.bz2
My-rk32-ek314build 2.1.2.2.jpg


开发环境配置(development environment configuration)

安装需要的包 (install package needed)

1)更新源列表
list of updated source

$ sudo apt-get update
My-rk32-ek314build 2.2.1.1.jpg
更新完成后如下图所示:
after update,it will look like below:

My-rk32-ek314build 2.2.1.2.jpg

2)安装aptitude包管理工具和ia32-libs
install aptitude package management tool and ia32-libs
提示:如果编译主机的Linux是32位的,可以跳过此步骤。
tips:if Linux of compiler host is 32bit,you can skip this step。

  • 安装aptitude包管理工具

install aptitude package management tool
$ sudo apt-get –y install aptitude
My-rk32-ek314build 2.2.1.3.jpg

  • 使用aptitude安装ia32-libs

install ia32-libs with aptitude

$ sudo aptitude –y install ia32-libs
提示:下图为安装过aptitude和ia32-libs后,再次执行安装命令的截图。
tips:following is the screenshots with re-execution of installation command after installation of aptitude and ia32-libs is finished。
My-rk32-ek314build 2.2.1.4.jpg

3)安装mkimage工具
install mkimage tool

$ sudo apt-get -y install uboot-mkimage
提示:下图为安装过mkimage工具后,再次执行安装命令的截图。
tips:following is the screenshots with re-execution of installation command after installation of mkimage tool is finished。
My-rk32-ek314build 2.2.1.5.jpg

4)安装ncurses-dev
install ncurses-dev
说明:make menuconfig对其具有依赖性质。
instruction:make menuconfig is dependent on it。
$ sudo aptitude -y install ncurses-dev

提示:下图为安装过ncurses-dev工具后,再次执行安装命令的截图。
tips:following is the screenshots with re-execution of installation command after installation of ncurses-dev tool is finished。
My-rk32-ek314build 2.2.1.6.jpg


编译u-boot(compile u-boot)


进入u-boot源码目录(enter u-boot source code directory)

$ cd ~/my-rk3288/02_source/rk32-myzr_uboot_2014.10/
My-rk32-ek314build 3.1.1.jpg


使配置文件生效(validate configured file)

  • 执行source命令

execute source command

$ source ~/my-rk3288/03_tools/gcc-arm-eabi-4.6-env
My-rk32-ek314build 3.2.1.jpg

  • 查看编译配置

view compiler configuration

$ echo $ARCH
$ echo $CROSS_COMPILE

提示:可看到ARCH和CROSS_COMPILE被设置
tips:you can see that ARCH和CROSS_COMPILE is configured
My-rk32-ek314build 3.2.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:
My-rk32-ek314build 3.2.3.jpg


清除u-boot配置(remove u-boot configuration)

$ make distclean
My-rk32-ek314build 3.3.1.jpg


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-RK3288-EK314 RK3288(四核)- 2G
(RK3288(quad. core)- 2G)
rk3288_defconfig
  • MY-RK3288-EK314-2G配置示例:

MY-RK3288-EK314-2G configuration example:

$ make rk3288_defconfig
My-rk32-ek314build 3.4.1.jpg


编译(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。
My-rk32-ek314build 3.5.1.jpg

  • 编译完成

complete compilation
提示:u-boot编译过程大概需要十几秒钟的时间。
tips:u-boot compilation process will take a few minustes or so。
My-rk32-ek314build 3.5.2.jpg


目标文件(target file)

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

$ ls
My-rk32-ek314build 3.6.1.jpg


编译内核(compile kernel)


进入内核源码目录(enter kernel source directory)

$ cd ~/my-rk3288/02_source/rk32-myzr_kernel_3.10/
My-rk32-ek314build 4.1.1.jpg


使配置文件生效(validate configured file)

  • 执行source命令

execute source command

$ source ~/my-rk3288/03_tools/gcc-arm-eabi-4.6-env
My-rk32-ek314build 4.2.1.jpg

  • 查看编译配置

view compiler configuration

$ echo $ARCH
$ echo $CROSS_COMPILE

提示:可看到ARCH和CROSS_COMPILE被设置
tips:you can see that ARCH和CROSS_COMPILE is configured
My-rk32-ek314build 4.2.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:
My-rk32-ek314build 4.2.3.jpg


准备配置内核(prepare for kernel configuration)

  • 清除内核配置

remove kernel configuration

$ make distclean
My-rk32-ek314build 4.3.1.jpg

  • 生成.config文件

generated.config file

说明:MY-RK3288-EK314系列评估板使用的配置文件是rk3288-myzr-linux_defconfig
instructions:configuration files used for MY-RK3288-EK314 seires of evaluation board is rk3288-myzr-linux_defconfig
$ make rk3288-myzr-linux_defconfig
My-rk32-ek314build 4.3.2.jpg


编译内核zImage和设备树dtb(compile kernel)

评估板主型号
(evaluation board main model)
显示屏类型
(lcd type)
对应的设备树配置
(corresponding device tree configuration)
MY-RK3288-EK314 LVDS(1024X600) rk3288-myzr_rh568_lvds_linux.img
HDMI(1920X1080) rk3288-myzr_rh568_hdmi_linux.img
EDP(1920X1080) rk3288-myzr_rh568_edp_linux.img
  • 编译(以下是LVDS屏)

compile (for example:lvds lcd)
$ make -j8 rk3288-myzr_rh568_lvds_linux.img

说明:截图中使用了8线程编译。
instruction:8 threads compilation is used in the screenshots。
My-rk32-ek314build 4.4.1.jpg

  • 编译完成

complete compilation
My-rk32-ek314build 4.4.2.jpg

  • 目标文件

target file

arch/arm/boot/uImage即为编译得到的目标文件,使用ls命令可查看文件信息。
arch/arm/boot/zImage is the target file through compilation,you can view the file information with ls command。

$ ls arch/arm/boot/zImage -la
My-rk32-ek314build 4.4.3.jpg


编译模块(compile module)

  • 编译

compile

$ make modules
说明:截图中使用了4线程编译。
instruction:4 threads compilation is used in the screenshots。
My-rk32-ek314build 4.5.1.jpg

  • 编译完成

complete compilation
My-rk32-ek314build 4.5.2.jpg

  • 目标文件

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
My-rk32-ek314build 4.5.3.jpg


打包linux-boot.img(pack linux-boot.img)


编译rockchip-mkbootimg(compile rockchip-mkbootimg)

1) 创建应用程序目录
create application directory

$ mkdir ~/my-rk3288/01_application
$ cd ~/my-rk3288/01_application
My-rk32-ek314build 5.1.1.jpg

2) 解压和编译rockchip-mkbootimg
unpack and compile rockchip-mkbootimg

$ tar jxf rockchip-mkbootimg.tar.bz2
$ cd rockchip-mkbootimg/
$ make && sudo make install
My-rk32-ek314build 5.1.2.jpg


打包initrd.img(pack initrd.img)

1) 压缩为img格式
compresse to img format

$ cd ~/my-rk3288/01_application/
$ tar jxf initrd.tar.bz2
$ make -C initrd/
My-rk32-ek314build 5.2.1.jpg

2) 显示结果
show results
My-rk32-ek314build 5.2.2.jpg

打包linux-boot.img(pack linux-boot.img)

$ mkbootimg --kernel ../02_source/rk32-myzr_kernel_3.10/arch/arm/boot/zImage --ramdisk initrd.img --second ../02_source/rk32-myzr_kernel_3.10/resource.img -o linux-boot.img
My-rk32-ek314build 5.3.1.jpg


文件系统(file system)

文件系统包位于网盘对应的镜像文件夹中。支持的文件系统类型及下载方式可参照《MY-RK3288-EK314 烧录手册》。
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-RK3288-EK314 buring guide》。


打包批量文件relase_update.img(pack relase_update.img)


编译打包工具(compile packaging tools)

$ cd ~/my-rk3288/01_application
$ tar jxf rk2918_tools.tar.bz2
$ cd rk2918_tools/
$ make -j4
$ sudo cp afptool img_unpack img_maker mkkrnlimg /usr/local/bin/
My-rk32-ek314build 7.1.1.jpg


新建文件夹和复制镜像(new folder and copy image)

test/Image/的文件对应烧写工具Image\linux文件,rk3288box-3.10-uboot-ubuntu.parameter.txt重命名为parameter,RESERVED是空文件,RK3288UbootLoader_V2.30.10.bin对应RKLoader.bin,update-script和recover-script在烧写工具复制,package-file的内容重新按对应的文件重命名,如下:
The file of "test/Image/" corresponds to the file of "Image\linux", rk3288box-3.10-uboot-ubuntu.parameter.txt is renamed to parameter, RESERVED is the empty file, RK3288UbootLoader_V2.30.10.bin corresponds to RKLoader.bin, update-script and The recover-script is copied by the burning tool. The contents of the package-file are renamed according to the corresponding file, as follows:
My-rk32-ek314build 7.2.1.jpg

$ mkdir ~/my-rk3288/04_rootfs/
$ cd ~/my-rk3288/04_rootfs/
$ mkdir -p ubuntu/Image
$ cp test/Image/* ubuntu/Image/
$ cp ubuntu/Image/RKLoader.bin ubuntu/
$ cd ubuntu/
My-rk32-ek314build 7.2.2.jpg


打包relase_update.img文件(pack relase_update.img)

$ cd Image/
$ afptool -pack . ../update.img
$ cd ..
$ img_maker -rk32 RKLoader.bin update.img relase_update.img
My-rk32-ek314build 7.3.1.jpg