Add support for sparse ext4 image creation.
This adds the -s option to the make_ext4fs tool, which now creates
"sparse" filesystem images, which is very useful for the large 32 Gbyte
filesystems we are now building.
This check-in also fixes make_ext4fs to properly create filesystems
larger thatn 4 Gbytes on 64-bit Linux, 32-bit android and Macs.
Change-Id: Ie5838492fcf944f5c875481693c0dbd7013deae4
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index f77af0c..87588ab 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -62,6 +62,8 @@
root_inode = make_directory(0, 1, &dentries, 1);
inode = make_directory(root_inode, 0, NULL, 0);
*dentries.inode = inode;
+ inode_set_permissions(inode, dentries.mode,
+ dentries.uid, dentries.gid, dentries.mtime);
return root_inode;
}
@@ -225,7 +227,7 @@
}
int make_ext4fs(const char *filename, const char *directory,
- char *mountpoint, int android, int gzip)
+ char *mountpoint, int android, int gzip, int sparse)
{
u32 root_inode_num;
u16 root_mode;
@@ -319,7 +321,7 @@
aux_info.sb->s_blocks_count_lo - aux_info.sb->s_free_blocks_count_lo,
aux_info.sb->s_blocks_count_lo);
- write_ext4_image(filename, gzip);
+ write_ext4_image(filename, gzip, sparse);
return 0;
}