Add erase sanitize
Sanitize uses the eMMC firmware to erase all blocks.
Tested:
$ cat /dev/urandom > /dev/mmcblk0
$ time busctl call xyz.openbmc_project.eStoraged.mmcblk0 \
/xyz/openbmc_project/inventory/storage/mmcblk0 \
xyz.openbmc_project.Inventory.Item.Volume Erase s \
xyz.openbmc_project.Inventory.Item.Volume.EraseMethod.VendorSanitize \
--timeout=1200
real 0m1.793s
user 0m0.021s
sys 0m0.009s
root@ytbaz20-nfd01:/# cat /dev/mmcblk0 | hexdump
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I31bc21c0b6d31cbba0db752d94a93eb004dbbde6
diff --git a/src/estoraged.cpp b/src/estoraged.cpp
index 6285079..f6176e4 100644
--- a/src/estoraged.cpp
+++ b/src/estoraged.cpp
@@ -4,6 +4,7 @@
#include "cryptErase.hpp"
#include "cryptsetupInterface.hpp"
#include "pattern.hpp"
+#include "sanitize.hpp"
#include "verifyDriveGeometry.hpp"
#include "zero.hpp"
@@ -86,6 +87,8 @@
}
case EraseMethod::VendorSanitize:
{
+ Sanitize mySanitize(devPath);
+ mySanitize.doSanitize();
break;
}
case EraseMethod::ZeroOverWrite: