aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2018-05-29 15:30:52 +0000
committerMarek Vasut <marex@denx.de>2018-05-30 11:59:21 +0200
commitc232d14d11e29c88f2c6149d2c152f496caa5889 (patch)
tree4c6955992329b7448680e9445828e5769ac12e63
parent4085b90303790ca2f7b2633de78245e8fe98a87a (diff)
downloadu-boot-midas-c232d14d11e29c88f2c6149d2c152f496caa5889.tar.gz
u-boot-midas-c232d14d11e29c88f2c6149d2c152f496caa5889.tar.bz2
u-boot-midas-c232d14d11e29c88f2c6149d2c152f496caa5889.zip
mmc: Separate "mmc swrite" from fastboot
Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc swrite" command is separated from the fastboot code. Move image-sparse from common to lib so it's clear it's library code. Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE and migrate it to Kconfig. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Acked-by: Jassi Brar <jaswinder.singh@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--cmd/Kconfig8
-rw-r--r--cmd/mmc.c12
-rw-r--r--common/Makefile1
-rw-r--r--drivers/fastboot/Kconfig1
-rw-r--r--lib/Kconfig11
-rw-r--r--lib/Makefile1
-rw-r--r--lib/image-sparse.c (renamed from common/image-sparse.c)6
-rw-r--r--scripts/config_whitelist.txt1
8 files changed, 28 insertions, 13 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 9848c067da..30cf63f172 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -833,6 +833,14 @@ config CMD_MMC_RPMB
Enable the commands for reading, writing and programming the
key for the Replay Protection Memory Block partition in eMMC.
+config CMD_MMC_SWRITE
+ bool "mmc swrite"
+ depends on CMD_MMC && MMC_WRITE
+ select IMAGE_SPARSE
+ help
+ Enable support for the "mmc swrite" command to write Android sparse
+ images to eMMC.
+
config CMD_NAND
bool "nand"
default y if NAND_SUNXI
diff --git a/cmd/mmc.c b/cmd/mmc.c
index a5719b81eb..c2ee2d9c0a 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -308,8 +308,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
}
-#if CONFIG_IS_ENABLED(MMC_WRITE)
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
static lbaint_t mmc_sparse_write(struct sparse_storage *info, lbaint_t blk,
lbaint_t blkcnt, const void *buffer)
{
@@ -374,6 +373,7 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
}
#endif
+#if CONFIG_IS_ENABLED(MMC_WRITE)
static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
@@ -868,11 +868,11 @@ static cmd_tbl_t cmd_mmc[] = {
U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
#if CONFIG_IS_ENABLED(MMC_WRITE)
U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
-#if defined(CONFIG_FASTBOOT_FLASH)
- U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
-#endif
U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
#endif
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
+ U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
+#endif
U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
@@ -927,7 +927,7 @@ U_BOOT_CMD(
"info - display info of the current MMC device\n"
"mmc read addr blk# cnt\n"
"mmc write addr blk# cnt\n"
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
"mmc swrite addr blk#\n"
#endif
"mmc erase blk# cnt\n"
diff --git a/common/Makefile b/common/Makefile
index 9ec40b9d27..b3da72ebb2 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
-obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
obj-$(CONFIG_MII) += miiphyutil.o
obj-$(CONFIG_CMD_MII) += miiphyutil.o
obj-$(CONFIG_PHYLIB) += miiphyutil.o
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 1d7caaff99..0c9ced53de 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -57,6 +57,7 @@ config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
default y if ARCH_SUNXI
depends on MMC || (NAND && CMD_MTDPARTS)
+ select IMAGE_SPARSE
help
The fastboot protocol includes a "flash" command for writing
the downloaded image to a non-volatile storage device. Define
diff --git a/lib/Kconfig b/lib/Kconfig
index 1590f7afa4..15c6a52d4a 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -61,6 +61,17 @@ config SPL_STRTO
config TPL_STRTO
bool
+config IMAGE_SPARSE
+ bool
+
+config IMAGE_SPARSE_FILLBUF_SIZE
+ hex "Android sparse image CHUNK_TYPE_FILL buffer size"
+ default 0x80000
+ depends on IMAGE_SPARSE
+ help
+ Set the size of the fill buffer used when processing CHUNK_TYPE_FILL
+ chunks.
+
config USE_PRIVATE_LIBGCC
bool "Use private libgcc"
depends on HAVE_PRIVATE_LIBGCC
diff --git a/lib/Makefile b/lib/Makefile
index e6cb4afc23..c0511cbff8 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_FIT) += fdtdec_common.o
obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
+obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o
obj-y += initcall.o
obj-$(CONFIG_LMB) += lmb.o
obj-y += ldiv.o
diff --git a/common/image-sparse.c b/lib/image-sparse.c
index 1ae7a4d0e8..036062139b 100644
--- a/common/image-sparse.c
+++ b/lib/image-sparse.c
@@ -44,10 +44,6 @@
#include <linux/math64.h>
-#ifndef CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
-#define CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE (1024 * 512)
-#endif
-
static void default_log(const char *ignored, char *response) {}
int write_sparse_image(struct sparse_storage *info,
@@ -69,7 +65,7 @@ int write_sparse_image(struct sparse_storage *info,
int i;
int j;
- fill_buf_num_blks = CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE / info->blksz;
+ fill_buf_num_blks = CONFIG_IMAGE_SPARSE_FILLBUF_SIZE / info->blksz;
/* Read and skip over sparse image header */
sparse_header = (sparse_header_t *)data;
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 117ed2e152..5304f9577d 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -589,7 +589,6 @@ CONFIG_EXYNOS_RELOCATE_CODE_BASE
CONFIG_EXYNOS_SPL
CONFIG_EXYNOS_TMU
CONFIG_FACTORYSET
-CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
CONFIG_FAST_FLASH_BIT
CONFIG_FB_ADDR
CONFIG_FB_BACKLIGHT