summaryrefslogtreecommitdiffstats
path: root/tools/releasetools
diff options
context:
space:
mode:
authorMichael Runge <mrunge@google.com>2014-11-21 00:46:03 -0800
committerMichael Runge <mrunge@google.com>2014-11-21 00:46:03 -0800
commit3e286645ba0d02e59d9c8e4f86e09b37ed45d07b (patch)
tree8f4a1dedbd274f82e0b2ddde796c4ee657ac2476 /tools/releasetools
parent8c657dc214ef430d57c6e0483e25eb6faf7a5619 (diff)
downloadbuild-3e286645ba0d02e59d9c8e4f86e09b37ed45d07b.zip
build-3e286645ba0d02e59d9c8e4f86e09b37ed45d07b.tar.gz
build-3e286645ba0d02e59d9c8e4f86e09b37ed45d07b.tar.bz2
Add support for tuning partitions
Allow a simple mechanism to call tune2fs to modify an existing partition without reformatting. Bug: 18430740 Change-Id: I9210355b6bfec74d002d1f40b930330740f379a5
Diffstat (limited to 'tools/releasetools')
-rw-r--r--tools/releasetools/edify_generator.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 7d318a3..e52c264 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -201,6 +201,17 @@ class EdifyGenerator(object):
"""Log a message to the screen (if the logs are visible)."""
self.script.append('ui_print("%s");' % (message,))
+ def TunePartition(self, partition, *options):
+ fstab = self.info.get("fstab", None)
+ if fstab:
+ p = fstab[partition]
+ if (p.fs_type not in ( "ext2", "ext3", "ext4")):
+ raise ValueError("Partition %s cannot be tuned\n" % (partition,))
+ self.script.append('tune2fs(' +
+ "".join(['"%s", ' % (i,) for i in options]) +
+ '"%s") || abort("Failed to tune partition %s");'
+ % ( p.device,partition));
+
def FormatPartition(self, partition):
"""Format the given partition, specified by its mount point (eg,
"/system")."""