X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fenv_nand.c;h=b32eeac9d7673c0137c3554dfd378f9ed2449bf4;hb=027b728d4aafb5cf97abc804944a77b837b0f07f;hp=749605fe3fa89ab798a0ebde92f1f90e4a40fb2b;hpb=45f08d359f7fc7892486f73475003a2103e25421;p=oweals%2Fu-boot.git diff --git a/common/env_nand.c b/common/env_nand.c index 749605fe3f..b32eeac9d7 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -132,7 +133,7 @@ static int writeenv(size_t offset, u_char *buf) u_char *char_ptr; blocksize = nand_info[0].erasesize; - len = min(blocksize, CONFIG_ENV_SIZE); + len = min(blocksize, (size_t)CONFIG_ENV_SIZE); while (amount_saved < CONFIG_ENV_SIZE && offset < end) { if (nand_block_isbad(&nand_info[0], offset)) { @@ -233,6 +234,12 @@ int saveenv(void) } #endif /* CMD_SAVEENV */ +#if defined(CONFIG_SPL_BUILD) +static int readenv(size_t offset, u_char *buf) +{ + return nand_spl_load_image(offset, CONFIG_ENV_SIZE, buf); +} +#else static int readenv(size_t offset, u_char *buf) { size_t end = offset + CONFIG_ENV_RANGE; @@ -244,7 +251,7 @@ static int readenv(size_t offset, u_char *buf) if (!blocksize) return 1; - len = min(blocksize, CONFIG_ENV_SIZE); + len = min(blocksize, (size_t)CONFIG_ENV_SIZE); while (amount_loaded < CONFIG_ENV_SIZE && offset < end) { if (nand_block_isbad(&nand_info[0], offset)) { @@ -266,6 +273,7 @@ static int readenv(size_t offset, u_char *buf) return 0; } +#endif /* #if defined(CONFIG_SPL_BUILD) */ #ifdef CONFIG_ENV_OFFSET_OOB int get_nand_env_oob(nand_info_t *nand, unsigned long *result)