[IMX6Q]fastboot工具无法download u-boot.bin

本例存储设备使用的是sd card, 正常的download 方法是拔卡然后在PC上替换镜像:
$sudo dd if=u-boot.bin of=/dev/sdb bs=1K skip=1 seek=1; sync

有种更便捷的方法就是利用u-boot中的fastboot来download,
不过很多人遇到只能download boot.img, system.img和recovery.img,
而不能download u-boot.bin。

原因是u-boot.bin的存放是需要偏移1K的,而fastboot boot默认是没有的。

解决方法如下:

diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index aa5a9a7..900ed1a 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -1194,7 +1194,11 @@ mmc_ops:
 
                                        sprintf(slot_no, "%d",
                                                    fastboot_devinfo.dev_id);
-                                       sprintf(source, "0x%x", (unsigned int)interface.transfer_buffer);
+                                       //Kris, 2015091, u-boot.bin has 1K offset.
+                                       if (!strcmp(ptn->name, "bootloader"))
+                                               sprintf(source, "0x%x", (unsigned int)(interface.transfer_buffer + 1024));
+                                       else
+                                               sprintf(source, "0x%x", (unsigned int)interface.transfer_buffer);
                                        /* partition no */
                                        sprintf(part_no, "%d",
                                                    ptn->partition_id);

使用如下命令即可正常download:
$sudo fastboot flash bootloader u-boot.bin

你可能感兴趣的:(IMX6_u-boot,u-boot)