summaryrefslogtreecommitdiffstats
path: root/cli_classic.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2021-12-13 12:30:03 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-01-22 00:04:00 +0000
commit7a2d7efd83ff50507192bba01dbad1a411e22b25 (patch)
tree1151de0c68e2f4367e833772f26661fa84ed7298 /cli_classic.c
parentf136a2a69c649c785669496d8bbd04b900724e77 (diff)
downloadflashrom-7a2d7efd83ff50507192bba01dbad1a411e22b25.tar.gz
flashrom-7a2d7efd83ff50507192bba01dbad1a411e22b25.tar.bz2
flashrom-7a2d7efd83ff50507192bba01dbad1a411e22b25.zip
cli_classic.c: Convert do_erase() to libflashrom call
Inline emergency_help_message() to cli_classic call site. This leaves do_erase() a redudant wrapper and moves us a step closer to cli_classic as a pure libflashrom user by using flashrom_flash_erase(). BUG=b:208132085 TEST=`flashrom -E` Change-Id: I8566164e7dbad69cf478b24208014f10fb99e4d0 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/60068 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'cli_classic.c')
-rw-r--r--cli_classic.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/cli_classic.c b/cli_classic.c
index 1b9c5ba3a..3cd78d408 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -840,8 +840,18 @@ int main(int argc, char *argv[])
ret = do_read(fill_flash, filename);
else if (extract_it)
ret = do_extract(fill_flash);
- else if (erase_it)
- ret = do_erase(fill_flash);
+ else if (erase_it) {
+ ret = flashrom_flash_erase(fill_flash);
+ /*
+ * FIXME: Do we really want the scary warning if erase failed?
+ * After all, after erase the chip is either blank or partially
+ * blank or it has the old contents. A blank chip won't boot,
+ * so if the user wanted erase and reboots afterwards, the user
+ * knows very well that booting won't work.
+ */
+ if (ret)
+ emergency_help_message();
+ }
else if (write_it)
ret = do_write(fill_flash, filename, referencefile);
else if (verify_it)