test: Add sources of static PNOR
Add sources in static dir to test.
It generates a link error about duplcated GardReset::reset().
Then an issue is found that GardReset::~GardReset() is not virtual,
this will casuse the destructor not calling its super class' dtor.
To fix the above link error, add GardReset[Ubi|Static] to make
ubi/static specific implementation in its own class.
Tested: Verify the test build works fine.
Change-Id: I41bd4d522e8b9c4053283c0cf4373807ef4f2d1c
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/ubi/item_updater_ubi.hpp b/ubi/item_updater_ubi.hpp
index ce1b5b8..fb6a6ca 100644
--- a/ubi/item_updater_ubi.hpp
+++ b/ubi/item_updater_ubi.hpp
@@ -9,6 +9,19 @@
namespace updater
{
+class GardResetUbi : public GardReset
+{
+ public:
+ using GardReset::GardReset;
+ virtual ~GardResetUbi() = default;
+
+ protected:
+ /**
+ * @brief GARD factory reset - clears the PNOR GARD partition.
+ */
+ void reset() override;
+};
+
/** @class ItemUpdaterUbi
* @brief Manages the activation of the host version items for ubi layout
*/
@@ -19,7 +32,7 @@
ItemUpdater(bus, path)
{
processPNORImage();
- gardReset = std::make_unique<GardReset>(bus, GARD_PATH);
+ gardReset = std::make_unique<GardResetUbi>(bus, GARD_PATH);
volatileEnable = std::make_unique<ObjectEnable>(bus, volatilePath);
// Emit deferred signal.