目录
注意
1.Hi3521D_V100&Hi3520D_V400共用SDK
2.海思SDK版本中代号C01是uclibc库,C02是glibc库
U-Boot 打印信息:
System startup
U-Boot 2010.06 (Nov 30 2020 - 13:48:56)
Check Flash Memory Controller v100 ... Found
SPI Nand(cs 0) ID: 0xef 0xaa 0x21 Name:"W25N01GV"
Block:128KB Page:2KB Chip:128MB*1 OOB:64B ECC:4bit/512
ECC provided by Flash Memory Controller
SPI Nand total size: 128MB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
NAND read: device 0 offset 0x100000, size 0x400000
4194304 bytes read: OK
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.18.20
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3198744 Bytes = 3.1 MiB
Load Address: 80008000
Entry Point: 80008000
Loading Kernel Image ... OK
OK
Starting kernel ...
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpu
Linux version 3.18.20 (lwx@lwx-VirtualBox) (gcc version 4.9.4 20150629 (prerelease) (Hisilicon_v500_20180120) ) #1 SMP Sat May 9 11:26:35 CST 2020
CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Hisilicon HI3520DV400 DEMO Board
Memory policy: Data cache writealloc
PERCPU: Embedded 9 pages/cpu @c7edc000 s5696 r8192 d22976 u36864
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: mem=128M console=ttyAMA0,115200 root=/dev/mtdblock2 rw rootfstype=yaffs2 mtdparts=hinand:1M(boot),4M(kernel),-(rootfs)
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
uboot编译
1.配置编译环境
进入uboot目录 Hi3521DV100_SDK_V1.0.4.0/osdrv/opensource/uboot/u-boot-2010.06
make ARCH=arm CROSS_COMPILE=arm-hisiv500-linux- hi3520dv400_config
2.编译uboot,生成u-boot.bin文件
make ARCH=arm CROSS_COMPILE=arm-hisiv500-linux-
3.生成最终使用的 U-boot 镜像
将生成的 u-boot.bin 复制到 osdrv/tools/pc/uboot_tools/ 目录
进入osdrv/tools/pc/uboot_tools/ 目录
./mkboot-hi3520dv400.sh reg_info_hi3520dv400.bin u-boot-hi3520dv400.bin
其中 u-boot-hi3520dv400.bin 就是能够在单板上运行的 U-boot 镜像
烧写 U-boot
1.烧写
直接用HiTool烧写,也可以使用tftp方式烧写,前提是板端烧写过uboot
2.uboot环境变量配置
上电进入超级终端,依次执行以下代码即可
setenv bootargs 'mem=128M console=ttyAMA0,115200 root=/dev/mtdblock2 rw rootfstype=yaffs2 mtdparts=hinand:1M(boot),4M(kernel),-(rootfs)';
setenv bootcmd 'nand read 0x82000000 0x100000 0x400000;bootm 0x82000000'
sa
通过修改uboot代码来配置环境变量
修改 Hi3521DV100_SDK_V1.0.4.0/osdrv/opensource/uboot/u-boot-2010.06/include/configs/hi3520dv400.h
可以搜索"Environment"关键字定位代码位置
/*-----------------------------------------------------------------------
* Environment Configuration
*-----------------------------------------------------------------------*/
#define CONFIG_BOOTCOMMAND "nand read 0x82000000 0x100000 0x400000;bootm 0x82000000"
#define CONFIG_BOOTDELAY 1
#define CONFIG_BOOTARGS "mem=128M console=ttyAMA0,115200 root=/dev/mtdblock2 rw rootfstype=yaffs2 mtdparts=hinand:1M(boot),4M(kernel),-(rootfs)"
#define CONFIG_NETMASK 255.255.255.0 /* talk on MY local net */
#define CONFIG_IPADDR 192.168.0.10 /* static IP I currently own */
#define CONFIG_SERVERIP 192.168.0.250 /* current IP of tftp server ip */
#define CONFIG_ETHADDR 00:00:23:34:45:66
#define CONFIG_BOOTFILE "uImage" /* file to load */
#define CONFIG_BAUDRATE 115200
#define CONFIG_USE_MDIO "0"
重新uboot编译即可。