summaryrefslogtreecommitdiff
path: root/ext4_utils
AgeCommit message (Collapse)Author
2015-01-08make_ext4fs: workaround for a glibc scandir bugMihai Serban
Due to a bug in glibc scandir the make_ext4fs tool fails sometimes with error message: "error: build_directory_structure: scandir: Cannot allocate memory" A simple retry of the failed scandir in case errno is ENOMEM greatly increases the chances to finish the operation successfully. The scandir bug is reported here: https://sourceware.org/bugzilla/show_bug.cgi?id=17804 Change-Id: I87fa283106c0215e4b358459022497d9ec1edb60 Signed-off-by: Mihai Serban <mihai.serban@intel.com>
2014-12-17ext4_utils: Support -L LABEL option on mkuserimgChristoffer Dall
When creating Android images it is practical to be able to specify a filesystem label on the image files, which can be used to identify images for the right mount point. Change-Id: If0cefab3bb8ee27d2da15741ea709f1583ebb2e0 Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2014-08-12fix buildDoug Zongker
inode_allocate_file_extents should return NULL if allocation fails. Bug: 16984795 Change-Id: I7d2b9d61ca81f8e1869dbac3d8bde79bb5799fa9
2014-08-12add option to make_ext4fs to record blocks for each fileDoug Zongker
Add the -B option to make_ext4fs, which causes it to record the block ranges used for each (regular) file in the image. We can use this information to construct more efficient block-based incremental OTAs. Bug: 16984795 Change-Id: I2a5325bb89948f63c76e93fdfa84c51f9b050104
2014-06-17reduce mkuserimg.sh chattinessDoug Zongker
Also improve the log message from the -C option to make_ext4fs. Change-Id: I22ee4fd51c29995b2e772dcd929e1916eef22aeb
2014-06-16am fb0c6296: am 9c82554e: Merge "Ignore wipe operation on non-block devices."David 'Digit' Turner
* commit 'fb0c62963b5fe1b4f36e281c4c02d98d737d08ee': Ignore wipe operation on non-block devices.
2014-06-16optionally use a canned fs_config when building ext4 fsDoug Zongker
In order to accurately re-create old images after changes to android_filesystem_config.h, we need make_ext4fs and mkuserimg.sh to be able to take a file containing the desired uid/gid/mode/capabilities for each path in the filesystem, and use that instead of the fs_config function that is built in to the binary. The target_files already contains this file, which is created at the time of the original build by running the binary fs_config for each path in the build. Change-Id: I501dc9544de37a592c1e831b6bf785c086cb6912
2014-06-13Ignore wipe operation on non-block devices.David 'Digit' Turner
The implementation of make_ext4fs() calls make_ext4fs_internal() by forcing the |wipe| parameter to true, which is problematic when the library is used within the emulator (the wipe operation will always fail on non-Linux platforms). This patch does the following: - Add a 'is_block_device_fd()' function to check that a file descriptor points to a real block device. - Modify the implementation of wipe_block_device() uses it to return silently when trying to wipe a non-block-device file. - Add a WIPE_IS_SUPPORTED flag in wipe.h that indicates whether block device wiping is supported on the current platform (for now, this is only the case on Linux). BUG=NONE Change-Id: I62b62b7c3e99b465c3b876154231e7c2fe541b23
2014-05-16am 14119df1: am b733b3c7: Merge "The situation len = 0 and absolute = false ↵Colin Cross
need to be handled" * commit '14119df19e45b968774fc7242df780b87d93fef4': The situation len = 0 and absolute = false need to be handled
2014-04-30The situation len = 0 and absolute = false need to be handledBenoit Fradin
Add a return case for len == 0 and absolute == false Change-Id: Ia36bd67ced6abbe7234eb7e485c1a2d8bd928ffe Signed-off-by: Benoit Fradin <benoit.fradin@intel.com>
2014-04-27am fde5b354: am 79950456: Merge "Label lost+found directories with SELinux ↵Nick Kralevich
security contexts." * commit 'fde5b354c85a30f4dbe79bcf4f19473de11e00ef': Label lost+found directories with SELinux security contexts.
2014-04-25Label lost+found directories with SELinux security contexts.Stephen Smalley
When an asec image is generated, the lost+found directory has no security.selinux attribute set and thus shows up as unlabeled. We already handle this correctly when building images from existing directories with files, so we just need to do it here as well when generating an otherwise empty initial image. Change-Id: I6d449dcc67a5cbc2101718e34ea0e184936d7f0e Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-03Remove warningsPaul Lawrence
Remove warnings called by duplicate definition of ALIGN macro. Note that bionic/libc/include/sys/param.h defines ALIGN as #define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) which is not good - clashes with every other definition of ALIGN. Change-Id: I2d716c41ededd2fa072f944e21d94a0c93ca9c46
2014-02-15am d27ada97: Merge "ext4_utils: don\'t leave bad image file in case of error"JP Abgrall
* commit 'd27ada97706b61c6e302a94bd845b877121556c3': ext4_utils: don't leave bad image file in case of error
2014-02-14ext4_utils: don't leave bad image file in case of errorJP Abgrall
Bug: 13029951 Change-Id: Ibe50a503c2d3988813b362790b7fba83383fb51e
2014-02-13am c0f813af: Merge "Set s_flags to 2 to prevent a write on first mount."Geremy Condra
* commit 'c0f813afc35c1ca497f35b46181b37c9b837726e': Set s_flags to 2 to prevent a write on first mount.
2014-02-13Set s_flags to 2 to prevent a write on first mount.Geremy Condra
The s_flags field is used to indicate whether characters are signed or unsigned, which differs between ARM and x86 targets. Setting this value to 0 causes the correct value for the target to be written back to the superblock on first mount, even if the fs is marked read only. Since this value is only used to ensure interoperability with 2.4 series kernels (which we don't need) in dirhash (which we don't use), we'll just set it to 2 to prevent the write. Change-Id: I92698235909791fb5f423cfd61ff5299307a8f97
2014-02-05am 991d0bbb: Merge "make_ext4fs: fix block allocation to be best-fit"Colin Cross
* commit '991d0bbb02662ef36b3d770e914bd61cbe9d392a': make_ext4fs: fix block allocation to be best-fit
2014-02-05make_ext4fs: fix block allocation to be best-fitColin Cross
The block allocation algorithm was failing to allocate parts of large files out of partially filled block groups. Update the allocation algorithm to be a simpler best fit loop - if the remaining length to allocate is larger than any single contiguous region, allocate the largest single contiguous region and continue allocating, otherwise allocate the smallest contiguous that can hold the length. Change-Id: Idcc60df91ed0a266d3128ea46e86408a581d3f40
2014-01-31resolved conflicts for merge of 74da0434 to masterColin Cross
Change-Id: I0a7745ecf65a2188c32e7bf2e89fe93259c71b83
2014-01-29ext4_utils: fix build for 64 bitColin Cross
Correct u64/s64 definitions Use PRIu64 to print u64 Change-Id: Icaf7998946b0a2faa03495b404af8b94e4e3d047
2014-01-29ext4 utils: Refactor read_ext, and expose some of the functionsPaul Lawrence
Make read_ext an externally useable function. Use case is to enable fast encryption by being able to look at whether each block is in use or not. Bug: 11985952 Change-Id: Ief71f408a55db7261c75ebe974620415ed8cfd29
2014-01-23ext4_utils: move superblock parsing to its own compilation unitColin Cross
Move ext4_parse_sb to its own compilation unit so it can be used from fs_mgr without pulling in all of libext4_utils' dependencies when compiling with ld.bfd. Change-Id: I185352ecea0e0d577b8cdddfd519f2826d631277
2014-01-23ext4_utils: move sparse file pointer out of fs_infoColin Cross
Move the sparse file pointer out of the fs_info struct in preparation for exporting fs_info without sparse file support. Change-Id: I5a72147fe4fb24296e615cb82dbba91c6dc6f7f0
2014-01-23ext4_utils: refactor kernel headersColin Cross
Move the kernel header includes into a single include file that can deal with getting the kernel int types correct on all platforms. Change-Id: Ied3dc6a0f5cbb3ceb686aa3de72f16e10a36462a
2013-12-06allow fixing timestamps when building ext4 filesystemDoug Zongker
When building an image, make_ext4fs currently sets the timestamps in the image to the timestamps of the source files. Allow this time to be overridden with a fixed value provided on the command line, to make it easier to reproduce bit-identical images from a target_files zip. Change-Id: I52ddab4575a334ee52404f4d5d1c61b55513c618
2013-09-19am 67a05c0d: Merge "use BIONIC implementation of mmap64"Elliott Hughes
* commit '67a05c0d165d779126a5fa8831cd95a0bf2fd1f2': use BIONIC implementation of mmap64
2013-09-18use BIONIC implementation of mmap64Andrew Boie
Change-Id: Idb0c3d3bb98f22ea7d78043b786e931613377b02 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-08-16am 7f026d09: Merge "Avoid underflow on an unsigned int when computering bg ↵Ken Sumrall
overrun" * commit '7f026d09fa05a3aa93cea6f6e25df1b5c0f800a0': Avoid underflow on an unsigned int when computering bg overrun
2013-08-15Avoid underflow on an unsigned int when computering bg overrunKen Sumrall
A computation for when a block group overruns the end of an image was consistently storing a negative number in an unsigned var, and then checking for >0, which is always true for negative numbers. So first check if the number will be positive before computing it. Change-Id: Ic8cff8f9ab9f4ea8c5a4dc42143c2430fa87ba12
2013-07-25Merge "Missing include in wipe.h"jp abgrall
2013-07-24Changed visibility of get_block_device_sizeSzymon Starzycki
Change-Id: I5d27f5f50275017134a48eed8d89e452353777f1
2013-07-23Missing include in wipe.hSzymon Starzycki
Change-Id: I6c29d6e90c5bc17b3070595c89fad9ca5c3f75f9
2013-03-01ext4_utils: use android_filesystem_capability.hNick Kralevich
Change-Id: I47cb6ec2f1fcba0d076081b76335638b9c2d1789
2013-02-25ext4_utils: fix build error without FILE_CONTEXTSSungmin Choi
After commit 4df62f342dbbe2f5cca831ce789dc0426d32ec03, occurs segmentation fault if mkuserimg.sh runs without FILE_CONTEXTS options. It's due to strlen() for null value. To fix it, return 0 for null. Change-Id: Icf99706e51b9053a24e23b9d081a258962877c30
2013-02-22Fix win_sdk build.Nick Kralevich
Change-Id: I1d1e722a533e0db99492e7fdf308f102dc4c3661
2013-02-20ext4_utils: add filesystem capabilities support.Nick Kralevich
Add support for specifying filesystem capabilities when creating a new filesystem. The combination of SELinux extended attributes plus filesystem capability extended attributes is too big to fit inside one inode entry. Because of this, I added support to ext4_utils to create an xattr block and link the inode to that block. We continue to try to fit everything inside the inode if possible, but fall over to creating a block if the extended attribute is too big. Change-Id: I40ebb63975b15ecd8c565486e171b4d50cd4dfaa
2013-02-20ext4_utils: clean up some warnings.Nick Kralevich
Change-Id: Ia9761e5168cfe6baabc0105ea76d5575fc378f48
2013-02-04ext4_utils: mark uninitialized inode tables in block groupsColin Cross
Block groups that have no used inodes have their inode table left uninitialized, unless -t is specified, in which case they are explicitly zeroed. When they are uninitialized, writing a sparse ext4 image over existing data can cause e2fsck to confuse the uninitialized data for lost inodes. Set the EXT4_BG_INODE_UNINIT flags on block groups that have no used inodes. This flag requires the block group checksum feature to be enabled, so also enable the checksum feature in the superblock and compute the checksum for the block group. Since zeroing the inode tables is now useless, remove the code for it and deprecate the -t command line option. Change-Id: I4927c1d866d051547cf0dadc8c8703ded0163925
2013-01-30Fix root inode security labeling issue.Robert Craig
Introducing the verbose flag accidentally wrapped the security label function call for the root inode. The system.img will not be correctly labeled without this change. Change-Id: If73b63d4ee815bbf428dc3d72b9df000a2075a45 Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>
2013-01-23Add verbose option to make_ext4 commandWilliam Roberts
Enabeling the -v switch will cuase the make_ext4 command to output the selinux labeling context for all files. Change-Id: Ifae8a11eb2c3f4644873d9784affffafb27775bf
2013-01-23ext4_utils: reduce exported apisColin Cross
Remove unnecessary functions from make_ext4fs.h so they are not exposed to users of libext4_utils. Requires fixing up some internal places that depended on the definitions in the external make_ext4fs.h header. Change-Id: Ied24e0efb648d4fd2ccdd1a5a1b685e9bde9cfd7
2013-01-23ext4_utils: export make_ext4fs_sparse_fdColin Cross
Export a function to create a sparse image, writing the output to an fd. Useful for utilities that need to format a partition. Change-Id: I3737c65c69b7df0a0bd25885ee70aaadef8a4ad5
2012-12-21ext4_utils: fix windows build by avoiding asprintfColin Cross
asprintf is not available on windows. Since it is only being used outside operations. Change-Id: I79c3a3934f6de7a3cd3f17db5ae7731e9a68387c
2012-12-20ext4_utils: fix segfault on error opening output fileColin Cross
error_errno uses longjmp, but the jump target has not been set up in make_ext4fs_main.c. Use perror instead. Change-Id: Ic86eeb8af2315d1847d0a6d667e0b4e25eb9bdda
2012-12-20ext4_utils: canonicalize slashes in pathsColin Cross
Simplify handling of slashes between directories in paths by forcing them to have leading and trailing slashes as appropriate when passed in to make_ext4fs, and then keeping all directory paths with a trailing slash. As a side effect, using "/" as the mountpoint is now supported. Change-Id: I73fe709c26003a20b0bdf6504db16cc9e39edf9b
2012-11-26make_ext4fs: fix sepolicy lookup for lost+foundColin Cross
selabel_lookup needs the full path including mountpoint. Change-Id: Idc0641683a4e4528d94e54be1897315bf5fcdb0d
2012-11-26make_ext4fs: insert lost+found directory into filled filesystemsColin Cross
Insert a lost+found directory if necessary when creating a filesystem based on a directory structure. This will make the resulting image clean when tested with e2fsck, allowing e2fsck to be run on all images as a validity test. Change-Id: I81d0b6b4a802713270d3469e5a3bc555b680ec7e
2012-11-20make_ext4fs: fix dentry padding when dentry size is 4088 or 4092Colin Cross
When the total dentry size is N * 4096 - 4 or N * 4096 - 8, there is not enough room in the block to insert an extra padding dentry. Instead, switch to always padding the previous dentry out to the end of the block, which matches what the kernel does when creating new directory entries. Also fix dentry_size to return the size of all the dentries without the padding, the len + 8 padding is incorrect, and the DIV_ROUND_UP will round up to the correct number of blocks. Change-Id: If11f90e4ee172c135a0eae2a50b8be213e2dd0dc
2012-11-19Make SIZE a mandatory parameter.Ying Wang
Commit b4eca4b24af9c80ebb2a7fa2ba539a48096b7576 introduced a new optional parameter FILE_CONTEXTS. But the script can accept only 1 optional parameter as the last one. Otherwise FILE_CONTEXTS may be taken as SIZE. Change-Id: I1a701e191769f3936cfe6557ea3a20e1691dc859