Support squashfs in map_file_generator
Test: th
Bug: 286870582
Change-Id: I0bc0ddab51939c2aea3882a6faa63e37c675e641
diff --git a/Android.bp b/Android.bp
index a466f93..efcd4db 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1338,4 +1338,7 @@
"libsparse",
"update_metadata-protos",
],
+ required: [
+ "unsquashfs",
+ ],
}
diff --git a/aosp/map_file_generator.cc b/aosp/map_file_generator.cc
index c4c9b51..8e20720 100644
--- a/aosp/map_file_generator.cc
+++ b/aosp/map_file_generator.cc
@@ -23,9 +23,12 @@
#include "android-base/file.h"
#include "common/utils.h"
-#include "update_engine/payload_generator/ext2_filesystem.h"
+#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/erofs_filesystem.h"
+#include "update_engine/payload_generator/ext2_filesystem.h"
#include "update_engine/payload_generator/filesystem_interface.h"
+#include "update_engine/payload_generator/raw_filesystem.h"
+#include "update_engine/payload_generator/squashfs_filesystem.h"
namespace chromeos_update_engine {
@@ -104,8 +107,14 @@
return -1;
}
img = tmpfile.path;
+ fd.reset(open(img, O_RDONLY | O_CLOEXEC));
}
std::unique_ptr<FilesystemInterface> fs;
+
+ fs = SquashfsFilesystem::CreateFromFile(img, true);
+ if (fs != nullptr) {
+ return WriteBlockMap(img, fs.get(), output_file);
+ }
fs = ErofsFilesystem::CreateFromFile(img);
if (fs != nullptr) {
return WriteBlockMap(img, fs.get(), output_file);