有了BOOT.BIN(fsbl+pmu+atl+uboot)、uImage、uramdisk.image.gz,dtb文件,就可以启动了。把上述文件统统拷贝到SD卡,并设置开发板为SD卡启动。
0. U-BOOT启动参数
设置启动参数,然后启动
fatload mmc 0 0x1000000 uImage;fatload mmc 0 0x2000000 uramdisk.image.gz;fatload mmc 0 0x4000000 zynqmp-sf-zcu102.dtb;
setenv bootargs root=/dev/ram0
bootm 0x1000000 0x2000000 0x4000000
将上述参数固化到flash里,免得每次都要输入
修改env
setenv sf_sdboot "fatload mmc 0 0x1000000 uImage;fatload mmc 0 0x2000000 uramdisk.image.gz;fatload mmc 0 0x4000000 zynqmp-sf-zcu102.dtb;bootm 0x1000000 0x2000000 0x4000000"
setenv bootargs root=/dev/ram0
保存env
ZynqMP> saveenv
Saving Environment to SPI Flash...
SF: Detected n25q512a with page size 512 Bytes, erase size 128 KiB, total 128 MiB
Erasing SPI flash...Writing to SPI flash...done
出现若干错误,错误及处理如下:
- Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
制作ramdisk.image时,要指定该image的大小(对应gz解压并mount以后的空间大小),linux kernel的配置里,也要配置这个大小,两个要能对上。这个尺寸是ramdisk展开(解压)以后的大小。
make menuconfig O=./output/
Device Drivers-->Block devices-->选择 RAM block device support 项,配置大小
- VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
从打印信息[ 0.000000] Kernel command line: earlycon看,没有配置启动参数,在u-boot启动内核之前,在bootargs中增加root=/dev/ram0后解决问题。
-
ZynqMP> printenv bootargs
-
## Error: "bootargs" not defined
-
ZynqMP> setenv bootargs root=/dev/ram0
-
ZynqMP> printenv bootargs
-
bootargs=root=/dev/ram0
-
ZynqMP> fatload mmc 0 0x1000000 uImage;fatload mmc 0 0x2000000 uramdisk.image.gz;fatload mmc 0 0x4000000 zynqmp-sf-zcu102.dtb;
-
reading uImage
-
12966464 bytes read in 939 ms (13.2 MiB/s)
-
reading uramdisk.image.gz
-
17145380 bytes read in 1207 ms (13.5 MiB/s)
-
reading zynqmp-sf-zcu102.dtb
-
36666 bytes read in 100 ms (357.4 KiB/s)
-
ZynqMP> bootm 0x1000000 0x2000000 0x4000000
成功后的启动log:
。。。