• 分区大小一般自己留有余量,分区大小,自己定,比实际镜像大小大一些就可以。
  • 分区大小改了,相应的参数也要发生变化:



  • fastboot:Hitool内部也是用fastboot来烧录,但是封装好了,可以不用去管他,通过分区表文件来计算出具体参数。

  • 启动并进入Uboot后的界面,注意要启动的那几秒按一下

    System startup
    Uncompress Ok!
    U-Boot 2016.11 (Oct 18 2021 - 15:05:04 +0800)hi3516dv300
    Relocation Offset is: 0f6d2000
    Relocating to 8fed2000, new gd at 8fe31ef0, sp at 8fe31ed0
    EMMC/MMC/SD controller initialization.
    scan edges:2 p2f:6 f2p:1
    mix set temp-phase 3
    scan elemnts: startp:12 endp:120
    Tuning SampleClock. mix set phase:[04/07] ele:[06/15]
    ** First descriptor is NOT a primary desc on 0:1 **
    MMC/SD Card:
        MID:         0x15
        Read Block:  512 Bytes
        Write Block: 512 Bytes
        Chip Size:   7456M Bytes (High Capacity)
        Name:        "8GTF4"
        Chip Type:   MMC
        Version:     0.0
        Speed:       100000000Hz
        Bus Width:   4bit
    himci: 0 (eMMC)
    In:    serial
    Out:   serial
    Err:   serial
    Net:   eth0
    Warning: eth0 (eth0) using random MAC address - ce:07:43:a5:2b:a5
    Writing to MMC(0)... done
    Hit any key to stop autoboot:  0
    hisilicon #
    hisilicon # printenv
    bootargs=mem=512M console=ttyAMA0,115200 root=/dev/mmcblk0p3 rootfstype=ext4 rw rootwait blkdevparts=mmcblk0:5M(boot),10M(kernel),500M(rootfs),200M(userdata),-(user)
    bootcmd=mmc read 0 0x81000000 0x2800 0x4000;bootm 0x81000000
    Environment size: 441/262140 bytes
    hisilicon #







bootcmd=mmc read 0 0x81000000 0x2800 0x4000;bootm 0x81000000

mmc read 0 表示读取的第0个mmc设备

0x81000000 这个表示DDR的地址

0x2800 这个表示eMMC的地址,这就是从eMMC的这个地址读取kernel到DDR中去

0x2800(hex mode)->10240(dec mode)
10240(dec mode) * 512(byte)= 5,242,880(byte)
5,242,880(byte) / 1024 = 5120(kb)
5120(kb) / 1024 = 5(M)

0x4000 这个表示读取多长

0x4000(hex mode)->16,384(dec mode)
16,384(dec mode) * 512(byte)= 8,388,608(byte)
8,388,608(byte) / 1024 = 8,192(kb)
8,192(kb) / 1024 = 8(M)


10 * 1024 * 1024 / 512 (dec mode) -> 50000(hex mode)


setenv bootcmd "mmc read 0 0x81000000 0x2800 0x5000; bootm 0x81000000"
  • 寻找破坏原有的uboot的命令:
    hisilicon # help
    ?       - alias for 'help'
    base    - print or set address offset
    bdinfo  - print Board Info structure
    boot    - boot default, i.e., run 'bootcmd'
    bootd   - boot default, i.e., run 'bootcmd'
    bootelf - Boot from an ELF image in memory
    bootm   - boot application image from memory
    bootp   - boot image via network using BOOTP/TFTP protocol
    bootvx  - Boot vxWorks from an ELF image
    cipher_test- CIPHER Encrypt And Decrypt Test
    cmp     - memory compare
    coninfo - print console devices and information
    cp      - memory copy
    crc32   - checksum calculation
    dcache  - enable or disable data cache
    ddr     - ddr training function
    decjpg  - jpgd   - decode jpeg picture.
    decjpg [format]
    dhcp    - boot image via network using DHCP/TFTP protocol
    dm      - Driver model low level access
    echo    - echo args to console
    editenv - edit environment variable
    env     - environment handling commands
    erase   - erase FLASH memory
    exit    - exit script
    false   - do nothing, unsuccessfully
    fatinfo - print information about filesystem
    fatload - load binary file from a dos filesystem
    fatls   - list files in a directory (default /)
    fatsize - determine a file's size
    flinfo  - print FLASH memory information
    getinfo - print hardware information
    go      - start application at address 'addr'
    go_cpu1 - Perform power on and unreset  CPU1_A7
    gzwrite - unzip and write memory to block device
    hash    - Calcluate hash
    hash_test- hash_test [x]:[0] SHA1; [1] SHA256; [2] HMAC-SHA1; [3] HMAC-SHA256;
    help    - print command description/usage
    icache  - enable or disable instruction cache
    iminfo  - print header information for application image
    imxtract- extract a part of a multi-image
    itest   - return true/false on integer compare
    klad_test- KLAD Test
    loadb   - load binary file over serial line (kermit mode)
    loads   - load S-Record file over serial line
    loadx   - load binary file over serial line (xmodem mode)
    loady   - load binary file over serial line (ymodem mode)
    loop    - infinite loop on address range
    md      - memory display
    mii     - MII utility commands
    mm      - memory modify (auto-incrementing address)
    mmc     - MMC sub system
    mmcinfo - display MMC info
    mw      - memory write (fill)
    nfs     - boot image via network using NFS protocol
    nm      - memory modify (constant address)
    part    - disk partition related commands
    ping    - send ICMP ECHO_REQUEST to network host
    printenv- print environment variables
    protect - enable or disable FLASH write protection
    pxe     - commands to get and boot from pxe files
    reset   - Perform RESET of the CPU
    rng_test- RNG Test
    rsa_enc_test- RSA PKCS1# V1_5 encrypt/decrypt Test
    rsa_sign_test- RSA PKCS1# V1_5 Sign Test
    run     - run commands in an environment variable
    saveenv - save environment variables to persistent storage
    setenv  - set environment variables
    setexpr - set environment variable as the result of eval expression
    setvobg - setvobg   - set vo backgroud color.
            - setvobg [dev color]
    showvar - print local hushshell variables
    sleep   - delay execution for some time
    source  - run script from memory
    startgx - startgx   - open graphics layer.
            - startgx [layer addr stride x y w h]
    startvl - startvl   - open video layer.
            - startvl [layer addr stride x y w h]
    startvo - startvo   - open vo device with a certain output interface.
            - startvo [dev intftype sync]
    stopgx  - stopgx   - close graphics layer.
            - stopgx [layer]
    stopvl  - stopvl   - close video layer.
            - stopvl [layer]
    stopvo  - stopvo   - close interface of vo device.
            - stopvo [dev]
    sysboot - command to get and boot from syslinux files
    test    - minimal test like /bin/sh
    tftpboot- boot image via network using TFTP protocol
    true    - do nothing, successfully
    unzip   - unzip a memory region
    usb     - USB sub-system
    usbboot - boot from USB device
    usbtftp - download or upload image using USB protocol
    version - print monitor, compiler and linker version
    hisilicon #
    接着输入help mmc
    help mmc
    mmc - MMC sub system
    mmc info - display info of the current MMC device
    mmc reg [dev] - display register of the current MMC device
    mmc read dev addr blk# cnt
    mmc write dev addr blk# cnt
    mmc erase blk# cnt
    mmc rescan
    mmc part - lists available partition on current mmc device
    mmc dev [dev] [part] - show or set current mmc device [partition]
    mmc list - lists available devices
    mmc hwpartition [args...] - does hardware partitioning
      arguments (sizes in 512-byte blocks):
        [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
        [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
        [check|set|complete] - mode, complete set partitioning completed
      WARNING: Partitioning is a write-once setting once it is set to complete.
      Power cycling is required to initialize partitions after set to complete.
    mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode
     - Set the BOOT_BUS_WIDTH field of the specified device
    mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>
     - Change sizes of boot and RPMB partitions of specified device
    mmc partconf dev boot_ack boot_partition partition_access
     - Change the bits of the PARTITION_CONFIG field of the specified device
    mmc rst-function dev value
     - Change the RST_n_FUNCTION field of the specified device
       WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.
    mmc setdsr <value> - set DSR register value
    hisilicon #
    mmc write dev addr blk# cnt
    mmc erase blk# cnt


300 * 1024 / 512 = 600 cnt


mmc erase 0 0x03E8



Author: Ruimin Huang
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Ruimin Huang !