diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 16 | ||||
-rw-r--r-- | common/autoboot.c | 16 | ||||
-rw-r--r-- | common/command.c | 2 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 12 | ||||
-rw-r--r-- | common/spl/spl_sata.c | 25 | ||||
-rw-r--r-- | common/update.c | 21 |
6 files changed, 34 insertions, 58 deletions
diff --git a/common/Kconfig b/common/Kconfig index 1c9f4774ba..e3a5e1be1e 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -874,7 +874,7 @@ config UPDATE_COMMON config UPDATE_TFTP bool "Auto-update using fitImage via TFTP" - depends on FIT + depends on FIT && OF_LIBFDT && !MTD_NOR_FLASH select UPDATE_COMMON help This option allows performing update of NOR with data in fitImage @@ -883,16 +883,24 @@ config UPDATE_TFTP config UPDATE_TFTP_CNT_MAX int "The number of connection retries during auto-update" default 0 - depends on UPDATE_TFTP + depends on UPDATE_TFTP || DFU_TFTP config UPDATE_TFTP_MSEC_MAX int "Delay in mSec to wait for the TFTP server during auto-update" default 100 - depends on UPDATE_TFTP + depends on UPDATE_TFTP || DFU_TFTP + +config UPDATE_LOAD_ADDR + hex "Address in memory to load the update to" + depends on UPDATE_TFTP || DFU_TFTP + default 0x100000 + help + This option defines the location in memory to be used to load the + update to, if 'loadaddr' is not set in the environment. config UPDATE_FIT bool "Firmware update using fitImage" - depends on FIT + depends on FIT && OF_LIBFDT depends on DFU select UPDATE_COMMON help diff --git a/common/autoboot.c b/common/autoboot.c index 848c33b2f2..5d331991c1 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -40,11 +40,15 @@ DECLARE_GLOBAL_DATA_PTR; static int stored_bootdelay; static int menukey; -#if !defined(CONFIG_AUTOBOOT_STOP_STR_CRYPT) -#define CONFIG_AUTOBOOT_STOP_STR_CRYPT "" +#if defined(CONFIG_AUTOBOOT_STOP_STR_CRYPT) +#define AUTOBOOT_STOP_STR_CRYPT CONFIG_AUTOBOOT_STOP_STR_CRYPT +#else +#define AUTOBOOT_STOP_STR_CRYPT "" #endif -#if !defined(CONFIG_AUTOBOOT_STOP_STR_SHA256) -#define CONFIG_AUTOBOOT_STOP_STR_SHA256 "" +#if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256) +#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256 +#else +#define AUTOBOOT_STOP_STR_SHA256 "" #endif #ifdef CONFIG_AUTOBOOT_USE_MENUKEY @@ -81,7 +85,7 @@ static int passwd_abort_crypt(uint64_t etime) int err; if (IS_ENABLED(CONFIG_AUTOBOOT_STOP_STR_ENABLE) && !crypt_env_str) - crypt_env_str = CONFIG_AUTOBOOT_STOP_STR_CRYPT; + crypt_env_str = AUTOBOOT_STOP_STR_CRYPT; if (!crypt_env_str) return 0; @@ -160,7 +164,7 @@ static int passwd_abort_sha256(uint64_t etime) int ret; if (sha_env_str == NULL) - sha_env_str = CONFIG_AUTOBOOT_STOP_STR_SHA256; + sha_env_str = AUTOBOOT_STOP_STR_SHA256; presskey = malloc_cache_aligned(DELAY_STOP_STR_MAX_LENGTH); c = strstr(sha_env_str, ":"); diff --git a/common/command.c b/common/command.c index 7a86bd76a4..846e16e2ad 100644 --- a/common/command.c +++ b/common/command.c @@ -68,7 +68,7 @@ int _do_help(struct cmd_tbl *cmd_start, int cmd_items, struct cmd_tbl *cmdtp, return 1; if (usage == NULL) continue; - printf("%-*s- %s\n", CONFIG_SYS_HELP_CMD_WIDTH, + printf("%-*s- %s\n", CFG_SYS_HELP_CMD_WIDTH, cmd_array[i]->name, usage); } return 0; diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 0e026bb3d8..9ae3e5e35d 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -20,14 +20,6 @@ DECLARE_GLOBAL_DATA_PTR; -#ifndef CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ -#define CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ (64 * 1024) -#endif - -#ifndef CONFIG_SYS_BOOTM_LEN -#define CONFIG_SYS_BOOTM_LEN (64 << 20) -#endif - struct spl_fit_info { const void *fit; /* Pointer to a valid FIT blob */ size_t ext_data_offset; /* Offset to FIT external data (end of FIT) */ @@ -408,7 +400,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, if (CONFIG_IS_ENABLED(FIT_IMAGE_TINY)) return 0; - if (CONFIG_IS_ENABLED(LOAD_FIT_APPLY_OVERLAY)) { +#if CONFIG_IS_ENABLED(LOAD_FIT_APPLY_OVERLAY) void *tmpbuffer = NULL; for (; ; index++) { @@ -462,7 +454,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, free(tmpbuffer); if (ret) return ret; - } +#endif /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); if (ret < 0) diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index 12397f0ae1..32746ce9f3 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -17,11 +17,6 @@ #include <fat.h> #include <image.h> -#ifndef CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR -/* Dummy value to make the compiler happy */ -#define CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR 0x100 -#endif - static int spl_sata_load_image_raw(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, struct blk_desc *stor_dev, unsigned long sector) @@ -62,7 +57,7 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image, static int spl_sata_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { - int err = 0; + int err = -ENOSYS; struct blk_desc *stor_dev; /* try to recognize storage devices immediately */ @@ -77,16 +72,14 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) #endif { - err = -ENOSYS; - - if (IS_ENABLED(CONFIG_SPL_FS_FAT)) { - err = spl_load_image_fat(spl_image, bootdev, stor_dev, - CONFIG_SYS_SATA_FAT_BOOT_PARTITION, - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); - } else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) { - err = spl_sata_load_image_raw(spl_image, bootdev, stor_dev, - CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR); - } +#ifdef CONFIG_SPL_FS_FAT + err = spl_load_image_fat(spl_image, bootdev, stor_dev, + CONFIG_SYS_SATA_FAT_BOOT_PARTITION, + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); +#elif defined(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR) + err = spl_sata_load_image_raw(spl_image, bootdev, stor_dev, + CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR); +#endif } if (err) { puts("Error loading sata device\n"); diff --git a/common/update.c b/common/update.c index 80f16af653..3502713d7d 100644 --- a/common/update.c +++ b/common/update.c @@ -10,14 +10,6 @@ #include <cpu_func.h> #include <image.h> -#if !(defined(CONFIG_FIT) && defined(CONFIG_OF_LIBFDT)) -#error "CONFIG_FIT and CONFIG_OF_LIBFDT are required for auto-update feature" -#endif - -#if defined(CONFIG_UPDATE_TFTP) && !defined(CONFIG_MTD_NOR_FLASH) -#error "CONFIG_UPDATE_TFTP and !CONFIG_MTD_NOR_FLASH needed for legacy behaviour" -#endif - #include <command.h> #include <env.h> #include <net.h> @@ -31,19 +23,6 @@ /* env variable holding the location of the update file */ #define UPDATE_FILE_ENV "updatefile" -/* set configuration defaults if needed */ -#ifndef CONFIG_UPDATE_LOAD_ADDR -#define CONFIG_UPDATE_LOAD_ADDR 0x100000 -#endif - -#ifndef CONFIG_UPDATE_TFTP_MSEC_MAX -#define CONFIG_UPDATE_TFTP_MSEC_MAX 100 -#endif - -#ifndef CONFIG_UPDATE_TFTP_CNT_MAX -#define CONFIG_UPDATE_TFTP_CNT_MAX 0 -#endif - extern ulong tftp_timeout_ms; extern int tftp_timeout_count_max; #ifdef CONFIG_MTD_NOR_FLASH |