Commit Graph

517 Commits

Author SHA1 Message Date
Konsta
9f3de1e955 Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: I421c59cdcc81ccf591fd52966d1f10cf5d876a0f

Conflicts:
	Android.mk
2022-02-19 12:01:46 +02:00
Captain Throwback
aafc82e8e2 Partition_Property_Get: Get props from additional partitions
Use the TW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS flag to
specify a space-separated list of additional partitions
that should be parsed when trying to locate props
for overriding.

Example:
TW_OVERRIDE_PROPS_ADDITIONAL_PARTITIONS := vendor odm

Requires TW_OVERRIDE_SYSTEM_PROPS to be defined.

Change-Id: I7baf4c15628789fe525976d9de0251bba6882395
2022-01-30 21:44:35 +00:00
Captain Throwback
7460b59230 theme: clean up TW_THEME_VERSION shell command
Change-Id: I6be1f15d05e6ad53bf239674cf41173879eef37a
2022-01-29 15:59:42 -05:00
Captain Throwback
a1317fc7bb theme: move TW_THEME_VERSION to variables.h
Automatically add the current theme version to the
splash and ui xmls during the build

Change-Id: I52f8cb41fabe34a8849ecc54ece3c0fb645dcd74
2022-01-29 14:12:02 -05:00
DarthJabba9
45a8d148b5 Adding TARGET_OTA_ASSERT_DEVICE flag for custom device asserts
Should be handled via device tree's BoardConfig
Sample will be TARGET_OTA_ASSERT_DEVICE := le_zl1,zl1,lepro3,lex720,lex727,LEX720,LEX727 in BoardConfig
Only applicable for AB or VAB devices

Change-Id: I1fbe6155d3f79eee089a31dbe62ee9d04c33d65c
2022-01-23 23:35:25 +00:00
Captain Throwback
550a199e67 Add TW_QCOM_ATS_OFFSET flag to manually set time/date offset
Needed if no ats_ files are present on qcom device

Offset is the difference between the current time
and the time since_epoch

To calculate the offset in Android, the following expression
(from a root shell) can be used:
echo "$(( ($(date +%s) - $(cat /sys/class/rtc/rtc0/since_epoch)) ))"

Add 3 zeros to the output and use that in the TW_QCOM_ATS_OFFSET
flag in your BoardConfig.mk

For example, if the result of the calculation is 1642433544,
use 1642433544000 as the offset

Change-Id: I5d58125dffc3fdbfb76a5ffde4e27659376185f1
2022-01-20 21:45:42 +00:00
Konsta
438a85efcf Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: Id1d534cce0969c98e2b8b6484278342201dd562d
2022-01-12 16:55:24 +02:00
Captain Throwback
a185252c8e System_Property_Get: Allow specifying multiple prop file paths
Some OEMs include prop files in custom locations. Add these to
a list and parse when setting properties.

Use the flag TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS followed
by a semi-colon-separated list of paths (relative to /system)
where the additional prop files can be found.

The standard build.prop file does not need to be specified and
will always be parsed.

Example:
TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS := etc/buildinfo/oem_build.prop;etc/prop.default

Change-Id: Ie0e25c7d2575d928310ff1b4fc1aef44a83784ca
2022-01-02 16:02:04 -05:00
Konsta
741644b3e2 Merge remote-tracking branch 'TeamWin/android-11' into android-11
Change-Id: I7a3a43554dd1dd099ac5255a956579459759a3a6
2021-11-22 17:44:29 +02:00
Captain Throwback
4f19caa016 lptools: add to build
Use TW_EXCLUDE_LPTOOLS to exclude from build

Will only be included on devices with dynamic partitions

Change-Id: I77092344a1e31e749161cb31e6e020f6e9fc3800
2021-11-19 23:46:05 +00:00
nailyk-fr
e6b2d9fa71 add an option to exclude the TWRP app
* Allow device maintainer to exclude the twrp app and disable
   the installation prompt. Mostly the app is useless for
   every unofficially supported devices.

 * BoardConfig flag: 'TW_EXCLUDE_TWRPAPP := true'

Original commit: https://gerrit.omnirom.org/#/c/android_bootable_recovery/+/27694/

Change-Id: I0aa1fb2ebe03ceb19c766178544039a82497cdd4
2021-11-02 15:18:05 +02:00
bigbiff
e6d833aeb3 libmodprobe: globally link libmodprobe for loading kernel modules
Change-Id: Id3b99c118667279aa7806a5a5989745386b6a5b6
2021-10-18 12:23:38 +00:00
bigbiff
d04f8e0078 libmodprobe: move include to global includes
Change-Id: I288ce0dcd22d5a5a5badd2a98460cec027010eac
2021-10-02 13:47:29 +00:00
bigbiff
22851b9476 module load: attempt to load modules from /vendor
Use TW_LOAD_VENDOR_MODULES := "module1.ko module2.ko modulen.ko"
in BoardConfig to have TWRP attempt to load kernel modules during
startup. For fastboot ramdisks, TWRP will attempt to load from
the ramdisk from /vendor/lib/modules. You can have the build
system copy the modules to
$(TARGET_RECOVERY_ROOT_OUT)/vendor/lib/modules/1.1
Otherwise in recovery in boot mode, TWRP will attempt the following:
check /lib/modules (ramdisk vendor_boot)
check /lib/modules/N.N (ramdisk vendor_boot)
check /lib/modules/N.N-gki (ramdisk vendor_boot)
check /vendor/lib/modules (ramdisk)
check /vendor/lib/modules/1.1 (ramdisk prebuilt modules)
check /vendor/lib/modules/N.N (vendor mounted)
check /vendor/lib/modules/N.N-gki (vendor mounted)

Change-Id: I2dccf199e37d47cb7a7e79b0e11026d67b4e3186
2021-09-29 20:46:19 +00:00
Captain Throwback
bc2cfa36ec Add exclusion criteria for "Fix Recovery Bootloop"
Should only be included on devices that use initramfs,
i.e. legacy SAR, recovery-in-boot

Change-Id: I2408fcd993e1e381f49b3d5ae860694b2fade4d2
2021-09-16 10:42:06 -04:00
Mohd Faraz
29cab7f160 etc: vndservice and hwservice managers are required by other hals
* Export vendor paths for boot-hal as some libs are present in vendor
 * hwservicemanager and vndservicemanager are also required by health hal amd boot hal

Change-Id: I9017e0692cdb917db86629588726ba11eafd1e81
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2021-08-28 23:54:49 +00:00
bigbiff
e3742ef616 openaes data encryption: turn off by default
Until the code can be removed, we will turn off openaes encryption
of data files by default. There are many restore issues that are
caused with openaes enabled. For maintainers who want to enable it
set TW_EXCLUDE_ENCRYPTED_BACKUPS := false on BoardConfig.

Change-Id: Ie284b03c7cc4c77a0a9dbcc460817fe3fe08b839
2021-08-28 21:04:16 +00:00
bigbiff
998f839e82 super processing: use logical flag to denote super status
To support all partitions that are on the super partition
we now parse for the logical flag in fstab to denote super
status.

- Remove guards for the first character being '/'.
- Skip commented lines in fstab
- Build Backup_Display_Name from partitions in super.
The first four lines that are in fstab will be
displayed.
Change-Id: I3f8980187bd4a136257dd6eeaeddd7ea71706cd3

Change-Id: I1ee7c02f91aafb646beaf401a43bcb22fa8c8c7a
2021-08-28 17:48:23 +00:00
bigbiff
cfa875c4d4 vab support: merges and unmapping super devices
- check for merges before formatting data
- add advanced option for unmapping super devices

Change-Id: I38d4d3bbdfa071969016c3e000c86a4d03c71e45
2021-08-09 23:04:33 +00:00
bigbiff
c5012c5c88 bc: include basic calculator in ramdisk
Change-Id: Ia16fc28a234396e996e84de8496294b26053869b
2021-07-04 13:57:47 -04:00
bigbiff
5c083cc3f0 super partition: include lpdump utility
Change-Id: Ifaac3b660ae3d46d9f1589470dcf6fd7c21b8ef8
2021-06-25 22:45:22 +00:00
bigbiff
477006a4a0 fastboot: allow device to start required healthd and boot-hal services
Change-Id: Iac1d20ce26d49e7a99071c968d8c8e654e5ff1c6
2021-06-25 18:36:36 -04:00
bigbiff
799243055f apex: only mount required apex files
Since recent kernels seem to limit the number of loopback
devices to 7, we now just mount the required apex files in TWRP.

To mount additional apex files specify TW_ADDITIONAL_APEX_FILES
in your BoardConfig, for example:
TW_ADDITIONAL_APEX_FILES := "apex1 apex2"

To disable Apex in your builds use:
TW_EXLUCDE_APEX := true
Change-Id: Ib55529a4dc17ce2b737b01b86100dca3dc75e6c9

Change-Id: I3b4dfbb164838ffb126016b0d862f67d3f170bf3
2021-05-18 20:35:52 -04:00
bigbiff
a957f078be FsCrypt update: support fscrypt policies v1 and v2
This patchset introduces support decryption for Android 11.

In this update we deprecate ext4crypt. To specify the
policy version to use, use TW_USE_FSCRYPT_POLICY := 1 or
TW_USE_FSCRYPT_POLICY := 2. By default policy version will
be set to 2 if this variable is omitted.

Change-Id: I62a29c1bef36c259ec4b11259f71be613d20a112
2021-05-18 20:35:51 -04:00
nebrassy
9c1709b963 Health hal 2.1
Change-Id: I58df03c469c213e58c7152430d6f15de80d00f77
2021-05-04 11:47:45 +02:00
bigbiff
e2eae2fe74 boot-hal: add 1.1 HAL to TWRP
Change-Id: I51678c96f522e67c3681e404240dd98f6b07994e
2021-04-24 23:18:28 +00:00
bigbiff
d81833a5e5 libtwrpgui: convert gui to use new ziparchive library
Change-Id: Iea94855257c6d02c2f663c25d390cb1cfb91a727
2021-04-24 18:56:46 -04:00
Captain Throwback
8e70a11ef9 Use BOARD_SUPER_PARTITION_PARTITION_LIST for dynamic list
Simplifies code for retrieving this list rather than using
every possible specified super partition group

Change-Id: I1a3bd8e4b73ce18a176c74a52eb91d25709080f4
2021-04-24 21:25:58 +00:00
bigbiff
98203ceebe nano: make executables class
Also fix bad separator in Android.mk

Change-Id: I756f8ac42ccb604f191e9439cd7978cfa0ce0995
2021-03-03 20:39:52 -05:00
DarthJabba9
fba0cee8ed bash: add to TWRP
Change-Id: Ie1826df01ad5fe2480e96d56b2c4fd1c91449cc2
2021-03-03 20:05:14 -05:00
nebrassy
05b5405fed fixup including magiskboot and resetprop
Change-Id: I90ceb5d678bafb0679329f27f711d1732a1ae69d
2021-03-03 20:04:38 -05:00
Captain Throwback
16dd81b500 nano: Add File Manager option to edit selected file
Change-Id: Ie7d940545569e6de976d2a51666b692f3fc23798
2021-03-03 20:00:51 -05:00
nebrassy
5078965777 Include nano in TWRP by default
Use 'TW_EXCLUDE_NANO := true' to exclude from build

Will be excluded by default if 'TW_OEM_BUILD := true' is set

Change-Id: I812399ef9f3f5d3c7d4baf981924d49255c16e5a
2021-03-03 19:39:45 -05:00
Captain Throwback
6443cefc69 tzdata: add to TWRP build automatically
Fixes "__bionic_open_tzdata" errors in recovery log

Use "TW_EXCLUDE_TZDATA := true" flag to exclude from build
if needed for space reasons. Will automatically be excluded
is "TW_OEM_BUILD := true" flag is present

Change-Id: I2f4a0f3a354a32c2f4f9733b3e88beedc4773020
2021-02-15 12:29:00 -05:00
Captain Throwback
7f398f755b twrpapp: actually include in build
Change-Id: Ie0434cc66af416c1ff4dd43d07ddf606095dc34b
2021-02-15 12:28:24 -05:00
bigbiff
91bd7a7ff1 adb: get adb working and cleanup pixelflinger
- update recovery init.rc
- add libdl bootstrap
- cleanup libpixelflinger import
- logd and adbd permissive for now
2021-01-03 17:36:52 -05:00
bigbiff
673c7ae01e Merge tag 'android-11.0.0_r16' into android-10.0
Android 11.0.0 release 16 - twrp bringup patch
2020-12-16 19:06:18 -05:00
bigbiff
7ed5106932 adb backup: fix building and relink
Change-Id: Ic65284ac2b3f4f410b3ad79288e8b39f51bcc5ee
2020-12-02 18:47:28 +00:00
bigbiff
1f9e4847ce twrpinstall: create library for twrpinstall
This library will need to mirror AOSP for any changes to installing
packages. The library has been separated out in order to make importing
updates from AOSP into the TWRP project.

twinstall.cpp has been removed from the recovery binary and added to
this library. It has been refactored for libziparchive.

Sideload has been reworked to use the newer methods from AOSP on
flashing packages through adb sideload.

We are also removing old libraries for adb and verifier.

Lastly before flashing a zip or image, we want to unlock block devices
for writing so that when an OTA is flashed to the inactive slot,
the flash will succeed.

Change-Id: I6d8702fc9031ffaf9f666b4ba375dc7d9362e473
2020-12-02 13:43:42 -05:00
Captain Throwback
ddb0a40afd TWRP_REQUIRED_MODULES: add more criteria to exclude packages
Only include hwservicemanager if CRYPTO flag is set and
only include servicemanager if FBE is included.

Only include health-hal if device uses dynamic partitions

Change-Id: I056d0246e406dc9f00bda65247455741ef986a37
2020-11-11 19:00:36 +00:00
Mohammad Afaneh
2d9953ab3e Add BOARD_SAMSUNG_DYNAMIC_PARTITIONS_PARTITION_LIST group list to 'super' partition description in back-up menu
Change-Id: I08d78583e8672b38f49cef93cc26f5e7663deb80
2020-10-25 14:28:03 +00:00
Mohammad Afaneh
3150f1eeff selinux: Build required contexts modules for devices
that do not use encryption.

Change-Id: Ifda13f29b8a2569a4af7f4d8159d4460101865f7
2020-10-23 18:49:45 -04:00
Mohd Faraz
9a4ef26299 Unmount vendor after apex
BUG: prebuilt vendor blobs are being overriden by vendor partition, which causes failed to decrypt the device
TEST: after this patch vendor is no more overriding and decryption working as expected.

 * Devices using the stock or the rom based libs then it needed to add the TW_USES_VENDOR_LIBS := true in the BoardConfig

Change-Id: I3cbc7fe6df2289081e9198941cfb65a1a7e0e6a3
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-10-23 22:17:01 +00:00
Captain Throwback
49df5475db init: include more services in TWRP by default
vndservicemanager should be included with crypto support

boot and health services are needed for bootctrl and fastbootd

hwservicemanager and servicemanager should be included
regardless of crypto status

Change-Id: Ie76dac11b733c4549c2d55301cf614fe82905884
2020-10-23 21:55:18 +00:00
Ian Macdonald
160e8d3955 Improve 'super' partition description in back-up menu.
For the back-up menu, we can detail what the super partition includes by
aggregating one of BOARD_GOOGLE_DYNAMIC_PARTITIONS_PARTITION_LIST or
BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST.

We comma-separate the list and capitalise the first letter of each
dynamic partition.

Change-Id: I663eaf4f28b4591293aae21c2dd11f615f625746
2020-10-22 22:45:36 +00:00
bigbiff
df8436b51a fastboot: implement fastbootd in twrp
fastbootd is a userspace daemon that runs in the recovery
ramdisk. It allows writing single partitions to the super
partition via fastboot CLI. When TWRP sees the fastboot option
in the misc partition during startup, it will start with
the fastbootd page and fastbootd running. Otherwise it will
run recovery normally.

Change-Id: Id7b12d29ef21dbd5950dc884dd1cd788f25357f0
2020-10-21 17:47:27 -04:00
Captain Throwback
ca2ba939c9 init: add services to build
hwservicemanager and servicemanager are needed for decryption
and fastbootd in TWRP. Include these services by default since
they are standard Android services and independent of device
tree or SoC.

Change-Id: Id0ec73d9a6ca0289c7b4f67e9dcf541b2157c04e
2020-10-14 12:55:58 -04:00
bigbiff
ad58e1bfae repack: move sbin to /system ramdisk and update repacking
for android-10

This will support updating the ramdisk to a different
compression format and co-exist with magisk.

We are also cleaning up and removing non android-10
api makefile actions.

We are also moving twrp repacking to its own class. We
check the new ramdisk format and if it's different
we have magisk compress using the new ramdisk format.

Change-Id: I770030aae7797e75817178b2f0fccd9f39dc23af
2020-09-08 10:08:33 -04:00
bigbiff
7ba7500953 decrypt: AOSP 10 requires the use of fscrypt
fscrypt aosp doc: https://source.android.com/security/encryption/file-based
kernel fscrypt doc: https://www.kernel.org/doc/html/v4.18/filesystems/fscrypt.html

This commit implements the ability for TWRP to use fscrypt to decrypt
files on the fscrypt implementation. It has been implemented mostly
in a new successor library to e4crypt called libtwrpfscrypt. Most of the
code was ported from AOSP vold.

Notable updates include:
 - updated policy storage by libtar
 - lookup of fbe policies by libtwrpfscrypt
 - threaded keystore operations

Big thanks to Dees_Troy for the initial trailblazing
of encryption in TWRP.

Change-Id: I69cd2eba3693a9914e00213d4943229635d0cdae
2020-06-22 12:17:22 +02:00
mauronofrio
6d3bf891c4 Add ozip decryption for Oppo/Realme device
This function will automatically decrypt .ozip file in a .zip and it will
save the .zip in the same folder of the .ozip and with the same name.
After the decryption, the flash will start.

To enable this function you have to set a Boardconfig flag with the
decryption key like i did here:

a30625f80a

Original projects:
https://github.com/sabpprook/ozip2zip
https://github.com/bkerler/oppo_ozip_decrypt

Change-Id: Ic93243a565008c442bcf2992069b2801532ac7c1
(cherry picked from commit 0ff59845f2f8dddedb4cee9a9faf86a6294cce66)
2020-06-10 22:31:49 +00:00