[U-Boot] [PATCH v3 3/3] spl: dfu: reduce spl-dfu MLO size
Ravi Babu
ravibabu at ti.com
Thu May 4 10:15:30 UTC 2017
compile out cli_hush.c for spl/dfu and
use cli_simple_run_command for dfu to
reduce the spl-dfu memory foot print.
Adding CONFIG_SPL_DFU_MMC to Kconfig and
use CONFIG_IS_ENABLED(DFU_MMC).
Signed-off-by: Ravi Babu <ravibabu at ti.com>
---
---
common/Makefile | 1 -
drivers/dfu/Kconfig | 5 +++++
drivers/dfu/Makefile | 3 +++
drivers/dfu/dfu_mmc.c | 5 +++++
include/dfu.h | 2 +-
5 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index 86225f1..6e90078 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -90,7 +90,6 @@ endif # !CONFIG_SPL_BUILD
ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o
-obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o
obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 56a98f5..99a0db1 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -17,6 +17,11 @@ config DFU_MMC
help
This option enables using DFU to read and write to MMC based storage.
+config SPL_DFU_MMC
+ bool "MMC back end for SPL-DFU"
+ help
+ This option enables DFU for SPL to read and write to MMC based storage.
+
config DFU_NAND
bool "NAND back end for DFU"
help
diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile
index 61f2b71..7060908 100644
--- a/drivers/dfu/Makefile
+++ b/drivers/dfu/Makefile
@@ -6,7 +6,10 @@
#
obj-$(CONFIG_USB_FUNCTION_DFU) += dfu.o
+ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_DFU_MMC) += dfu_mmc.o
+endif
+obj-$(CONFIG_SPL_DFU_MMC) += dfu_mmc.o
obj-$(CONFIG_DFU_NAND) += dfu_nand.o
obj-$(CONFIG_DFU_RAM) += dfu_ram.o
obj-$(CONFIG_DFU_SF) += dfu_sf.o
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 926ccbd..ba509db 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -15,6 +15,7 @@
#include <ext4fs.h>
#include <fat.h>
#include <mmc.h>
+#include <cli.h>
static unsigned char *dfu_file_buf;
static long dfu_file_buf_len;
@@ -154,7 +155,11 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
+#if CONFIG_IS_ENABLED(DFU_MMC)
+ ret = cli_simple_run_command(cmd_buf, 0);
+#else
ret = run_command(cmd_buf, 0);
+#endif
if (ret) {
puts("dfu: Read error!\n");
return ret;
diff --git a/include/dfu.h b/include/dfu.h
index f39d3f1..94d2a49 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -203,7 +203,7 @@ static inline void dfu_set_defer_flush(struct dfu_entity *dfu)
int dfu_write_from_mem_addr(struct dfu_entity *dfu, void *buf, int size);
/* Device specific */
-#ifdef CONFIG_DFU_MMC
+#if CONFIG_IS_ENABLED(DFU_MMC)
extern int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s);
#else
static inline int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr,
--
1.9.1
More information about the U-Boot
mailing list