- Should not be determined by whether support exists in TWRP
- Set to 0 by default if FBE is not detected
This also prevents the wrappedkey check from running
on FDE devices
Change-Id: I85d1952facdfafdaa1571fc1b11d4b4b7d9ba48e
(cherry picked from commit cf0dffce3413261f149a3565d8f27cb32490ae54)
This patch uses the loop device to mount files under
/sbin/ from /system/apex in order for the device to
use libraries or other files store inside these files.
Each apex file is mounted over a loop device into a
directory correpsonding to the apex filename under
/sbin/.
Once apex mounting is completed, TWRP will set a
property twrp.apex.loaded to true so that init
can use them as a LD_LIBARY_PATH source.
Change-Id: I69f14a969123ac9cf1afc85b6cf76836cb092fb2
Change-Id: Ica6a7d8e479bcaec8bec4483b5e8d2b45ee105fb
We are now requiring fstab v2 for android-10+ trees. You can
specify twrp flags using /etc/twrp.flags to label and
annotate partitions.
This patchset uses fs_mgr to load the super partition and build
device mapper blocks off vendor and system depending on the slot
in use. These are mapped to partitions in TWRP and allowed to
be mounted read-only. The super partition is also mapped into a
TWRP partition in order to backup the entire partition. You cannot
backup individual device mapper blocks due to the device can only
be read-only. Therefore you cannot write back to the device mapper.
Change-Id: Icc1d895dcf96ad5ba03989c9bf759419d83673a3
This reverts commit 0b25b1d79b.
Reason for revert: Changes need to be made to libtwrpfscrypt to include this patchset. Will cherry-pick this patch later and make necessary modifications.
Change-Id: I7601d7b820129709b05d9b4368573b6f1048de02
* Add CLI support using the command "twrp decrypt <PASSWORD> [USER ID]"
* Add GUI support using the menu Advanced --> Decrypt User
Change-Id: Id2681bc2b1012a0571417f7a6e0b980b1b25c61c
(cherry picked from commit 5a79f67a1b1bd1bcadeca0a4896a871646652534)
This commit is used to directly use the wrapped key
decryption when the "wrappedkey" flag is set in the
fstab.
Change-Id: I74310c3bbec378ee684a8f6d0395a9776dd22abf
(cherry picked from commit 1db943295de9728e364bf0e75bfe9f1a98d413a1)
In change I79c2855d577156670b45c10c7c7b1fcd9fece8d9 we introduced a
property to enable wrappedkey mode. This change supports an extra
`wrappedkey` flag in fstab to automatically set the property to true.
Change-Id: I4f060d4ed6b2a5680649b8746dfa7fd903fe2d35
(cherry picked from commit 40ed06e850de2dc7cc06c2e647688212563f1ec2)
This reverts commit 8a411c8d25.
* Always use "/system" to interact with the frontend and replace it
with the detected path before taking actions.
* Don't replace the pretty display name and backup name set during
processing fstab after wipe. This improves UX and ensures that the
system backup is always named system.ext4.win despite the actual
mount point is /system_root so TWRP is able to recover either SAR or
non-SAR backups.
Change-Id: Ie2594d2678d0c75ce25c0d1087d47b035b3f10e9
This will detect whether SAR is present in the currently installed
OS and set the property ro.twrp.sar accordingly.
After setting the property it will call the bootscript
/sbin/sarsetup.sh (if present) to give device maintainers the
option to do setup operations depending on SAR-status, such
as modifiyng the fstab.
If no system is detected and AB_OTA_UPDATER is defined or built with
Android 10 and upwards, it will fallback to using SAR, otherwise it
will use ro.build.system_root_image as basis for deciding whether SAR
is required or not.
The property ro.twrp.sar will also be used by
TWPartitionManager::Get_Android_Root_Path()
This allows maintaining a single TWRP-build for devices switching
to SAR for Android 10.
The default behavior (when no system is installed)
is determined by the build-flags AB_OTA_UPDATER and
BOARD_BUILD_SYSTEM_ROOT_IMAGE
Change-Id: I2a48c6c81a6ea6fad6e452c06bfbe4d9da0f1e5c
This will automatically create and remove a bind mount
/system -> /system_root/system
everytime "System" is mounted via the GUI or ORS.
This should get rid of issues with ZIPs trying to mount
the system-partition to /system on SAR-devices, while keeping
the filesystem-layout in sync with AOSP from a user-perspective.
Change-Id: I7f531d113b07c31b39d8f87edac76a7fc79075e7
This sets the system mount point to either /system_root or /system
depending on whether SAR is detected or not irregardless of what
is specified in fstab.
This removes the need to edit fstab for SAR-builds and simplifies
building unified (SAR/non-SAR) builds.
Change-Id: I154fd76f842702be9e5d09005463c8e5f1d289a4
This allows flame to boot TWRP. Still will need to work on
super partition for vendor and system access.
The plan will be to cherry-pick any updates to android-9.0
through gerrit.twrp.me to this branch as a WIP.
* Set proper SELinux context for system-as-root system, AOSP uses "/"
in fstab while TWRP uses "/system_root" so an exception is necessary.
* Skip initializing context if the target partition doesn't exist in
/file_contexts e.g. /usb-otg.
Change-Id: I8f802c34e18fb9f65bf936d11967c83a451b0493
* Otherwise no context will be initialized but existing context will be
erased and lead to unexpected behavior, e.g., device no longer boots
after restoring a system backup due to missing valid seclabel of the
system partition.
Change-Id: I60c62fdc699714bb906a40ce5e1f40299681f72a
'bootable/recovery/partition.cpp:1476:158:
error:
format specifies type unsigned int
but the argument has type unsigned long
[-Werror,-Wformat]'
if using TW_NO_EXFAT_FUSE := true;
Change-Id: Icff5893a0de746ecfa3b247dc83c74a42e04bb08
Easiest way I could find to determine if we have the old or the
new mkfs.f2fs version is to pipe the usage output to grep and
grep the output for "reserved" and redirect the output to a file.
If the file has any data in it, then we must have the old
mkfs.f2fs that uses -r.
Change-Id: I7f1ed88b577a3f9827a98f0868d8f82e4e4886ac
* For EXT2/3:
* Align mke2fs options with Android 9.0 fs_mgr_format.cpp.
* For EXT4:
* Note that make_ext4fs is still in use on Android 8.1 to workaround
a FDE encryption bug even though mke2fs has become the default
choice. The bug is fixed in Android 9.0+.
* For F2FS:
* Drop the broken "-r" option, it's never ported to O, explicitly
pass number of sectors instead.
* Keep all options aligned with Pie fs_mgr.
* Check existence before start wiping, as Wipe_EXT4 does.
* For all:
* Calculate block size at runtime, and reserve the space specified
via negative "length" option from fstab. Note that positive length
will be ignored.
* If the partition has crypto footer, and "length" is not specified
in fstab, automatically reverse CRYPT_FOOTER_OFFSET (16384).
* Remove the default crypto key location: footer, this is a bad
assumption since most partitions don't use encryption! We need to
know the real situation to decide whether to reserve crypto footer
on format.
* If the current action is "wipe" or "change filesystem", wipe crypto
footer or block device after mkfs if the partition is
unencrypted or undecrypted (e.g., wrong password).
* If the current action is "format data", unconditionally wipe crypto
footer or block device.
Change-Id: I7304a8ee703131ea4a08ab7c60334af28cac28b3
cryptfs.cpp based on CAF tag LA.UM.7.3.r1-05900-sdm845.0
Used CAF because AOSP no longer contains code for qcom's hardware
crypto.
Change-Id: I921cbe9bed70989f91449e23b5ac3ec1037b7b97
Building in 9.0 may require you to add a flag to your twrp fstab
with the fileencryption details like:
fileencryption=ice:aes-256-heh
Verify this against your device's stock fstab of course.
Change-Id: If9286f5d5787280814daca9fbc8f5191ff26a839
instead of hard-coded /system path
I updated most of the references I found,
but there might be more
For devices that have to mount system at /system_root,
this allows system to be bind mounted to /system
and detected properly by TWRP
Change-Id: I9f142fd8cec392f5b88e95476258dab9c21a9aac
Add debug capability.
Fix backup of images after tarred partitions with too much padding
Add more md5 logging.
Skip digest check if selected.
Change ADB Backup version to 3 for new fixes to image padding.
Change-Id: I0f76c0733c523717e4797d1a14c3ae47d046fc8c
* /persist can be mounted early while TWRP is parsing the fstab so
as soon as the partition is parsed, mount and adjust the time
accordingly.
* Store a backup settings file on /persist. Having a 2nd copy of
the settings file in the /persist partition allows for early
reading of the file and adjust timezone and brightness to user
preference while still on TWRP splash.
* Add the qcom ats time offset in TWRP settings file and use it
if no better ats file is found. This will also allow devices
with a persist partition, but no ats files in it, to adjust
the time offset during early boot.
* Use /persist/time/ as Qualcomm time fix source, based on
Xuefer <xuefer@gmail.com> patch:
https://gerrit.omnirom.org/c/27265/https://gerrit.omnirom.org/c/24384/
Change-Id: I6c21538eec58d87edfb639d9ce3871f33b886c1d
Includes various minor fixes for building in Android 8 trees with r23+ tag
Update FBE extended header in libtar to version 2 and include the entire
ext4_encryption_policy structure now after translating the policy.
See this post for more details:
https://plus.google.com/u/1/+DeesTroy/posts/i33ygUi7tiu
Change-Id: I2af981e51f459b17fcd895fb8c2d3f6c8200e24b
Auto detect and support both the v1 and v2 fstab formats
Support putting TWRP style flags in a separate /etc/twrp.flags file
twrp.flags format is the same as twrp.fstab (v1 with TWRP flags)
Support using a wildcard in a block device and find all partitions:
/usb-otg vfat /dev/block/sda*
Support using sysfs entries (voldmanaged) and read uevents and scan for
wildcard partitions from uevent data. (twvold?)
May not be complete for some of the newer flags found in fstabs in newer
build trees and there is a slim chance of a crash if the user removes a
removable device while TWRP is performing actions. May need to add some
kind of mutex to prevent the 2 threads from causing this crash. We need
to start somewhere though and this change is pretty innocuous when not
using a v2 fstab.
Change-Id: I617d97c7db332cbe671a9d2b8ad98b3d9c4f03cc
Restore adb backup files that TWRP made to your PC.
Put files in your backup directory to see them.
e.g. /sdcard/TWRP/BACKUPS/<sn>
Change-Id: I2c57970d77b64c39a302159041456e761c185259
This patch is to refactor twrpDigest using polymorphism
and inheritance to use the same call patterns for creating and
reading a digest. Now a library.
Use SHA2 from libcrypto. SHA2 is default if device has libcrypto.
Change string MD5 everywhere to use digest or Digest instead. Updated
string tags to digest. Translation will be required.
Switch out digest code into a driver class from partitionmanager.
SHA2 is better for digest creation due to decreased collision space
compared to MD5 and SHA1.
See https://en.wikipedia.org/wiki/SHA-2
Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f
Set Backup_FileName on adb backup to fix restore.
Set read_from_adb after EOF to return properly
from newer adb client prompt.
Create setter and getter for Backup_FileName
for openrecoveryscript.cpp which is not a
friend class.
Fix condition for twrpTar::Get_Size() and adb backup.
Change-Id: I7eb8168fa3416366b996e220cecbc0e1bcec5e8e
* It is not necessary to Remove_MTP_Storage() for a partition if an
MTP_Storage_ID has not been assigned.
* The hack to force-set tw_mtp_enabled=1 should no longer be necessary
now that we're checking whether MTP really needs to be disabled for
a volume before running Disable_MTP().
Change-Id: I1b7233eedd9da7c6be0c67fc60243f3837105173
-Change backup display name to say that we are excluding storage
-Add warning message during backup of any partition with data media
-Also eliminate unused variable from twrpTar class
Maybe this will make the people in issue 276 happy, but probably not because
they already lost their data, or because the warning text is yellow instead of
red.
https://github.com/TeamWin/Team-Win-Recovery-Project/issues/276
Change-Id: I98303fe7f6b7a25fea029637c90145258d41ee46