summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig12
-rw-r--r--common/environment.c4
-rw-r--r--common/globalvar.c9
-rw-r--r--common/imx-bbu-nand-fcb.c12
4 files changed, 20 insertions, 17 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 2ad92158c1..3ec3d46d40 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1,16 +1,8 @@
-config ARCH
- string
- option env="ARCH"
-
-config KERNELVERSION
- string
- option env="KERNELVERSION"
-
config DEFCONFIG_LIST
string
option defconfig_list
- default "$ARCH_DEFCONFIG"
- default "arch/$ARCH/defconfig"
+ default ARCH_DEFCONFIG
+ default "arch/$(ARCH)/defconfig"
config GREGORIAN_CALENDER
bool
diff --git a/common/environment.c b/common/environment.c
index 56a030eda0..aba6dcde48 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -277,9 +277,9 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags)
size = 0; /* force no content */
} else {
/* first pass: calculate size */
- recursive_action(dirname, ACTION_RECURSE, file_action,
+ recursive_action(dirname, ACTION_RECURSE | ACTION_SORT, file_action,
NULL, &data, 0);
- recursive_action("/.defaultenv", ACTION_RECURSE,
+ recursive_action("/.defaultenv", ACTION_RECURSE | ACTION_SORT,
file_remove_action, NULL, &data, 0);
size = 0;
diff --git a/common/globalvar.c b/common/globalvar.c
index b9bfce7dac..1bea7425d4 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -99,6 +99,9 @@ void dev_param_init_from_nv(struct device_d *dev, const char *name)
const char *val;
int ret = 0;
+ if (!IS_ENABLED(CONFIG_NVVAR))
+ return;
+
if (dev == &nv_device)
return;
if (dev == &global_device)
@@ -138,6 +141,9 @@ static int nvvar_device_dispatch(const char *name, struct device_d **dev,
const char *dot;
int dotpos;
+ if (!IS_ENABLED(CONFIG_NVVAR))
+ return -ENOSYS;
+
*dev = NULL;
if (strncmp(name, "dev.", 4))
@@ -447,6 +453,9 @@ static void globalvar_nv_sync(const char *name)
{
const char *val;
+ if (!IS_ENABLED(CONFIG_NVVAR))
+ return;
+
val = dev_get_param(&nv_device, name);
if (val)
dev_set_param(&global_device, name, val);
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 8c276a43c0..a29a1bf91a 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -1198,9 +1198,8 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
int ret, i;
struct fcb_block *fcb = NULL;
void *fw = NULL, *fw_orig = NULL;
- unsigned fw_size, partition_size;
enum filetype filetype;
- unsigned num_blocks_fw;
+ unsigned num_blocks_fw, fw_size;
int used = 0;
int fw_orig_len;
int used_refresh = 0, unused_refresh = 0;
@@ -1222,7 +1221,12 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
}
mtd = bcb_cdev->mtd;
- partition_size = mtd->size;
+
+ num_blocks_fw = imx_bbu_firmware_max_blocks(mtd);
+ if (num_blocks_fw < 1) {
+ pr_err("Not enough space for firmware\n");
+ return -ENOSPC;
+ }
for (i = 0; i < 4; i++) {
read_fcb(mtd, i, &fcb);
@@ -1329,8 +1333,6 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
pr_info("Refreshing existing firmware\n");
}
- num_blocks_fw = imx_bbu_firmware_max_blocks(mtd);
-
if (num_blocks_fw * mtd->erasesize < fw_size) {
pr_err("Not enough space for update\n");
return -ENOSPC;