Commit Graph

7673 Commits

Author SHA1 Message Date
Chaosmaster
01a17998da Add flag for overwriting properties with system values
This adds the flag TW_OVERRIDE_SYSTEM_PROPS which can contain
a ";" separated list of properties that should be overriden.

A different source property can be defined by separating
target and source using "="

Example:

TW_OVERRIDE_SYSTEM_PROPS := "ro.build.product;ro.build.fingerprint=ro.system.build.fingerprint"

This will override ro.build.product with the value of ro.build.product from system/build.prop.
And also override ro.build.fingerprint with the value of ro.system.build.fingerprint.

with their corresponding values from the system partition.

Change-Id: Ibcd3e6ed51fa7f7195ad524e606a2b9542687e55
2020-05-10 21:19:32 +00:00
Chaosmaster
461e39fe89 Add TWFunc::Property_Override(name, value) to override properties
using libresetprop

Change-Id: Ic49e187698c714f8a629d20ceddc40e823555477
2020-05-10 17:17:56 -04:00
bigbiff
aaa9e64b81 Merge "Create a flag to include resetprop in the TWRP" into android-9.0 2020-05-10 20:37:09 +00:00
Chaosmaster
f6e42ce390 Implement autodetection for SAR, based on the installed system
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
2020-05-10 15:43:56 -04:00
Chaosmaster
da97480567 Create/Remove system_root/system bind mount, when mounting System
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
2020-05-10 15:43:55 -04:00
Chaosmaster
ff4f958182 Add option to automatically unmount system before installing ZIP
This adds the option to automatically unmount the system partition
before installing a ZIP-file.
This option is enabled by default, This is usefull on SAR-devices
where system is mounted as system_root and ZIPs (i.e. Magisk)
try to unmount system instead of system_root and fail to install.

Change-Id: Id94ae658964679e23aa7fa137e07edf74ee073df
2020-05-10 15:43:55 -04:00
Chaosmaster
3b3b634365 ORS Make mount/unmount system mount system_root on SAR
Change-Id: Ibf8d4d61e6cbb132786f5f9aa23ec91b49bcab89
2020-05-10 15:43:54 -04:00
Chaosmaster
3b6827372e Set system-partition mount point to proper location
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
2020-05-10 15:43:54 -04:00
dianlujitao
58f1a63767 Properly detect system-as-root
ANDROID_ROOT environment variable is also used by other Android
components thus it should ALWAYS be /system in order not to break other
tools. On the other hand, AOSP does have a system property to indicate
system-as-root, just make use of it.

Change-Id: I7fc58a78db7abd05fac9000910169c370f5de62d
2020-05-10 15:43:53 -04:00
mauronofrio
76ef9f3c04 Create a flag to include resetprop in the TWRP
The flag is:
TW_INCLUDE_RESETPROP := true

Change-Id: I4d4d25a6d5bbd2330efd7f184d0f878a8cf0346e
2020-04-30 16:42:03 +08:00
Mohd Faraz
77a31917f2 partitionmanager: Unmount all directories mounted to same block
* Like Xiaomi's some older devices uses cust as vendor and also mounts cust & vendor simultanously

 * This patch will unmount all directories mounted to same block

Change-Id: Ic242e267a470b4d82098d847f74b807a461605c4
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-04-26 18:16:04 +00:00
bigbiff
fec60c3e33 Merge "Fix building libuuid" into android-9.0 2020-04-26 15:26:04 +00:00
Andreas Schneider
ec350e9d0d init: ueventd already needs /acct
Change-Id: Ifae7078aedc1a520ee003160fb17c8893041cb09
2020-03-30 21:02:48 +00:00
Fatih Fırıncı
901141c2eb language: turkish update
Change-Id: I9dab6ea9378f87879384e43dafb2e3ae4f733f68
2020-03-14 17:21:30 -04:00
Martin Dünkelmann
c630b3864f Fix 'system/etc/ld.config.txt' not found error
According to

https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r51/rootdir/Android.mk#260

the ld.config.txt gets generated with the vndk version as a suffix.
This behaviour exists since API level 28 (Android 9.0), if
BOARD_VNDK_VERSION is defined and BOARD_VNDK_RUNTIME_DISABLE is not
true.

The issue seems to be exist since commit
8d70eb617e in twrp.

Change-Id: I19741c29cda65ce051b7c167a946d551ce149f7b
2020-03-14 21:14:54 +00:00
Mohd Faraz
191a6948d9 crypto: fde: decrypt master key first
* Some devices like lavender, etc. getting failed to decrypt

Change-Id: I63ca05c4f87cdd17d48d4541a5a8121c736beb02
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-03-09 23:19:54 +00:00
Andreas Schneider
915bbd225e Fix building libuuid
libuuid uses flock() which requires <sys/file.h>.

Change-Id: I230a5d08ce90088d14db2f89a0843bf43029b3c7
2020-03-08 11:44:54 +01:00
dianlujitao
8a411c8d25 Fix ORS backup and restore for system-as-root
Change-Id: Ice7f2e22ded280f723c19e920a15f3e918c17264
2020-03-08 02:16:10 +00:00
Captain Throwback
a5283b3570 crypto: add more missing newlines
Change-Id: I158b2a8fee89c2543a0b809af8e278702466b106
2020-03-08 02:13:03 +00:00
Captain Throwback
f8d0e2156e openrecoveryscript: do not skip decryption even if using block.map
- Allows addon.d scripts to run that require access
  to decrypted /data (e.g. Magisk). Seems to also affect
  GApps addon.d script, resulting in non-booting system
- If decryption prompt is canceled, installation will
  still proceed (i.e. on devices where TWRP doesn't
  support encryption)
- Should resolve
  https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1478
  and possibly
  https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1459

Change-Id: Idcd397aa145577c409d5174ae3f9c48474e5734b
2020-03-08 00:31:54 +00:00
Captain Throwback
d54e1da83e partitionmanager: add /etc to Local_Path
- Prevents errors when using copy_file for
  paths starting with /etc

Change-Id: I7d52acdbc8e67a21e3d32f4793257dbdad5d82de
2020-03-04 16:55:48 -05:00
Mauronofrio Matarrese
6d5d08a1c0 Move decryption error from logerror to loginfo
Change-Id: Iffa01968dfb92d2cc91b0b6a33c87d7f270430db
2020-02-17 17:13:04 -05:00
bigbiff
2c2d559113 Merge "Removing fake error: E: recv error on uevent" into android-9.0 2020-02-16 19:46:11 +00:00
Hernán Castañón
990168bec0 bootable: read all asserts in case there are more than one.
In A/B, the device check isn´t done by the updater script, but using
metadata for it.

Let´s search if the device codename/assert is included in the string.

Change-Id: Ie856ac699aaa83de2b364bc85a510a037d36edf9
Signed-off-by: Hernán Castañón <herna@paranoidandroid.co>
2020-02-05 00:28:04 +00:00
Darth9
0864aa54ce Prevent errors caused by /data/per_boot/
Change-Id: I543723f3da4f57fb4d580661216acc1abaac883e
2020-02-01 21:27:53 +00:00
Captain Throwback
49cfb7e537 crypto: add some missing newlines
Change-Id: I6bc6b512fe6e841703229d45333421532ecebb83
2020-01-28 17:46:23 -05:00
bigbiff
15434cdeec Merge "android-5.1: use char constructor for default on c++ streams" into android-9.0 2019-12-23 23:06:23 +00:00
Mauronofrio Matarrese
9632f301c1 Removing fake error: E: recv error on uevent
This shouldn't be an error, so i hide the line about the error.

Change-Id: I3ef667435dfa843440cc594409c8d20add676576
2019-12-23 09:28:10 +00:00
Ian Macdonald
f9156eaaab Complete overhaul of Dutch translation:
* All missing strings added (ref: en.xml).
* Many strings clarified and ambiguity removed.
* Inconsistent use of language reconciled.
* XML validated by xmllint(1).
* String length validated on device (G975F).

Change-Id: I4a4c3dc5a1147a62b8c141286fc7ac432678a322
2019-12-23 00:50:53 +00:00
Alessandro Astone
5667feb0ac recovery: wipe bootloader message from index 0 when using custom offsets
* We may use a custom offset to:
   a) preserve data that oem wrote to the first bytes of misc
   b) skip recovery flags written by the bootloader (e.g. --wipe_data)

   For case a) one should set the offset 'x' to be at least greater than
   the size of bootloader_message struct (2048 bytes). If this is the case,
   then we zero out bytes x ~ x + 2047

   For case b) one should set the offset to be strictly smaller than
   the size of bootloader_message struct. If this is the case, then we
   zero out bytes 0 ~ 2047.
   This allows to clear any additional flag set by the bootloader,
   that would otherwise be forgotten in misc.
   This also guarantees that we do not involountarily wipe any data that
   the oem may have written starting at byte 2048 (coff coff LG)

Change-Id: I2d4e0702a2d8cbbef6274a87ce9499b0f69310dd
2019-12-22 21:20:48 +00:00
bigbiff
d331705daa android-5.1: use char constructor for default on c++ streams
Change-Id: I4be681c2720f62182e57237b1cfefc384235f0e1
2019-12-22 16:05:12 -05:00
Alessandro Astone
7ec5fd9e6d recovery: Move bldrmsg offset symbols to bootloader_message.cpp
* bootloader_message.cpp is the only file using
  BOOTLOADER_MESSAGE_OFFSET_IN_MISC and WIPE_PACKAGE_OFFSET_IN_MISC,
  so we can move their definitions to the cpp.
  This prevents the need to set BOARD_RECOVERY_BLDRMSG_OFFSET
  in every module that includes the header.

* Global cflags are no longer supported Oreo and up,
  so set the BOARD_RECOVERY_BLDRMSG_OFFSET via make variable

* Simplify logic, always set BOARD_RECOVERY_BLDRMSG_OFFSET.

Change-Id: I2b902bcce7f5ca13472e0ac30ac01b4991294dbe
2019-12-22 20:21:16 +00:00
Ian Macdonald
2923defaea /sbin should come first in the linker search path.
/sbin must come before any other search path when TWRP is built for a
different version of Android than the one on which it will run.

Otherwise, as soon as any of the other paths becomes available via
direct action (i.e. the user mounts a file-system) or indirect action
(e.g. the user flashes a zip that mounts a file-system), incompatible
libraries will be prioritised and loaded instead of the correct ones
from /sbin in TWRP's ramdisk.

This will cause severe disruption of the TWRP environment. Toybox and
other dynamically linked binaries will immediately cease to work; and
since Toybox provides umount, it typically won't be possible to recover
from this state without a reboot.

For example, the following occurs when a Toybox applet is run on a
Samsung Galaxy S10 running Android 10, but using a version of TWRP built
for Android 9:

android:/ # getprop ro.boot.bootloader
CANNOT LINK EXECUTABLE "getprop": cannot locate symbol "_system_properties_init" referenced by "/system_root/system/lib64/libselinux.so"...
linker: CANNOT LINK EXECUTABLE "getprop": cannot locate symbol "_system_properties_init" referenced by "/system_root/system/lib64/libselinux.so"...

Change-Id: I31fe612ebb1c7d9ad71d67be2c615caa3fbb5d6f
2019-12-05 01:54:57 +01:00
big biff
72d75b0b40 Merge "ldconfig: add /sbin to search.paths" into android-9.0 2019-12-01 01:22:18 +01:00
mauronofrio
9bf73351e5 Encryption: try wrapped key also for device without metadata support
Change-Id: I8b58e45ec0d42470226083e8003dcd8152a91af1
2019-11-23 22:29:15 +01:00
Captain Throwback
8d70eb617e ldconfig: add /sbin to search.paths
- Move commands from prebuilt to root Android.mk
- Hotfix for linker errors after https://git.io/JerWD merge
  on some Samsung device(s)

Change-Id: If628ab486689878885b696c2f5a107987092aeba
2019-11-14 11:14:06 -05:00
big biff
8c0bcc8ba0 Merge "Add ld.config.txt for Android 8.x+ trees" into android-9.0 2019-11-08 00:47:20 +01:00
SyberHexen
a895118a1f cache: Fix typo in twrp-functions.cpp for A/B devices
* without this A/B devices are writing 8MB+ uncompressed logs under persist/cache/recovery which increase in size over time. This can eventually leave persist partition OOM causing other cascading issues like crashing the modem during boot and bootloops.

Change-Id: I0f3aab0eb96804d1be8de965eb2c2e9bb83d5b56
Co-authored-by: Erfan Abdi <erfangplus@gmail.com>
Signed-off-by: Andrew Hexen <SyberHexen@gmail.com>
2019-10-29 18:28:48 -07:00
Captain Throwback
170964d5bb Add ld.config.txt for Android 8.x+ trees
- Fixes the ld.config.txt errors in recovery log which may prevent
  decryption and shell commands from working properly

Change-Id: I0e057525cdda39e8ac10115d37e2cb882b9c4844
2019-10-21 19:46:30 -04:00
big biff
e078e9cf7b Merge "Update Portuguese (Portugal) translation" into android-9.0 2019-10-19 00:21:45 +02:00
VDavid003
2034a41934 Fix typo in comment
Change-Id: I9b24d324fd61f2f0d2e85a9d123778557e14d63c
Signed-off-by: VDavid003 <virag.david003@gmail.com>
2019-10-18 22:43:20 +02:00
Vasco Machado
bdb20a9d2d Update Portuguese (Portugal) translation
Change-Id: I2adff8a76f210048edc29264652d072139d594f9
2019-10-17 16:45:59 +01:00
big biff
c1d7c35049 Merge "Persistent logs: Compress target log on storage." into android-9.0 2019-10-06 19:32:37 +02:00
bigbiff bigbiff
e3ad5346da Persistent logs: Compress target log on storage.
This update will use pigz to compress the log that TWRP stores
on persistent storage in order to help with storing logs on the
persist partition.

Change-Id: I16971b8b138b74a164b1b0835847177cfc6104e2
2019-09-18 19:17:20 -04:00
bigbiff bigbiff
0be03b3217 Encryption: try wrapped key if the first time decryption fails
Change-Id: I108b7aeea41c6b85c851f40c1c4a7e25012e2463
2019-09-01 13:38:44 -04:00
Peter Cai
05cd3f8616 ext4crypt: change to upgrade key if export fails
Add support to upgrade key when export fails with KEY_REQUIRES_UPGRADE.

Ported from
https://source.codeaurora.org/quic/la/platform/system/vold/commit/?h=LA.UM.7.9.r1-06100-sm6150.0&id=85c46eaacc60290db5e71380d89eb4d99ed67995

Change-Id: Ic64be8ade00c0b0d014370ecc9341b1ecc9b0d7a
2019-09-01 19:34:09 +02:00
Peter Cai
90edd2e867 ext4crypt: support wrappedkey for FBE
Qualcomm devices use a special `wrappedkey` mode for FBE. This is ported
from CAF
https://source.codeaurora.org/quic/la/platform/system/vold/commit/?h=LA.UM.7.8.r4-01000-SDM710.0&id=9229262d893a8592f7bc1b4e8a8dab7aad8df68c,
originally by folks at Mokee for vold
https://mokeedev.review/c/MoKee/android_system_vold/+/34102.

This patch ports the above changes to `ext4crypt`, which we can use in
recovery. Note that since we do not have `fs_mgr` in the recovery, we
cannot read the `wrappedkey` flag from fstab. Instead, similar to
`fbe.contents`, we use a special property `fbe.data.wrappedkey` to
indicate support for wrappedkey mode. Devices that need to use this
should set this property to `true` to activate corresponding code.

Change-Id: I79c2855d577156670b45c10c7c7b1fcd9fece8d9
2019-09-01 19:33:30 +02:00
big biff
69ab4a6000 Merge "fix build error in 9.0 with TW_NO_EXFAT_FUSE:=true" into android-9.0 2019-08-04 00:49:41 +02:00
Andreas Schneider
b0a0dbbab0 prebuilt: Add android.hardware.confirmationui@1.0 for /sbin/keystore
Change-Id: I62e68c137e9790392dd2fc44c2add990c2f408d6
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-07-04 00:39:02 +02:00
big biff
0bd7c59026 Merge "ext4crypt: support synthetic keys v3 on May update" into android-9.0 2019-06-25 02:01:42 +02:00