From a8d33430f5f2a437d49f2b052bb8e9f239fb9f81 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Mon, 29 Aug 2016 01:39:48 +0200 Subject: [PATCH] Define and use image size limit in bytes instead of KB --- Makefile | 2 +- u-boot/Makefile | 12 ++++++------ u-boot/httpd/httpd.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index e9bd3ce..ac9284f 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ endef # $(2): if set to 1, use LZMA # $(3): other parameters passed to subdir make define build - args="IMG_SIZE=$(call img_size,$(1)) \ + args="IMG_SIZE=$$((1024*$(call img_size,$(1)))) \ IMG_LZMA=$(call is_one,$(2)) \ $(strip $(3))"; \ cd $(SOURCE_DIR) && \ diff --git a/u-boot/Makefile b/u-boot/Makefile index 616bf34..96b008a 100644 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -32,8 +32,8 @@ export TOPDIR # Some variables passed as arguments in cmd ifneq ($(IMG_SIZE),) - CONFIG_MAX_UBOOT_SIZE_KB = $(IMG_SIZE) - export CONFIG_MAX_UBOOT_SIZE_KB + CONFIG_MAX_UBOOT_SIZE = $(IMG_SIZE) + export CONFIG_MAX_UBOOT_SIZE endif ifeq ($(IMG_LZMA),1) @@ -138,8 +138,8 @@ define config_init $(call echo_yellow, Custom recovery web:\tno) \ ) - $(if $(CONFIG_MAX_UBOOT_SIZE_KB), \ - $(call echo_yellow, Image size limit:\t$(CONFIG_MAX_UBOOT_SIZE_KB) KB), + $(if $(CONFIG_MAX_UBOOT_SIZE), \ + $(call echo_yellow, Image size limit:\t$$(($(CONFIG_MAX_UBOOT_SIZE) / 1024)) KB), $(call echo_yellow, Image size limit:\tnot specified) ) @@ -167,8 +167,8 @@ define config_init $(if $(3),$(call define_add,CONFIG_GPIO_RESET_BTN,$(strip $(3)))) $(if $(filter $(4),1),$(call define_add,CONFIG_GPIO_RESET_BTN_ACTIVE_LOW,1)) - $(if $(CONFIG_MAX_UBOOT_SIZE_KB), \ - $(call define_add,CONFIG_MAX_UBOOT_SIZE_KB,$(CONFIG_MAX_UBOOT_SIZE_KB)) + $(if $(CONFIG_MAX_UBOOT_SIZE), \ + $(call define_add,CONFIG_MAX_UBOOT_SIZE,$(CONFIG_MAX_UBOOT_SIZE)) ) $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \ diff --git a/u-boot/httpd/httpd.c b/u-boot/httpd/httpd.c index 767cf17..1303e79 100644 --- a/u-boot/httpd/httpd.c +++ b/u-boot/httpd/httpd.c @@ -193,7 +193,7 @@ static int httpd_findandstore_firstchunk(void){ // has correct size (for every type of upgrade) // U-Boot - if((webfailsafe_upgrade_type == WEBFAILSAFE_UPGRADE_TYPE_UBOOT) && (hs->upload_total > (CONFIG_MAX_UBOOT_SIZE_KB * 1024))){ + if((webfailsafe_upgrade_type == WEBFAILSAFE_UPGRADE_TYPE_UBOOT) && (hs->upload_total > CONFIG_MAX_UBOOT_SIZE)){ printf("## Error: file too big!\n"); webfailsafe_upload_failed = 1; @@ -466,7 +466,7 @@ void httpd_appcall(void){ printf("Data will be downloaded at 0x%X in RAM\n", CONFIG_LOADADDR); } - memset((void *)webfailsafe_data_pointer, 0xFF, (CONFIG_MAX_UBOOT_SIZE_KB * 1024)); + memset((void *)webfailsafe_data_pointer, 0xFF, CONFIG_MAX_UBOOT_SIZE); if(httpd_findandstore_firstchunk()){ data_start_found = 1; -- 2.25.1