前言

前面几篇文章讲解了,搭建海思的交叉编译环境的方法,选择docker或者,选择ubuntu下自己编译都行,DOPI的EV200开发板,板载的是SPI nand Flash:W25N01GV。在编译uboot时,需要选择nand
在这里插入图片描述

U-Boot编译

获取源码
cd /usr/dopi/
Github:  git clone https://github.com/cijliu/uboot.git

Gitee :  git clone https://gitee.com/cijliu/uboot.git
编译

把uboot的拥有者修改为当前用户dopi,进入uboot,执行

 sudo chown -R dopi *
 cd uboot
./build.sh nand

build.sh内容:

root@f8636ba553cb:/usr/dopi/uboot# cat build.sh 
if [ $1 == "nand" ] 
then
echo "#define DOPI_SPI_NAND ">include/configs/dopi.h
make ARCH=arm CROSS_COMPILE=arm-himix100-linux-  hi3516ev200_config
echo "DOPI_SPI_NAND=y">>./.config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- 
cp reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- u-boot-z.bin
    echo " build spi nand flash version"
else
	echo "build spi nor flash version"
echo "#define DOPI_SPI_NOR ">include/configs/dopi.h
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- hi3516ev200_config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- 
cp reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- u-boot-z.bin
fi

这里直接执行编译脚本,由于使用的是nand flash:W25N01GV, 所以需要传入参数nand。

编译完成,会生成最终固件 u-boot-hi3516ev200.bin

内核编译

获取源码
Github: git clone https://github.com/cijliu/linux.git

Gitee: git clone https://gitee.com/cijliu/linux.git
编译

把linux的拥有者修改为当前用户dopi,进入linux,执行

 sudo chown -R dopi *
 cd linux
./build.sh

build.sh脚本内容

cp arch/arm/configs/hi3516ev200_full_defconfig  .config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- uImage

这里直接执行编译脚本,具体指令可查看编译脚本内容。

编译完成,在arch/arm/boot目录下会生成最终固件 uImage

文件系统

获取源码
Github: git clone https://github.com/cijliu/rootfs.git

Gitee: git clone https://gitee.com/cijliu/rootfs.git
编译

把rootfs的拥有者修改为当前用户dopi,进入rootfs,执行

sudo chown -R dopi *
cd rootfs
./nand-128M.sh

/nand-128M.sh脚本内容

./mkyaffs2image100 ./rootfs_uclibc yaffs2-dopi-128M-v0.1.img 1 2

编译完成,会生成 yaffs2-dopi-128M-v0.1.img

编辑HiTool的分区表文件:Xml文件

在设计自己的产品时,参考DOPI提供的xml模板,可根据自己的Flash的大小,类型进行修改。

<?xml version="1.0" encoding="GB2312" ?>
<Partition_Info ProgrammerFile="">
<Part Sel="1" PartitionName="fastboot" FlashType="nand" FileSystem="none" Start="0" Length="512K" SelectFile="D:\work\images\dopi\release-v0.99\u-boot-hi3516ev200.bin"/>
<Part Sel="1" PartitionName="kernel" FlashType="nand" FileSystem="none" Start="512K" Length="5M" SelectFile="D:\work\images\dopi\release-v0.99\uImage"/>
<Part Sel="1" PartitionName="rootfs" FlashType="nand" FileSystem="yaffs" Start="5632K" Length="125440K" SelectFile="D:\work\images\dopi\release-v0.99\yaffs2-dopi-128M-v0.99.img"/>
</Partition_Info>

烧录

烧录方法可参考博文:

海思烧录工具Hitool使用方法

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐