fastboot: mmc: add response for all ack

To pass the build.

Change-Id: Ifafbb3bd586f4ff0a7def210720e4db16064ec4d
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
Kever Yang 2017-07-25 16:52:03 +08:00
parent 46eed85588
commit 16d3892d44
1 changed files with 20 additions and 18 deletions

View File

@ -141,7 +141,8 @@ static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info,
*/
static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
disk_partition_t *info,
struct andr_img_hdr *hdr)
struct andr_img_hdr *hdr,
char *response)
{
ulong sector_size; /* boot partition sector size */
lbaint_t hdr_sectors; /* boot image header sectors count */
@ -152,7 +153,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
if (hdr_sectors == 0) {
error("invalid number of boot sectors: 0");
fastboot_fail("invalid number of boot sectors: 0");
fastboot_fail("invalid number of boot sectors: 0", response);
return 0;
}
@ -160,7 +161,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
if (res != hdr_sectors) {
error("cannot read header from boot partition");
fastboot_fail("cannot read header from boot partition");
fastboot_fail("cannot read header from boot partition", response);
return 0;
}
@ -168,7 +169,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
res = android_image_check_header(hdr);
if (res != 0) {
error("bad boot image magic");
fastboot_fail("boot partition not initialized");
fastboot_fail("boot partition not initialized", response);
return 0;
}
@ -186,7 +187,8 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
*/
static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
void *download_buffer,
unsigned int download_bytes)
unsigned int download_bytes,
char *response)
{
uintptr_t hdr_addr; /* boot image header address */
struct andr_img_hdr *hdr; /* boot image header */
@ -206,7 +208,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, &info);
if (res < 0) {
error("cannot find boot partition");
fastboot_fail("cannot find boot partition");
fastboot_fail("cannot find boot partition", response);
return -1;
}
@ -215,17 +217,17 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
hdr = (struct andr_img_hdr *)hdr_addr;
/* Read boot image header */
hdr_sectors = fb_mmc_get_boot_header(dev_desc, &info, hdr);
hdr_sectors = fb_mmc_get_boot_header(dev_desc, &info, hdr, response);
if (hdr_sectors == 0) {
error("unable to read boot image header");
fastboot_fail("unable to read boot image header");
fastboot_fail("unable to read boot image header", response);
return -1;
}
/* Check if boot image has second stage in it (we don't support it) */
if (hdr->second_size > 0) {
error("moving second stage is not supported yet");
fastboot_fail("moving second stage is not supported yet");
fastboot_fail("moving second stage is not supported yet", response);
return -1;
}
@ -243,7 +245,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
ramdisk_buffer);
if (res != ramdisk_sectors) {
error("cannot read ramdisk from boot partition");
fastboot_fail("cannot read ramdisk from boot partition");
fastboot_fail("cannot read ramdisk from boot partition", response);
return -1;
}
@ -252,7 +254,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dwrite(dev_desc, info.start, hdr_sectors, (void *)hdr);
if (res == 0) {
error("cannot writeback boot image header");
fastboot_fail("cannot write back boot image header");
fastboot_fail("cannot write back boot image header", response);
return -1;
}
@ -264,7 +266,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
download_buffer);
if (res == 0) {
error("cannot write new kernel");
fastboot_fail("cannot write new kernel");
fastboot_fail("cannot write new kernel", response);
return -1;
}
@ -276,12 +278,12 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
ramdisk_buffer);
if (res == 0) {
error("cannot write back original ramdisk");
fastboot_fail("cannot write back original ramdisk");
fastboot_fail("cannot write back original ramdisk", response);
return -1;
}
puts("........ zImage was updated in boot partition\n");
fastboot_okay("");
fastboot_okay("", response);
return 0;
}
#endif
@ -327,23 +329,23 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
if (is_valid_dos_buf(download_buffer)) {
printf("%s: invalid MBR - refusing to write to flash\n",
__func__);
fastboot_fail("invalid MBR partition");
fastboot_fail("invalid MBR partition", response);
return;
}
if (write_mbr_partition(dev_desc, download_buffer)) {
printf("%s: writing MBR partition failed\n", __func__);
fastboot_fail("writing MBR partition failed");
fastboot_fail("writing MBR partition failed", response);
return;
}
printf("........ success\n");
fastboot_okay("");
fastboot_okay("", response);
return;
}
#endif
#ifdef CONFIG_ANDROID_BOOT_IMAGE
if (strncasecmp(cmd, "zimage", 6) == 0) {
fb_mmc_update_zimage(dev_desc, download_buffer, download_bytes);
fb_mmc_update_zimage(dev_desc, download_buffer, download_bytes, response);
return;
}
#endif