Implement 'fastboot format' command
Some filesystems (e.g. ext4) require flushing an initial
fs image, right after erasing it the partition is unusable.
Doing erase,flush emptyfs is a little bit scaring so we have a
separate command that performs it as atomic step:
- get size of partition
- create an empty filesystem image
- erase the partition
- flush empty fs to the partition
This command applicable only for ext4 filesystem and checks the
partition type before formatting it.
Change-Id: I8529bc3485739487f0d91312f7c0ab1a6e5d8b44
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 95be0ac..2d28d59 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -225,6 +225,7 @@
" flashall flash boot + recovery + system\n"
" flash <partition> [ <filename> ] write a file to a flash partition\n"
" erase <partition> erase a flash partition\n"
+ " format <partition> format a flash partition \n"
" getvar <variable> display a bootloader variable\n"
" boot <kernel> [ <ramdisk> ] download and boot kernel\n"
" flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it\n"
@@ -636,6 +637,10 @@
require(2);
fb_queue_erase(argv[1]);
skip(2);
+ } else if(!strcmp(*argv, "format")) {
+ require(2);
+ fb_queue_format(argv[1]);
+ skip(2);
} else if(!strcmp(*argv, "signature")) {
require(2);
data = load_file(argv[1], &sz);