*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config FLASHCP
+//config: bool "flashcp"
+//config: default n # doesn't build on Ubuntu 8.04
+//config: help
+//config: The flashcp binary, inspired by mtd-utils as of git head 5eceb74f7.
+//config: This utility is used to copy images into a MTD device.
+
+//applet:IF_FLASHCP(APPLET(flashcp, BB_DIR_USR_SBIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_FLASHCP) += flashcp.o
//usage:#define flashcp_trivial_usage
//usage: "-v FILE MTD_DEVICE"
#define OPT_v (1 << 0)
-#define BUFSIZE (8 * 1024)
+#define BUFSIZE (4 * 1024)
static void progress(int mode, uoff_t count, uoff_t total)
{
if (total)
percent = (unsigned) (percent / total);
printf("\r%s: %"OFF_FMT"u/%"OFF_FMT"u (%u%%) ",
- (mode == -1) ? "Erasing block" : ((mode == 0) ? "Writing kb" : "Verifying kb"),
+ (mode < 0) ? "Erasing block" : ((mode == 0) ? "Writing kb" : "Verifying kb"),
count, total, (unsigned)percent);
fflush_all();
}