summaryrefslogtreecommitdiffstats
path: root/partition.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-12-13Support backup/restore of FBE policiesEthan Yonker1-15/+10
Change-Id: Iba8ef20f57b0fb57bb9406c53148a806441d0b59
2016-12-13Support File Based EncryptionEthan Yonker1-3/+59
Change-Id: Ib688ddd0c32d3999590cacd86b6d9b18eac336e9
2016-12-13Add boot slot supportEthan Yonker1-17/+29
Change-Id: I7eaf80e327985f53791f90fbdebad022a9650d31
2016-11-30Improve backup & wipe exclusion handlingEthan Yonker1-8/+14
Rename twrpDU.* to exclude.* Remove global variable for du and replace with partition specific variables. Use separate exclusion lists for backups and wiping. Clean up some includes Fix some parenthesis in twrp.cpp that I messed up. Note: twrpTarMain command line utility compiles but probably does not work correctly yet due to not properly setting part_settings Change-Id: Idec9c3e6a8782ba53f3420fa79ba33394f4f85fb
2016-11-30Check if mount point is dir during startupEthan Yonker1-0/+2
7.0 trees tend to create a /vendor symlink in the root of the ramdisk. TWRP needs to delete the symlink and mkdir to be able to mount the partition properly. Change-Id: Ia338739e07ca16ccd2492ea1fec2f5e99cfc08eb
2016-11-30MD5 verification sanityJames Christopher Adduono1-31/+27
We can use switches and enums to make things more understandable and work with results in a more sensible manner. PS2: Move file MD5 verification and error handling into a separate function to reduce code. PS3: Default to false in Check_Restore_File_MD5 function Change-Id: Id3ee0bb444cf13be67bb5dec2c43f7c26a86b954 (cherry picked from commit 5c3950716e5c7c6279efd5f3f338d6d22e5215e2)
2016-11-30Fix image flashingEthan Yonker1-8/+5
PS2: full_filename is not a dir PS3: use a consistent format of always assuming directory is missing the trailing / + fix whitespace alignment Change-Id: Ib963473ae10571b3d069b326d024ca04c7224dda (cherry picked from commit fa4ff144374474c541351d153549ad11d4396614)
2016-09-13Clean up PartitionSettingsEthan Yonker1-19/+22
The PartitionSettings struct contains some data elements that are duplicates of data elements in the TWPartition class that is contained within the PartitionsSettings.Part element. We will eliminate this duplication to help reduce the chances for programming bugs. Specifically, this fixes problems where the current file system does not match the backed up file system. Change-Id: I02f236e72093362050556a2e53a09d1dbb9a269d
2016-08-31MD5 checking: fix issues introduced with adb backup patchsetbigbiff bigbiff1-3/+3
This patchset will fix issues with creating and checking md5 checksums with single partitions and subpartitions. Change-Id: Iddfaf46412e95635af958094726cf9e3eb5a4cc8
2016-08-22wait for cryptfs device node to come upKjell Braden1-5/+6
this is to prevent a race condition to occur when mounting an adopted storage volume just after it was decrypted. After setting up the decrypted volume using cryptfs_setup_ext_volume(), Decrypt_Adopted() immediately calls Mount(), which will call Check_FS_Type(), which will fail in blkid_new_probe_from_filename, as the device node was not created yet. Change-Id: Ic5a274c2066ab278c9b7f1c8b83b820e552ca344
2016-08-01ADB: Add adb backup for TWRP.bigbiff1-101/+168
Functionality for client side to backup tar and image streams over adbd to the client under backup.ab. Using adb backup on the client side you can backup the partitions TWRP knows about. On the client side you can do the following: adb backup -f <filename> --twrp <options> where options are --compress: compress data system: backup system cache: backup cache data: backup data boot: backup boot etc for each partition. You can string multiple options, i.e. adb backup -f <filename> --twrp --compress cache system data adb backup in TWRP will take any option corresponding to TWRP fstab partitions, e.g. efs boot as well. If you do not specify the filename with the -f option, adb will backup your data to a filename backup.ab on the client. You can then rename the file and encrypt it with desktop tools. If you don't want to use command line arguments: adb backup --twrp will bring up the gui and allow you to choose partitions from the backup page. To restore the backup use the following convention: adb restore <filename> Structures are used to store metadata in binary inside of the file itself. If the metadata structure is modified, update the adb version so that it will invalidate older backups and not cause issues on restore. When restoring, we currently do not support picking specific partitions. It's all or nothing. Change-Id: Idb92c37fc9801dc8d89ed2a4570e9d12e76facf8
2016-05-03Wait to mount until after fstab processedMatt Mower1-52/+78
The necessity to process fstab twice stems from mounting partitions while still processing. Instead, wait to finish setup of /data, /cache and storage parameters until after fstab has been processed (once). Change-Id: Id77e1edbab5eb68a7cd4a1f34953d819a043d47a
2016-05-03Remove char/string conversions in fstab processingMatt Mower1-7/+7
There a few char->string conversions between functions which handle different parts of fstab line processing, but there are no uses of string functions. Pass char arrays/pointers around instead. Change-Id: I976a9a54ee8dcfb6194cadcac6a34e467602003b
2016-05-03Rewrite FS fstab flag processingMatt Mower1-25/+28
* If 'ro' fsflag detected, set Mount_Read_Only = true * Only output human readable Mount_Options to log * Match fsflags identically (not just first n chars) since there are no fs_flags which take arguments * Match new processing method introduced in TW fstab flag processing Change-Id: Iefdb76016be90a131b0d627d0cd3f18d2eb1a008
2016-05-03Rewrite TWRP fstab flag processingMatt Mower1-162/+258
* Do not flip/flop between std::string and char* when no std::string specific functions are applied. * Remove the need to manually count flag string lengths * Move checks for Display_Name, Storage_Name, and Backup_Display_Name out of flag processing Change-Id: I24d432c222124012b2a98d27598e42d0944f7da2
2016-04-28Partition: Fix parsing of several twrp fstab flagsGordon Freeman1-10/+15
fix parsing when using storagename=, backupname= and userdataencryptbackup= in twrp.fstab also split encryptable= and forceencrypt= into seperate blocks and make storage=Y working Change-Id: I674f7ffe7f9e4ff121c4dccf79096360e044535c
2016-03-31Improve progress bar handling for backup / restore / image flashEthan Yonker1-91/+140
The progress bar will now be updated during image backups, restores and during image flashing (except for sparse images which will require significant changes to libsparse, and except for mtd nand using flash_utils). The progress bar will now be updated mid-file for file systems (tar) so the user will see changes even during large file backup / restore. Add a new progress tracking class to simplify handling of progress bar updates. The class will only update the progress bar 5 times a second to reduce the CPU load from updating the GUI frequently which does affect backup times. Change-Id: Iff382faef3df1f86604af336c1a8ce8993cd12c5
2016-03-31DataManager UpdatesEthan Yonker1-1/+0
The goal of this change is to make DataManager use InfoManager to reduce code duplication. Change-Id: Ia4f4c4324453a192995e0f442db0a03628c13e46
2016-03-29Allow restoring to read-only file systemJames Christopher Adduono1-1/+39
This allows the restoration of firmware or modems on read-only mounted file systems. If the user is able to make a backup of these partitions, it would only make sense they be allowed to restore that backup. The current handling is dangerous in that it happily wipes, but refuses to restore. :) Note that it would be preferable to use the backup=emmc flag instead in most cases, added by change: https://gerrit.omnirom.org/#/c/17183 Change-Id: I32d47c8928dee61595c15a9db16d3c5b9a6d7183
2016-03-17Change to dd for wiping crypto partitionsEthan Yonker1-2/+6
flash_image was spitting an error. We are also specifying a size so that we do not risk writing beyond the partition. Change-Id: Ie3a0d77db96e54357238595934c3df0e3b680823
2016-02-18Fix adopted storage when andsec flag is presentEthan Yonker1-0/+11
Change-Id: If903d838abc920f952f243482338188c15bb1dbf
2016-02-05partitions: Mount storage for MTP after wipeMatt Mower1-3/+3
Conditionally run Add_MTP_Storage() after wipe if: 1) is wiped successfully 2) is storage (already implemented) 3) mount succeeds Previous to this commit, Add_MTP_Storage() was called before mounting storage, which fails. Mounting storage right after wipe should not be a problem since Update_System_Details() does it anyways (and doesn't complain if already mounted). Change-Id: I8a5a78d5ac9181f3a9464dfe6b77284458f9868b
2016-02-03allow flashing sparse imagesHashBang1-3/+21
if the image has the right magic bytes to be a sparse image, use simg2img to flash the image create a rule to make a fully dynamic simg2img which results in a much smaller increase in gzip ramdisk size (2KB vs 40KB) Change-Id: I1b0f6bc127da46103888b1154a9bddd8ac02c01d
2016-01-29partition.cpp: fix build, add missing includethat1-0/+1
Change-Id: I5b4c3b90d579573536e9de2df5127160cdc9a10f
2016-01-29Replace fix permissions with fix contexts for emulated storageEthan Yonker1-1/+0
Fix permissions rarely fixed anything on more recent versions of Android and usually made things worse. Instead we will replace it with a more dumbed down option that should fix contexts on /data/media with a few improvements to ensure that contexts get fixed for multiple users and on adopted storage. Change-Id: If5523781936a0b04196e2ad871cae767ebae2583
2016-01-29Reduce format f2fs timeGreg Wallace1-1/+1
Secure block discard/trim was fixed by: https://github.com/CyanogenMod/android_external_f2fs-tools/commit/6b39b93d83ab4ccb1913ecbc7a5a3e16766a011f Once fixed, formatting using discard/trim takes a LONG time. Other TWRP formatting methods are already insecure. It doesn't make sense for this one type of partition to have secure wipe when none of the others do. Change-Id: Ib5ad5a722895b0e0c7aa4e3af98b705e2574b762
2016-01-25Adopted Storage supportEthan Yonker1-36/+201
-Detects, decrypts, and mounts an adopted SD card if a secondary block device is defined (usually mmcblk1) -Handles unified storage -Displays the adopted storage in MTP along with internal -Factory Reset - wiped just like a data media device, we retain the keys folder and the storage.xml during a factory reset -Backup / Restore -Disable mass storage when adopted storage is present -Read storage nickname from storage.xml and apply it to display names in the GUI -Read storage.xml and determine what storage location is in use for /sdcard and remap accordingly libgpt_twrp is source code mostly kanged from an efimanager project. It is GPL v2 or higher, so we will opt for GPL v3. Change-Id: Ieda0030bec5155ba8d2b9167dc0016cebbf39d55
2016-01-22Fix a bunch of messagesMatt Mower1-5/+5
* Find and rename/remove duplicate string variable names * Add missing string variables to en language file * Fix display of some strings missing @ in front of variable name * Fix several %s --> {1} * Be consistent in usage of cancelled vs. canceled (both spellings acceptable) Tip for finding strings missing from language files: 1) Find all messages: egrep -hr "gui_msg.+=" > /tmp/msgs.txt 2) Regex replace to trim them down WHAT: ^\s+gui_msg(?:[^"]+)"([a-zA-Z0-9_]+)=([^"]+).+ WITH: $1 Note that $2 can be used to retain the message 3) Find missing strings: for i in $(cat /tmp/msgs.txt); do if ! grep -q $i gui/theme/common/languages/en.xml; then echo $i; fi done Change-Id: Ic193162e4b5468bf027472928a370be39840ea1d
2016-01-14Improve sdcard partitioning processEthan Yonker1-16/+2
-Improve code for partitioning sdcards -Allow user to select a device for partitioning (must be removable) -Use sgdisk to partition sdcards -Set default sizes for ext and swap to 0 -Change increments for ext to 256MB and swap to 64MB Note: sgdisk is included in 6.0. I have included a static prebuilt sgdisk for trees that do not have sgdisk, however the prebuilt sgdisk is a decent bit larger than the old parted binary. The old parted binary is quite old at this point and we only have it for armv7a. sgdisk should be maintained by AOSP and can be built from source so it should work across architectures. Change-Id: Ib80882d9b5776e5e9358b11340fba392e6f1ae09
2016-01-04gui: Fix partition repair messageGreg Wallace1-5/+5
The message was named something non-existent. Fix the spelling error and add the default message into the language files. Change-Id: I4e9e10d2705b1edf75b185d3badba59eb86ffb8b
2016-01-04gui: Fix typo of formatting_using messageGreg Wallace1-8/+8
Change-Id: I6df4937658815350366ed3dd2cf92156f98c96c4
2016-01-04ntfs-3g: Fix cm-13 compatibilityGreg Wallace1-21/+39
CM-13 tree completely changes the names of the binaries that are created for ntfs-3g. If we are using a CM-13 tree (CM SDK 4) make sure the dependencies and relinking are adjusted accordingly. Also, adapt partition code so it can make use of whichever set of binaries are present. Change-Id: I810caafa818f18281fd29dcf8f31b3053133b5ed
2015-12-19Use ioctl to get block device sizeEthan Yonker1-15/+29
AMLogic based device uses paths like /dev/block/recovery and the stock init binary either deletes or does not create mmcblk0p12 which breaks TWRP because TWRP cannot match up the path / name. The ioctl method is probably more reliable anyway and certainly should be faster. Change-Id: I73f981dcec637cdf5b189bdefa00ea15b924b500
2015-12-19Multiple Language SupportEthan Yonker1-92/+96
This is similar to https://gerrit.omnirom.org/#/c/14014 A lot of the features built in the older patch set have been split out into separate patches, most of which have already been merged. The remaining functionality here should all be directly related to language selection and loading. We always load English as a base before loading other languages over the top of the base. The idea is that if another language is missing a translation, then we will still display the English. Maybe still to do: read the /cache/recovery/last_locale file and load a language based on that. For me, this file contains just: en_US We probably won't bother with region specific translations so we would have to look at either trimming off the _US or using some other method like perhaps a symlink or a combination of the two. Thanks to _that for twmsg.cpp class Change-Id: I9647a22e47883a3ddd2de1da51f64aab7c328f74
2015-11-26Fix broken fsflags supportKetut Putu Kumajaya1-1/+1
Process_FS_Flags Flags parameter is just a copy not a reference, not get updated, Mount_Flags always 0 - fix it now. Thanks to SHM @ XDA-Developers Change-Id: Ib044db905febfedefee493cfc04fd1cad6f61f8e
2015-11-26Update dosfstoolsMatt Mower1-8/+8
* Version 3.0.28 * Update filenames in source * Remove unnecessary symlink to fsck * Commit "Recode short filenames from DOS codepage (default 437)." has been reverted since we do not have access to iconv * Commits cherry-picked on top of 3.0.28: - mkfs.fat: fix incorrect int type - Prevent out of bound array read in date_dos2unix() Change-Id: I50310235c62ec2e6bc90afcd10f2814d3afb5113
2015-11-12Free some memory allocationsMatt Mower1-0/+1
Change-Id: Ifb6c186e43e1eb068e8075def16924ced04bb23d
2015-11-05Treat /vendor like /system for read onlyEthan Yonker1-0/+10
The vendor partition is verity checked just like system so we should treat vendor as read only same as system. Change-Id: Ida65c9f44d8610e52fcdcef0b4a50faf5c7110d2
2015-10-25Fix a bunch of warningsEthan Yonker1-1/+0
Mostly adding __unused where needed. Change-Id: Ia4f675b9b360782728c361ed1699db0cc277c3a5
2015-08-09Wipe crypto key when formatting dataEthan Yonker1-0/+42
Change-Id: I032fabb383b4063e3b31b6044ce39966b8c617d0
2015-07-14Add ntfs-3g supportEthan Yonker1-0/+60
Add support for mounting ntfs via ntfs-3g and support for wiping and repairing ntfs partitions. Change-Id: I82dc4626f459bb93b86eb9ebba64ad3a6560781b
2015-06-18fix settingsstorage markXuefer1-0/+1
Change-Id: I60755ca66f048d1484c3d55dc60099679ba987f6
2015-06-17partition: recreate tw_internal_path(/data/media/0), after wipe media from data or format /data.xiaolu1-5/+12
Change-Id: I3671d7a5759260a4e74952168483a6816eb28f5d
2015-05-28Add resize2fs and ability to run resize2fs via GUIEthan Yonker1-2/+75
Note: Only works on ext2/3/4 partitions. Only tested on ext4. We can use this in some cases to resize the data partition if an incorrect fstab caused recovery to not reserve the 16KB for a crypto footer. Sometimes the BoardConfig for a custom ROM does not have the correct size for the system partition and if the ROM flashes a raw system image, that image will not take up the full block device. Running resize2fs can fix the size and may allow more room in the system partition for customizations like busybox or a larger gapps package. Sometimes flashing a factory image may flash userdata with an image with a file system that does not take up the full size of the block device (e.g. factory images for the Nexus 6 will flash userdata with a ~24GB userdata image, wasting ~30GB of space). Using resize2fs we can easily fix this issue without having to do a full format data. Change-Id: I631f5c6f567bbc6a9241e5dd95f1e435820a1b13
2015-05-27Mount system as read-only by defaultEthan Yonker1-4/+52
Mounting system as rw can prevent future OTA updates. The purpose of this patch set is to prevent TWRP from mounting sytem as rw on the first boot. Device maintainers should update their twrp.fstab files on these devices to include an additional line: /system_image emmc /dev/block/../system This line will allow TWRP to create a raw system image backup to ensure that the user can return to an original state for future OTA updates. Change-Id: I8929d85bc3a5b96cc564bc7f734b58d5612ec833
2015-05-19partition: support texfat modulethat1-1/+9
Change-Id: I21d0498fc16fdb29d09d6e6fe715e57d1f35e72b
2015-05-19Backup: fix 'out of memory' issue when backing up large partition as imagecodelover1-6/+15
Restore: improve image restoration speed * Workaround for devices that need to backup partition as image, eg: dm-verity * Increased block size used for partition restore, now using 8M instead of 4K Change-Id: Ie7e7ff3283d71a7e459d76f72caea9f57e71c628
2015-05-15Support Qualcomm hardware decryptDees Troy1-0/+1
Change-Id: I121ef0f5da209be48f6d87559d539c7fc6d85336
2015-03-19Fix TWRP not mounting /data/media type storage if built with toolbox utilscodelover1-1/+1
* ONLY Applicable when building with 'TW_USE_TOOLBOX := true' * toolbox's 'mount' expects the first argument to be a block device, but /data/media is a dir. * Technically we don't 'mount' a dir to another, we 'bind' it instead. * So we define the mount option explicitly with '-o bind'. (supported by busybox 'mount' too) Change-Id: If97c9096167fb723150b949f4336005b3313a174
2015-03-13Add UI for entering pattern for device decryptionVojtech Bocek1-0/+1
Change-Id: Ia2d3268a96423e9ca3846500c57e674c4f8fa60b Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2015-03-05Address a few compiler warningsMatt Mower1-1/+1
Change-Id: I6e063fba8d58c8c53da6bca6292c84e3392aee50
2015-02-02Allow wiping f2fs to reserve space for a crypto footerdhacker291-1/+12
We will convert a -16384 to 16384 if needed because mkfs.f2fs does not like negative numbers like make_ext4fs does. Also enable trim by default on f2fs. Change-Id: I8b41e65d1ff894433665c65d0569a51803c67891
2015-01-27Add cancel backup capability.bigbiff1-5/+6
This will stop the iteration of the partition objects, kill the current twrpTar thread and remove the backup directory. Implement TWAtomicInt class to give us a wrapper that automatically uses mutexes before the read and write to help ensure that the reads and writes will be atomic based on documentation. Change-Id: I645b22bc980a292e9c7202acb24ffd22ebe68c63
2015-01-09Fix restore of images for mtd and bml nandEthan Yonker1-3/+1
Change-Id: I843ddf7a5bca3ca7670dd6f19644b37cf017e5b1
2015-01-09Allow flashing of images via the GUIEthan Yonker1-44/+79
- Use the Images... button in the lower right of the zip install page - Unify image flashing functions between restore and image flash - boot and recovery partitions are flashable by default - use fstab flag flashimg=1 or 0 to override defaults - file system partitions are currently not flashable Change-Id: I822dc446030543c55d2153e219d67a1292374ffc
2015-01-05Update blkid to 2.25.0bigbiff1-1/+2
Break libblkid into 4 libraries: libblkid, libuuid, libutil-linux and libfdisk. This should help in later patch updates. Change-Id: I680d9a7feb031e5c29a603e9c58aff4b65826262
2014-12-22Fix else if and maxFileSize initializer.bigbiff1-13/+12
Change-Id: Iac7852a4fb2add5744d5ea424d6ad5a82828f102
2014-12-22fixPermissions: simplify code, fix bugsthat1-7/+6
- avoid parsing permission strings - fix memory leaks, a fix new/free mismatch and a compiler warning - fix that only first updated-package was processed - fix a potential stack overflow if packages.xml is huge - minor refactoring for reducing duplicated code - don't process packages without codePath - fix path for deleting app data (currently unused anyway) - fix file ownership on libs - try not to mess up Android 5.0 app permissions Patch set 4 - make fixing SELinux contexts an option with a check box - add some notes / text to the themes Patch set 6 - decouple "fix permissions" from "fix contexts" Change-Id: Icc77ecc581befc5ce6e419b1f3b8ca189208c234
2014-12-21Allow non datamedia devices to wipe encryptionEthan Yonker1-0/+10
With 5.0 L, we decrypt automatically if the default_password is used. Non datamedia devices do not get the format data button so they cannot wipe encryption off the device. This patch add a wipe encryption button where the format data button would normally be located on the Wipe page. This patch also attempts to remove / delete the dm-crypt block device before formatting. Change-Id: I100d5d154d6c49254fd48e23279df973db5f23ae
2014-12-19MTP add/remove storage instead of disabling MTPEthan Yonker1-12/+14
Implement a pipe between TWRP and MTP to allow TWRP to tell MTP to remove storage partitions as they become unavailable (e.g. during a wipe, unmount, etc) instead of disabling MTP completely. This includes some fixes and improvements in destructors to properly remove / delete various items. This also means that we will not be toggling adb off and on quite as often. I do not like that we had to add another thread, but we were unable to use select() on the mtp_usb character device because this device does not support polling. Select always returned indicating that the mtp file descriptor was ready to be read and the resulting read would block. The read block prevented us from being able to include reading of the pipe between TWRP and MTP in the main MTP thread. We might want to add a return pipe letting TWRP know if the removal of the storage device was successful, but I am not sure how we want to implement this. It would invovle timeouts in both TWRP and MTP to ensure that we returned a failure indicator in a timely manner to TWRP and prevent deleting the storage device in the case of a failure. Right now we make no attempt to ensure that an MTP operation is underway like a large file transfer, but we were not doing anything like this in the past. In some respects we have limited control over what happens. If the user installs a zip that unmounts a storage partition, we will not know about the change in storage status anyway. Regular Android does not have these troubles because partitions rarely get unmounted like in recovery. At some point, we have to hold the user accountable for performing actions that may remove a storage partition while they are using MTP anyway. Ideally we do not want to toggle the USB IDs and thus toggle adb off and on during early boot, but I am not sure what the best way to handle that at this time. Change-Id: I9343e5396bf6023d3b994de1bf01ed91d129bc14
2014-12-12Attempt to set the proper uid/gid/contexts on new files and dirsEthan Yonker1-0/+3
Files and folders that we create during backups, copy log, or MTP operations often do not have the proper uid/gid/contexts assigned. We will attempt to read the proper contexts from the settings storage path and assign those same contexts to any files or dirs that we create. Change-Id: I769f9479854122b49b499de2175e6e2d026f8afd
2014-12-09Fix png graphics load / display on AArch64Ethan Yonker1-1/+1
This is mostly kang from AOSP resources.c for loading png files into RAM, but for ease of compatibility we retained the older gr_surface data types throughout and ensured that we retain support for alpha blended png files. Change-Id: Ieea552173d3bfe885460407be73088bbad75663f
2014-12-04add function to partition.cpp to return max file size to mtp responderbigbiff1-0/+25
Change-Id: If8114b5eac741db6c512fb35cb48e3825c2ff098
2014-12-04Reduce libs needed for decrypt and clean up old decypt filesEthan Yonker1-77/+16
Trim cryptfs.c to remove functions that TWRP does not use for decrypt and remove the need for libfs_mgr from cryptfs.c by passing some items to cryptfs.c from the partition manager. Add support for new fstab flags: encryptable and forceencrypt=/path/to/cryptokey For example: flags=forceencrypt=/dev/block/platform/sdhci-tegra.3/by-name/MD1 Note that "footer" is the default, so you do not need to set this flag on devices that use the footer for the crypto key. Also add mounttodecrypt if you need to mount a partition during the decrypt cycle for firmware of proprietary libs. Clean up decrypt and only support one version Android 5.0 lollipop decrypt should be backwards compatible with older versions so we will only support one version, 1.3 that came with 5.0 lollipop. Remove support for Samsung TouchWiz decrypt. It does not work with the latest versions of Samsung encryption anyway and it has not been updated to work with any AOSP decryption higher than 1.1 Change-Id: I2d9c6e31df50268c91ee642c2fa090f901d9d5c9
2014-11-18Tweak 5.0 L decryptEthan Yonker1-15/+0
Mount the vendor partition if it exists so we can use any proprietary files we may need. Relocate auto decrypt when default_password is in use to after all partitions are added so that we can mount the vendor partition. Change-Id: I93455a35695779f53ef57a82d3d45c7216c13639
2014-11-12Add lollipop decrypt supportEthan Yonker1-1/+18
Kang in cryptfs.c and cryptfs.h from vold. Use TW_INCLUDE_L_CRYPTO := true to enable. Ramdisk must contain the normal fstab file in the root in the usual format of: fstab.{ro.hardware} For examble for Nexus 5: fstab.hammerhead Or on many Qualcomm devices: fstab.qcom Tested against Android 5.0 lollipop on Nexus 7 2012 grouper. Not sure if or how this will work when we are dealing with a device with a hardware keystore. Long term we need to add a GUI element to allow entering a pattern. For now you can decrypt a pattern unlock by converting the dots to numbers in the following format: 123 456 789 So an upper-case L would translate to 14789 as a password entered on the keyboard. Change-Id: I02c29e1f1c2eb29bf002c9fe0fc118357300b5b3
2014-11-04fix some compiler warningsthat1-3/+3
Change-Id: I23c490e6228b0fcf656c76ac314c69508ba2329d
2014-10-20Do not set contexts during a factory resetEthan Yonker1-6/+2
We should not need to set or change the contexts of the media folder when doing a factory reset. We should only do this when we need to recreate the media folder. Change-Id: I9f9918743d687b0aa0eb1e50747677f883037047
2014-10-14Fix wiping crash when block device is not presentEthan Yonker1-0/+5
Especially with /sd-ext, trying to wipe when the device is not present causes a seg fault in the make_ext4fs function. Check to make sure that the block device is present before trying to wipe. Change-Id: I91973b5b832c9edbce81d61a271e84363c19e6c5
2014-10-08mtp: cleanup, fixes and performance improvementsthat1-13/+3
- use std::map instead of linked list - read directories on demand - fix writing zip files to storage root - fix creating directories - lots of minor fixes - simplify generation of storage IDs and make them spec compliant Change-Id: I2137c27549ddbdc58466f2e3aeda464fac70a3c5
2014-10-08Attempt to fix md5 issue with backupsCaptain Throwback1-0/+2
thanks @bigbiff for the suggestion Change-Id: Ie9b55537b7fa300461b015d2b9523d4250e755a9
2014-09-20Attempt to automatically identify data/media devicesEthan Yonker1-27/+35
Change-Id: Ia3007fbced9ce3bc94efdb3dacc582a5e68a49a4
2014-09-03add mtp responder to TWRP.bigbiff bigbiff1-6/+28
Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
2014-07-09Track backup and restore progressEthan Yonker1-22/+82
Track backup and restore progress based on the sizes of the files as they are being added to the tar backup file. Update the progress bar based on the sizes of the files. Change-Id: Idf649efa1db3e91830b4b2add86203a3f30042ff
2014-06-13Do not restore file system on data/media devicesEthan Yonker1-3/+17
Change-Id: I600e7e9ce89621400531bceb472387aafc0d6ed8
2014-06-04Whitespace and minor code cleanupMatt Mower1-4/+4
This is by no means comprehensive, but is quite a bit better already. Change-Id: Ibc8654a5dfb0eec39cbd0b64bdb52bb4fbfe2f7e
2014-06-04Add options to repair or change file systemEthan Yonker1-1/+95
Change-Id: I9043e98e1e1ed4722f05c13a60b43d2d0bf739f6
2014-04-16Support alternative .android_secure locationMatt Mower1-0/+2
Some devices (jewel, m8) have .android_secure at a non-standard location. Allow a different partition to be specified as the home of .android_secure using the fstab flag 'andsec'. Using the /data/media variant of jewel as an example, recovery.fstab or twrp.fstab could be edited like follows: /external_sd vfat /dev/block/mmcblk1p1 flags=display="MicroSD";andsec Note, this is NOT a method to move .android_secure in your ROM. Your ROM must already write to this alternative location. Change-Id: I3a6e4e63aaddb35870b79e80938b0f9c2c902443
2014-04-04Allow building of an OEM friendly TWRPEthan Yonker1-0/+7
Disable theming Disable creating the TWRP folder for the settings file Change factory reset on data/media devices to a full wipe Change-Id: I3104282b5dd3f55dfff7c8cf39c72750af08563d
2014-04-03Stop printing Unable to mount to console if storage is removable. We will still print tobigbiff bigbiff1-1/+1
recovery.log Change-Id: I19e3df2e977e09e222733f13324051334982b05d
2014-03-31Remove deprecated tar exclude functionalityMatt Mower1-5/+1
twrpDU::check_skip_dirs() handles skipped folders now. Everywhere twrpTar::setexcl() is being used to exclude files eventually calls createTarFork(), which in turn calls Generate_TarList(), which checks check_skip_dirs(). Change-Id: Ibbc4eb2eb89863ccb2a15f5a3b5092fb10fcbcc0
2014-03-30Fix /data backup size if contains media subdirsMatt Mower1-2/+0
/data/*/media directories are mistakenly being excluded from the size calculation. Change to absolute dir exclude so that only /data/media is excluded. Change-Id: I6e97604d44e6ea2bdf7dfd8c68a2f90ba6d44415
2014-03-10Check to ensure that selinux_handle is populated before usingDees Troy1-1/+1
Change-Id: I6de4c5db3e3183229d7029fc72b957c7ef61f23a
2014-02-28Restore capabilities to run-as binaryDees Troy1-2/+29
Change-Id: I9e2b8e9b69c94b94c57143c04b950530490ec33e
2014-02-26Check crypto footer before offering to decryptEthan Yonker1-8/+40
Verify that we have a valid footer with proper magic before setting things up for decryption to help prevent user confusion when dealing with data partitions that fail to mount. Also check to make sure that the block device for /data is present. Change-Id: Ie87818fe4505a8bf71df7d3934c114e7328ef3ca
2014-02-25Remove unneeded loggingEthan Yonker1-1/+0
Change-Id: I5c7d104689ed2b578b463a6be55b3688dcc4c01a
2014-02-10Move DataManager functions out of twrpTar.cppEthan Yonker1-31/+15
Change-Id: I943318afe787ff4ede724fa0bc77ebc6a3ba0c8b
2014-02-09Fix ext4 wiping when no SELinux contexts are definedEthan Yonker1-3/+12
Change-Id: I900f42892d47f54b573cc1dbfb551ed2a8f9e8b9
2014-02-07Additional mount function call without mount optionsDees Troy1-1/+1
Example: f2fs on Moto G needs fsflags="inline_xattr" in the stock ROM but the Google Edition uses ext4 which fails to mount with that option. Change-Id: I01bce214e7f15e43e66ac35729fd3521609ffad3
2014-02-07Restore contexts when doing mkdierhier in libtarbigbiff bigbiff1-0/+15
Do a restore of loaded file contexts to /data/media directory. This will help denials to be prevented when internal storage is wiped. Change-Id: Ie49bbfa48d2f3ee4f08376d9c1877b92c051017c
2014-02-05Fix error message on split backupsEthan Yonker1-6/+0
Change-Id: I9effd57c2b4d28c3bd9ca1045a0bb0ac8c958245
2014-02-03Improve android secure handlingEthan Yonker1-12/+1
Change-Id: I9e1c7f4a8353b7be51e1a54bf5d506c9dce70da2
2014-02-03Refactor twrpTar to use TarListDees Troy1-28/+11
Eliminate the use of tarDirs and Generate_MultipleArcives in favor of Generate_TarList so that we have one method for backup creation instead of three. Change-Id: I267937b6e40b32d43fbac8b4cca82f7468d4f94c
2014-02-03Clear the relative directory before passing on to twrpTar with the static du object. Otherwise we will not backup /system/media etcbigbiff bigbiff1-2/+4
Change-Id: Ib62af6ad8596aa18bf48cb750e2ecf442dadc627
2014-02-03Add option to set flag for storage=0Ethan Yonker1-2/+14
Change-Id: I46b94d55fc649a2abf27569ccf99aabb2822d663
2014-02-03ifdef some file system options that are not available in older treesDees Troy1-0/+8
Change-Id: I11a7e441f7fe4e556a5349822150493de90095f1
2013-12-19Create a TWRP Disk Usage Class to retain state about a directory and whether we should skip it in other classes like twrpTar.bigbiff bigbiff1-14/+14
Moved Get_Folder_Size to this new class. Change-Id: If0a0220f900eb109581f2eeaf7b76e3f7d6886f1
2013-12-19add support for fsflags= option in twrp.fstab fileHashcode1-2/+70
example userdata line (as needed by MotoX): /data f2fs /dev/block/platform/msm_sdcc.1/by-name/userdata flags=fsflags="inline_xattr" Code for parsing flags/options originally based on AOSP fs_mgr sources. Change-Id: I5fb2b5d5cdd08137e6bf71f0085a3f8aebd889a8
2013-10-24Update licenses to all matchDees Troy1-21/+17
Change-Id: I3be70a897e563658736b2dec3a9ea2697b69b225
2013-10-24Fix spelling errorDees Troy1-2/+2
Change-Id: Id932ce1b99dee85feb788c513acad3384af6459e
2013-10-23fix getting and setting contexts in selinuxbigbiff bigbiff1-0/+9
recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-10-22Update licenses to all matchDees Troy1-21/+17
2013-10-18Fix spelling errorDees Troy1-2/+2
2013-10-17fix getting and setting contexts in selinuxbigbiff bigbiff1-0/+9
recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-09-12Add TWFunc::Exec_Cmd() with no 'result' agrumentVojtech Bocek1-24/+22
Signed-off-by: Vojtech Bocek <vbocek@gmail.com> Change-Id: Id8acff1ac9b3c7e4b562c80562a8ff42a1d132b9
2013-09-06Add more args to make_ext4fs commandDees_Troy1-1/+4
2013-08-30Initialize TWPartition::User_Rm_Rf to false in constructorVojtech Bocek1-0/+1
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-30implement "usermrf" fstab flag to force rm -rf * deletion on specific partitionsHashcode1-1/+3
Change-Id: I58f4a8cedf31e6b6efd88f96a43ed525603ae311
2013-08-30Better compatibility by fixing up ext4 & selinux flagsDees_Troy1-5/+1
2013-08-29Initial f2fs supportDees_Troy1-0/+29
Need to add this to your source tree: https://github.com/razrqcom-dev-team/android_external_f2fs-tools Change-Id: I3ee9ebbb617259655518f8ea356ce7b8c246cd4d
2013-08-28skip checking size on linksbigbiff bigbiff1-0/+2
skip google music cache Change-Id: I75d6fd0e17140d12cb2c6d335e8ff73a6f871aa2
2013-08-24Unify indentation and little clean-up in TWRP filesVojtech Bocek1-25/+25
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-24Add SELinux supportDees_Troy1-1/+19
Change-Id: I11e1a3d018d921d96ba08915925b14bf633be6ed
2013-08-23Fix AOSP decrypt when TouchWiz code is presentDees_Troy1-1/+3
2013-07-01Properly free blkid_probe in TWPartition::Check_FS_Type()Vojtech Bocek1-1/+3
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-07-01Fix MTD MountingDees_Troy1-15/+36
Pulled part of change from kokotas in this patch set: http://review.teamw.in/#/c/586/ Change-Id: If1c5b1563df16f9c561c94f61010f6a99f36efa0
2013-07-01Fix some issues with wipe partition listDees_Troy1-1/+4
Change-Id: Ie7d5878faf86b8fa824b72211be7fd3596b471d7
2013-06-22Support encrypted backup filesDees_Troy1-18/+49
Also includes features merged from: Update twrpTar by kokotas Revised function entryExists(). Added function to get archive's uncompressed size. Added option to exclude item(s) from the archive. Revised forks() http://review.teamw.in/#/c/590/ Change-Id: I01fa2c81643161984eff2625247af75990684bd9
2013-04-08Improve backup list resultsDees_Troy1-1/+0
2013-04-08Improve automated handlidling of partitionsDees_Troy1-3/+5
2013-04-04Move all AOSP code out of recovery binaryDees_Troy1-120/+120
Improves license compatibility between GPL and Apache Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
2013-03-30Add partition list GUI elementDees_Troy1-22/+101
Add partition list GUI element and update backup, restore, mount, storage selection, and wipe sections of GUI and partition manager code to reflect the new GUI element. Update ORS engine to handle new backup and restore setup. Fix a bug with decrypt. Add 1080x1920 layout. Change-Id: Iaa2f44cb707167e66f935452f076ba00e68a2aa4
2013-03-17trying to fix md5bigbiff bigbiff1-3/+19
Change-Id: I4ec037f76aa965bc818afe924942adbe9a080b36
2013-03-07use md5.c for computation of md5sumsbigbiff bigbiff1-3/+7
create a framework for computing digests and reading digests in TWRP add space for backwards compatibility with bb md5sum Change-Id: Ia18e3f430eed5eba22e5052d39b9b8d88ecd4536
2013-02-25use libblkid to get filesystem typebigbiff bigbiff1-58/+14
we can now use libblkid to detect exfat
2013-02-19Add MTK6575/6577 EMMC partitions backup supportigoriok1-3/+29
taken from https://github.com/mrjavum/Team-Win-Recovery-Project/commit/140ff0cde8ad2236caf7bcd480d257d74d8b85bc "sorocean.gor@gmail.com" Change-Id: I1a97160c73c7a0bab0535e938d6b35dc09585037
2013-02-18change libtar to fork instead of pthreadbigbiff bigbiff1-5/+5
Conflicts: twrpTar.cpp
2013-02-07Add write buffer for tar writesDees_Troy1-1/+1
update fuse to 2.9.2 catch return from unlink so that we don't print error messages when things work Change-Id: I1115039a0fa5d9d73f78ef1abd79755d7ffd9d96
2013-02-01Fix fail over to vfat from exfatDees_Troy1-33/+60
Fix issues with MD5 checking using chdir and leaving the working dir in a subfolder that prevented unmounting sometimes. Change-Id: I01a563d722f474297ed3f7a30064c3a61748ade3
2013-01-28exFAT improvements, fixesDees_Troy1-3/+11
Move Exec_Cmd to libcrecovery __popen Provide opt out build flag for exFAT Default fstype to exfat on external storage if exfat support is present and fstype is vfat or auto Fix invalid unmount errors Improve handling of unencrypted sdcards on Samsung devices
2013-01-28Fix subpartitionof flagDees_Troy1-1/+1
2013-01-24change tar create to pthreadbigbiff bigbiff1-8/+18
Change-Id: I5a33d207ec6683de20da37e6f4f174c67785fc52
2013-01-20Remove sockets and FIFOS when removing filesbigbiff bigbiff1-1/+1
2013-01-18Fix handling of blkid outputDees_Troy1-15/+14
Fixed handling of blkid output when the output spans multiple lines and the TYPE field ended up on next line.
2013-01-17Save version to cacheDees_Troy1-0/+3
2013-01-17ORS engine fixesDees_Troy1-1/+3
Fix backup to not error when a non-existant partition is given. Fix restore to run when no partition parameters are given. Ensure that ORS runs after decryption and that zips install. Fix a problem with the fake internal sdcard not mounting to /sdcard on data media devices.
2013-01-15Add flag for retaining layout versionDees_Troy1-38/+50
Needed on Sony mint (Xperia T) as the /data/media folder is a separate partition and normal data media wiping is not appropriate for this device but the layout version file needs to be retained for Android 4.2 multi-user.
2013-01-14Check to ensure that external is encryptedDees_Troy1-1/+3
2013-01-10More Samsung sdcard crypto fixesDees_Troy1-1/+14
2013-01-09Fix wiping problems and save ecrypt keyDees_Troy1-2/+30
Fix problems with the wiping of data/media devices Save and restore the ecryptfs key for external sdcard on Samsung encrypted devices.
2013-01-09Improve remounting sdcard with ecryptfsDees_Troy1-2/+20
2013-01-09Add libtar to TWRP instead of using busybox tarbigbiff bigbiff1-131/+130
Add proper mkdosfs tool Add fuse to TWRP Add experimental exfat-fuse to TWRP Convert all system() functions to use new Exec_Cmd function
2012-12-21Improve handling of undecrypted encrypted /dataGary Peck1-4/+15
- Until the encrypted partition is decrypted, treat it as a disk image instead of a filesystem so that it is properly backed up using dd. - Make Partition::Wipe() use the filesystem from fstab for disk images so that wiping an undecrypted /data makes it a plain unencrypted partition again. Change-Id: I78db977d6348cfa66b0cfbc492fb5776f84db48d
2012-12-21Reset partition flags when the partition is wipedGary Peck1-21/+34
Change-Id: I6c4cee5b038fd0c39c8723412dd8f421f7794a00
2012-12-18check backup image size before restoringGary Peck1-1/+14
Change-Id: I206d34936388c1b072eaaec50e0492710cb80f2e
2012-12-18Fix handling of MTD partitions during mountDees_Troy1-1/+19
2012-12-12Add ignore blkid flag for TransformersDees_Troy1-2/+6
Change-Id: I8f2b5b68a8c3ede74858d53002efab997174ee65
2012-12-12Restore text display during restoreDees_Troy1-0/+2
2012-11-22restore based on backup type, not destination typeGary Peck1-40/+49
Change-Id: Ie44958a148d00cadd2ba3c51255f7fd9d8a651e7
2012-11-15Fixes for multi-user in 4.2Dees_Troy1-9/+17
Also fixed inability to delete backups with a space in the name. Change-Id: I2f6639d33caa3c4542960f76adbd59b25ab64f5d
2012-11-14add exfat to partitions.cppbigbiff bigbiff1-0/+1
2012-10-16Initial BML support (ext4 only)Dees_Troy1-4/+11
2012-10-14Handle storage devices that are slow to mountDees_Troy1-0/+15
2012-10-13Remove unneeded duplicate codeDees_Troy1-41/+0
2012-10-13Track whether a partition is mounted during refresh sizesDees_Troy1-5/+18
and leave it mounted or unmount based on prior mounting status
2012-10-12Change backup size check for ddDees_Troy1-2/+2
2012-10-12Fix restore of multiple archivesDees_Troy1-1/+1
2012-10-08Fix derp with alternate storageDees_Troy1-1/+1
2012-10-01Fix error message on encrypted devicesDees_Troy1-1/+8
2012-09-28Revert busybox for CM7 compatibility, add exclamation point to format dataDees_Troy1-3/+5
2012-09-27Update sdcard partitioning to C++Dees_Troy1-9/+1
2012-09-27Port reboot functions to C++Dees_Troy1-1/+0
2012-09-27Handle mountable boot partitionsDees_Troy1-2/+10
2012-09-26Backup size for special partitions that are imagesDees_Troy1-0/+24
2012-09-26Fix problems with MTD devicesDees_Troy1-7/+2
Also improve handling of MTD names
2012-09-26Add backup size checkingDees_Troy1-7/+20
Converted bootloader.cpp to TWRP and removed AOSP fstab parsing from startup
2012-09-26Convert makelist to C++Dees_Troy1-2/+3
2012-09-26Unify portrait layouts againDees_Troy1-1/+13
2012-09-24Update tablet layouts with ADB sideloadDees_Troy1-0/+1
2012-09-21Fix special partition handlingDees_Troy1-2/+2
2012-09-21Add android_secure supportDees_Troy1-17/+82
2012-09-20Various fixesDees_Troy1-0/+7
Modify AOSP mount and wipe functions to use Partition Manager. Update wipe code to reset the log file index when wiping cache. Add ADB sideload to 540x960 theme.
2012-09-18Cleanup extra-functionsDees_Troy1-4/+31
2012-09-18Improve backup and restoreDees_Troy1-13/+50
Add in archive splitting support
2012-09-17Update backup and restore code, adb sideloadDees_Troy1-88/+178
Fixed a problem with using make_ext4fs by making its lib a dynamic lib. Added ADB sideload zip install feature - no way to cancel it yet. Improve backup and restore code.
2012-09-14Add wipe functions, compiles in CM7, text shows in UI, zips installDees_Troy1-98/+353
Zip install works, had to move mincrypt code into TWRP to prevent a crash when checking the zip signature. Added wipe functions Made it compile in CM7 Made text show up in console and logging
2012-09-11Zip install works againDees_Troy1-6/+26
2012-09-10More Partition Manager functionalityDees_Troy1-9/+19
2012-09-10Improve storage size code, mount, unmountDees_Troy1-62/+197
Add flag parsing from recovery.fstab
2012-09-07Add processing of fstab, mounting, and decryptDees_Troy1-12/+510
2012-09-05TWRP-ify AOSP codeDees_Troy1-0/+193
Pull in most TWRP sources Stub out partition management code Make it compile -- probably will not boot Kind of a mess but have to start somewhere