Hisi编译与烧写

环境

  • Platform: Hi3516DV100
  • Kernel: v3.4

内存DDR(256M)地址空间:

150M 106M
OS MMZ
0x80000000 0x84000000 0xA0000000
# Memory managed by OS. # Memory managed by MMZ block anonymous. # Memory managed by MMZ block jpeg.
  • 注意
  1. 启动参数,“setenv bootargs ‘mem=150M …”
  2. load3516d脚本

编译

具体细节可参考SDK里面的文档

  • u-boot:
1
2
3
4
make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- hi3516a_spinand_config (other: hi3516a_config)
~/dd/Hi3516A_SDK_V1.0.5.0/osdrv/opensource/uboot/u-boot-2010.06$ make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- FLASH_TYPE=spinand
~/dd/Hi3516A_SDK_V1.0.5.0/osdrv/opensource/uboot/u-boot-2010.06$ cp u-boot.bin ../../../tools/pc/uboot_tools/
~/dd/Hi3516A_SDK_V1.0.5.0/osdrv/tools/pc/uboot_tools$ ./mkboot.sh reg_info_hi3516d.bin u-boot-3516d.bin
  • kernel:

    1
    2
    3
    4
    5
    6
    #hi3516a_spinand_defconfig  (other: hi3516a_full_defconfig)
    cp arch/arm/configs/hi3516a_full_defconfig .config
    make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- menuconfig
    make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- uImage
    #modules:
    make ARCH=arm CROSS_COMPILE=arm-hisiv300-linux- modules
  • fs:

    1
    2
    3
    4
    5
    #osdrv/pub/bin/pc/mkfs.jffs2 -d osdrv/pub/rootfs_glibc -l -e 0x10000 -o osdrv/pub/rootfs_glibc_64k.jffs2
    spinand: mkyaffs2image400 other:mkyaffs2image610
    osdrv/pub/bin/pc/mkyaffs2image400 osdrv/pub/rootfs_uclibc osdrv/pub/rootfs_uclibc_2k_4bit.yaffs2 1 2
    osdrv/pub/bin/pc/mkimage -A arm -T firmware -C none -n hiboot -d u-boot-ok.bin u-boot
    osdrv/pub/bin/pc/mkimage -A arm -T filesystem -C none -n hirootfs -d rootfs_256k.jffs2 rootfs

烧写及启动

SPI-NAND(128M)

  • 地址空间:

    | 1M | 3M | 60M | 60M |
    | :–: | :–: | :–: | :–: |
    | boot | kernel | rootfs | rootfs_bk |

  • 烧写u-boot

    1
    2
    3
    4
    5
    mw.b 82000000 ff 100000
    tftp 82000000 u-boot-3516d-spinand.bin
    nand erase 0 100000
    nand write 82000000 0 100000
    reset
  • 烧写内核

    1
    2
    3
    4
    mw.b 82000000 ff 300000
    tftp 82000000 ncs3096_kernel
    nand erase 100000 300000
    nand write 82000000 100000 300000
  • 烧写文件系统

    1
    2
    3
    4
    mw.b 82000000 ff 1E00000
    tftp 82000000 rootfs_uclibc_2k_4bit.yaffs2
    nand erase 400000 3C00000
    nand write.yaffs 82000000 400000 3369540

注意:3369540为rootfs文件实际大小(16进制)

  • 启动

    1
    2
    3
    4
    5
    6
    7
    #ubifs
    setenv bootargs 'mem=150M console=ttyAMA0,115200 ubi.mtd=3 root=ubi0:ubifs rootfstype=ubifs rw mtdparts=hinand:1M(boot),3M(kernel),60M(yaffs2),60M(ubi),-(reserve)'

    #yaffs
    setenv bootargs 'mem=150M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=yaffs2 mtdparts=hinand:1M(boot),3M(kernel),60M(rootfs),60M(rootfs_bk),-(reserve)'
    setenv bootcmd 'nand read 0x82000000 0x100000 0x300000;bootm 0x82000000'
    sa
  • UBI-FS:

    1
    2
    3
    4
    5
    6
    7
    8
    mw.b 82000000 ff 2000000
    nand erase 0x400000 0xF00000
    #nand erase 0x400000 0x2000000
    tftp 0x82000000 rootfs_hi3516a_2k_128k_32M.img
    nand write 0x82000000 0x400000 0xF00000

    setenv bootargs 'mem=64M console=ttyAMA0,115200 ubi.mtd=2 root=ubi0:ubifs rootfstype=ubifs rw mtdparts=hinand:1M(boot),3M(kernel),32M(rootfs),28M(test),-(reserve)'
    setenv bootcmd 'nand read 0x82000000 0x100000 0x300000;bootm 0x82000000'

SPI-Nor(32M)

  • 地址空间:

    | 1M | 3M | 28M |
    | :–: | :–: | :–: |
    | boot | kernel | rootfs |

  • 烧写内核

    1
    2
    3
    4
    5
    mw.b 82000000 ff 300000
    tftp 82000000 uImage
    sf probe 0
    sf erase 100000 300000
    sf write 82000000 100000 300000
  • 烧写文件系统

    1
    2
    3
    4
    5
    mw.b 82000000 ff 1C00000
    tftp 0x82000000 rootfs_hi3516a_64k.jffs2 #rootfs_glibc_64k.jffs2
    sf probe 0
    sf erase 400000 1C00000
    sf write 82000000 400000 1C00000
  • 启动

    1
    2
    3
    4
    #jffs
    setenv bootargs 'mem=64M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),3M(kernel),28M(rootfs)'
    setenv bootcmd 'sf probe 0;sf read 0x82000000 0x100000 0x300000;bootm 0x82000000'
    sa

调试模式

  • tftp-NFS:

    1
    2
    3
    4
    5
    6
    setenv image_file 'ncs3096_kernel'
    setenv loadaddr 0x82000000

    setenv bootargs 'noinitrd init=/linuxrc console=ttyAMA0,115200 mem=64M root=/dev/nfs rw nfsroot=192.168.1.44:/home/xxx/rootfs_nfs,v3 ip=192.168.1.234:192.168.1.44:192.168.1.2:255.255.255.0:hisi:eth0:off'

    setenv bootcmd 'tftp ${loadaddr} ${image_file}; bootm ${loadaddr};'
  • 手动配置网络及挂载NFS

    1
    2
    3
    4
    5
    6
    7
    8
    ifconfig eth0 hw ether 12:23:34:55:44:22
    ifconfig eth0 192.168.1.234 netmask 255.255.255.0
    route add default gw 192.168.1.1

    mount -t nfs -o nolock -o tcp -o rsize=32768,wsize=32768 192.168.1.44:/home/xxx/rootfs_nfs /mnt
    cd /mmp/ko
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/libs
    ./load3516d -a -sensor ov4689 -osmem 150 -offline
Donate comment here