From: Han Gao Date: Thu, 16 May 2024 05:28:15 +0000 (+0800) Subject: Revert "fastboot: clean hibernate image when update uboot/kernel/rootfs partition" X-Git-Tag: accepted/tizen/unified/x/20241031.045847~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da9c7240ac42e4db9e6ad7a385c340dd7acf3c4f;p=platform%2Fkernel%2Fu-boot-thead.git Revert "fastboot: clean hibernate image when update uboot/kernel/rootfs partition" This reverts commit 3a7b5088eef6eed95537e5a5732f9c08095a559e. --- diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index cd27679f..92b33b89 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -294,56 +294,6 @@ int check_image_board_id(uint8_t *image_data) return 0; } -int hibernate_image_cleaned_flag = 0; -static void clean_hibernate_image_header(char *response) -{ - struct blk_desc *dev_desc; - disk_partition_t info; - if(0x03 == hibernate_image_cleaned_flag) //already erased all - { - return; - } - dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); - if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { - fastboot_fail("invalid mmc device", response); - return; - } - char * buf = memalign(CONFIG_SYS_CACHELINE_SIZE,4096); - if(!buf) { - printf(" mem alloc for hibernate partition header failed!\n"); - return; - } - /* if fastresume partition exists, earse the old image header */ - if(part_get_info_by_name(dev_desc, "fastresume", &info)) { - printf(" find fastresume partition , erase the header:\n"); - memset(buf,0xff,4096); - if(blk_dwrite(dev_desc, info.start, 4096/info.blksz, buf) != 4096/info.blksz) - { - printf(" fastresume header write failed!\n"); - hibernate_image_cleaned_flag = 0; - } - else - { - hibernate_image_cleaned_flag |= 0x1; - } - } - /* if swap partition exists, earse the old image header */ - if(part_get_info_by_name(dev_desc, "swap", &info)) { - printf(" find swap partition , erase the header:\n"); - memset(buf,0xff,4096); - if(blk_dwrite(dev_desc, info.start, 4096/info.blksz, buf) != 4096/info.blksz) - { - printf(" swap header write failed!\n"); - hibernate_image_cleaned_flag = 0; - } - else - { - hibernate_image_cleaned_flag |= 0x2; - } - } - free(buf); -} - #if CONFIG_IS_ENABLED(FASTBOOT_FLASH) /** * flash() - write the downloaded image to the indicated partition. @@ -402,16 +352,25 @@ static void flash(char *cmd_parameter, char *response) memcpy((void *)LIGHT_TF_FW_ADDR, fastboot_buf_addr, image_size); } else if ((strcmp(cmd_parameter, TEE_PART_NAME) == 0)) { memcpy((void *)LIGHT_TEE_FW_ADDR, fastboot_buf_addr, image_size); + } else if ((strcmp(cmd_parameter, "boot") == 0)) { + dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); + if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { + fastboot_fail("invalid mmc device", response); + return; + } + /* if fastresume partition exists, earse the old image header */ + if(part_get_info_by_name(dev_desc, "fastresume", &info)) { + printf(" find fastresume partition , erase the header:\n"); + char * buf = memalign(CONFIG_SYS_CACHELINE_SIZE,4096); + if(!buf) { + printf(" fastresume partition header mem alloc failed\n"); + return; + } + memset(buf,0xff,4096); + blk_dwrite(dev_desc, info.start, 4096/info.blksz, buf); + free(buf); + } } - - //If version is updated, hibernate image may not compatible with current,erase it. - if ((strcmp(cmd_parameter, "boot") == 0) - || (strcmp(cmd_parameter, "uboot") == 0) - || (strcmp(cmd_parameter, "root") == 0)) { - - clean_hibernate_image_header(response); - } - if(strcmp(cmd_parameter, "uboot") == 0 || (strcmp(cmd_parameter, "fw") == 0) || (strcmp(cmd_parameter, "uImage") == 0) || (strcmp(cmd_parameter, "dtb") == 0) || (strcmp(cmd_parameter, "rootfs") == 0) || (strcmp(cmd_parameter, "aon") == 0)) {