1799|0

253

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

MYZR-(瑞芯微) RK32 Cortex™-A17 编译手册 [复制链接]

 准备源码(prepare source code)准备源码包 (prepare source code package)
1)创建工作目录
create working directory
创建 ~/my-rk3288 作为工作目录
create ~/my-rk3288 as working directory
$ mkdir ~/my-rk3288

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

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

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

2)解压交叉编译工具
decompress cross compiler tool
$ cd ~/my-rk3288/03_tools/
$ tar jxf gcc-arm-eabi-4.6.tar.bz2


开发环境配置(development environment configuration)安装需要的包 (install package needed)
1)更新源列表
list of updated source
$ sudo apt-get update

更新完成后如下图所示:
after update,it will look like below:

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

  • 使用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。

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。

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。


编译u-boot(compile u-boot)
进入u-boot源码目录(enter u-boot source code directory)
$ cd ~/my-rk3288/02_source/rk32-myzr_uboot_2014.10/


使配置文件生效(validate configured file)
  • 执行source命令
execute source command
$ source ~/my-rk3288/03_tools/gcc-arm-eabi-4.6-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-RK3288-EK314RK3288(四核)- 2G       
(RK3288(quad. core)- 2G)
rk3288_defconfig
  • MY-RK3288-EK314-2G配置示例:
MY-RK3288-EK314-2G configuration example:
$ make rk3288_defconfig


编译(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命令即可看到编译得到的目标文件RK3288UbootLoader_V2.30.10.bin
you can get the compiled file u-boot.bin with ls command after compilation
$ ls


编译内核(compile kernel)
进入内核源码目录(enter kernel source directory)
$ cd ~/my-rk3288/02_source/rk32-myzr_kernel_3.10/


使配置文件生效(validate configured file)
  • 执行source命令
execute source command
$ source ~/my-rk3288/03_tools/gcc-arm-eabi-4.6-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-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


编译内核zImage和设备树dtb(compile kernel)
评估板主型号
(evaluation board main model)
显示屏类型
(lcd type)
对应的设备树配置
(corresponding device tree configuration)
MY-RK3288-EK314LVDS(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。

  • 编译完成
complete compilation

  • 目标文件
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


编译模块(compile module)
  • 编译
compile
$ make modules
说明:截图中使用了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-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

2) 解压和编译rockchip-mkbootimg
unpack and compile rockchip-mkbootimg
$ tar jxf rockchip-mkbootimg.tar.bz2
$ cd rockchip-mkbootimg/
$ make && sudo make install


打包initrd.img(pack initrd.img)
1) 压缩为img格式
compresse to img format
$ cd ~/my-rk3288/01_application/
$ tar jxf initrd.tar.bz2
$ make -C initrd/

2) 显示结果
show results

打包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


文件系统(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/


新建文件夹和复制镜像(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:

$ 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/


打包relase_update.img文件(pack relase_update.img)
$ cd Image/
$ afptool -pack . ../update.img
$ cd ..
$ img_maker -rk32 RKLoader.bin update.img relase_update.img

点赞 关注
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表