前言

海思提供的EV200和EV300同一个SDK,编译方法也类似。如果您第一次玩EV300 ,请您重点参考阅读:
“海思官方SDK Hi3516EV200_SDK_V1.0.1.0的编译教程”

linux sdk 版本为 Hi3516EV200R001C01SPC010:
链接: https://pan.baidu.com/s/1bJRVcm9DLD4RIL4zCzWMXA
提取码:702k
liteos sdk 版本为Hi3516EV200R002C05SPC010:
链接: https://pan.baidu.com/s/1LnN-E6ekdS1iryi3x89hNw
提取码:prkb

编译准备:

这里DOPI认为您熟悉海思SDK的编译过程,简洁介绍:

1. :linux-4.9.37.tar.gz (https://www.kernel.org/pub/)
    将下载的 linux-4.9.37.tar.gz 存放到 osdrv的opensource/kernel目录中

2. :yaffs2utils-0.2.9.tar.gz (https://github.com/dorigom/yaffs2utils/releases)
    将下载的 yaffs2utils-0.2.9.tar.gz 存放到osdrv的tools/pc/mkyaffs2image/目录中

3. :gdb-7.9.1.tar.gz  (http://ftp.gnu.org/gnu/gdb/)
    将下载的 gdb-7.9.1.tar.gz 存放到 osdrv的tools/board/gdb/目录中

4. :ncurses-6.0.tar.gz  ( http://ftp.gnu.org/gnu/ncurses/)
    将下载的 ncurses-6.0.tar.gz 存放到 osdrv的tools/board/gdb/目录中

5. :util-linux-2.31.tar.gz (https://www.kernel.org/pub/linux/utils/util-linux/v2.31)

    将下载的 util-linux-2.31.tar.gz 存放到 osdrv的tools/pc/cramfs_tool/目录中

编译方法:

编译有2个方法,一个是传递参数,一个是修改Makefile。进入目录/package/osdr下

  1. 传递参数:
    make  BOOT_MEDIA=spi  CHIP=hi3516ev300 all

2.修改Makefile:板载是W25Q128的spi nor flash。主控是Hi3516EV300.

编译结果:

编译的文件,最后会放在pub目录下的hi3516ev300_spi_image_uclibc文件夹下。

$ tree hi3516ev300_spi_image_uclibc
hi3516ev300_spi_image_uclibc
├── rootfs_hi3516ev300_128k.jffs2
├── rootfs_hi3516ev300_256k.jffs2
├── rootfs_hi3516ev300_2k_128k_32M.ubifs
├── rootfs_hi3516ev300_2k_24bit.yaffs2
├── rootfs_hi3516ev300_2k_4bit.yaffs2
├── rootfs_hi3516ev300_4k_24bit.yaffs2
├── rootfs_hi3516ev300_4k_256k_50M.ubifs
├── rootfs_hi3516ev300_4k_4bit.yaffs2
├── rootfs_hi3516ev300_64k.jffs2
├── u-boot-hi3516ev300.bin
└── uImage_hi3516ev300

如果选择了eMMC启动,那么编译命令为make BOOT_MEDIA=emmc CHIP=hi3516ev300 all
则编译的结果会在pub目录下的hi3516ev300_emmc_image_uclibc:

$  tree hi3516ev300_emmc_image_uclibc/
hi3516ev300_emmc_image_uclibc/
├── rootfs_hi3516ev300_96M.ext4
├── u-boot-hi3516ev300.bin
└── uImage_hi3516ev300

烧录

板载是SPI nor Flash W25Q128,所以拷贝以下文件:

├── rootfs_hi3516ev300_64k.jffs2
├── u-boot-hi3516ev300.bin
└── uImage_hi3516ev300

打开Hitool依次序添加三个文件,顺便手动填写文件长度,然后烧录:

启动后,会提示uboot的bootcmd有问题,停留在uboot。有2个方法:

方法一:用命令修改

执行以下命令,修改bootargs和bootcmd

setenv  bootargs 'mem=40M console=tty0 console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 rw mtdparts=hi_sfc:1024K(boot),5120K(kernel),10240K(rootfs)'
setenv bootcmd  'sf probe 0;sf read 0x42000000 0x100000 0x500000;bootm 0x42000000'
saveenv

方法二:修改源文件

修改 uboot/include/configs/hi3516ev300.h里的宏定义CONFIG_BOOTARGS和CONFIG_BOOTCOMMAND,
然后make all重新编译后把文件烧录到芯片内,不用修改uboot中的bootargs和bootcmd:


重启您的开发板,uboot会引导内核启动:

usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on 10010000.sdhci [10010000.sdhci] using ADMA in legacy mode
mmc1: SDHCI controller on 10020000.sdhci [10020000.sdhci] using ADMA in legacy mode
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
Key type dns_resolver registered
hibvt_rtc 120e0000.rtc: setting system clock to 1970-01-01 00:00:03 UTC (3)
VFS: Mounted root (jffs2 filesystem) on device 31:2.
devtmpfs: mounted
Freeing unused kernel memory: 176K (c0604000 - c0630000)
This architecture does not have kernel memory protection.
random: init: uninitialized urandom read (4 bytes read)

            _ _ _ _ _ _ _ _ _ _ _ _
            \  _  _   _  _ _ ___
            / /__/ \ |_/
           / __   /  -  _ ___
          / /  / /  / /
  _ _ _ _/ /  /  \_/  \_ ______
___________\___\__________________

[RCS]: /etc/init.d/S00devs
mknod: /dev/console: File exists
mknod: /dev/ttyAMA0: File exists
mknod: /dev/null: File exists
[RCS]: /etc/init.d/S01udev
udevd[617]: starting eudev-3.2.7
[RCS]: /etc/init.d/S80network
Auto login as root ...
Jan  1 00:00:04 login[865]: root login on 'ttyS000'
Welcome to HiLinux.
None of nfsroot found in cmdline.
~ # 
文档更新时间: 2020-07-28 07:51   作者:Tony