Commit Graph

196 Commits

Author SHA1 Message Date
Ethan Yonker
483e9f45b7 Improve sdcard partitioning process
-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-14 17:40:43 +01:00
Greg Wallace
b39e6c6047 ntfs-3g: Fix cm-13 compatibility
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
2016-01-04 07:25:24 -06:00
Olivier K.
94b06502b2 Remove no-op
Change-Id: I2bb2c44dd97974fa3cc19ccb6c6c7f0c3ef9bc58
2016-01-04 15:16:19 +02:00
Xing
0af1ac13d1 do not include stlport headers unless link to it
Change-Id: I8344d270ddb601694b5fef0fa7b22ea437030728
2015-12-23 22:36:41 +02:00
Greg Wallace
36ade45b1b Add default brightness control
This lets user set the default brightness so user doesn't cook
their phone on first boot or loss of settings file, while
still maintaining the ability to turn brightness to max if
desired.

Change-Id: Ia801fba46014335148ec573a0b0bbdf0a3ca60ae
2015-12-23 12:30:24 -06:00
Matt Mower
09ef1e4109 exfat: Update to 1.2.2
Change-Id: I160389afa074270c398aeb771845500f2445838a
2015-12-23 09:56:56 -06:00
Matt Mower
80f7b361f0 exfat: Build fsck and update path to mkfs
* Usage of fsck.exfat is already included in partition.cpp, but the
  tool is missing.
* Update the path to mkexfatfs so the button is available when changing
  filesystem.

Change-Id: I5f4e27357c6b5a8606043d1bdc2488cc83e55d90
2015-12-22 15:26:01 -06:00
Matt Mower
047723c5aa selinux: Only union sepolicy in SDKs 21,22
Manual union is not needed in Android 6.0+.

Change-Id: I7e321fb90b4333da349cc8ad8d2d78d990258b65
2015-12-22 11:59:27 -06:00
Matt Mower
1777cdc93c Remove unnecessary quoting from twres path
The C flag defines already use -DVAR=\"..\", so stripping these extra quotes
should not affect those defines.

The makefile does not need the quoting at all.

Makefile example output...
before: mkdir -p (omitted)/recovery/root"/twres/"
after:  mkdir -p (omitted)/recovery/root/twres/

Change-Id: I8f557662eb18b5ea40b63bc055d12be4440251e6
2015-12-22 11:46:04 -06:00
Matt Mower
582949125c f2fs: Update make rules for CM compatibility
* Make sure fsck.f2fs and mkfs.f2fs are built for CM12.1/13.0
* Add CM13.0 rule for relinking mkfs.f2fs
* Minor cleanup of nested if/else in prebuilts

Note on CM SDKs: 3=cm-12.1, 4=cm-13.0
I'm not yet sure whether it is possible that the CMSDK increments
within the same branch of CM.

Change-Id: I7b521159a8b5d0e0ea639f5e0fdd885100612df0
2015-12-22 11:25:34 -06:00
Ethan Yonker
74db157b94 Multiple Language Support
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-12-19 08:31:01 -06:00
Matt Mower
18794c820f Update dosfstools
* 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-26 06:09:55 +02:00
Ethan Yonker
5046857ceb Fix rules for libstlport
Change-Id: I571e906173c9e70de97e3cfefd10da5137dba4d4
2015-11-09 11:56:17 -06:00
Andrea Mennillo
f591c87993 Fixup union sepolicy
This change solve two issue:
1) Policies related to recovery should be only included in recovery
policy
2) In CM trees the sepolicy dir was always bootable/recovery-
twrp/sepolicy, even if recovery path was bootable/recovery

Change-Id: I9466d22293074ba5f5240abe8b97a5d1bf30982d
2015-11-05 20:58:39 +02:00
Ethan Yonker
58b09f1a36 Fix SELinux issues for some devices
Reinstate some SELinux stuff in the default init.rc (noticed by
Kra1o5)

Add permissive.sh script to dependencies list for CM trees.

Change-Id: I36ade54378c413081d202002488309af35486d5f
2015-10-26 12:42:26 -05:00
that
8e213fdf08 fix build in Omni 4.4
Change-Id: Ida3984a6b774c2da12342d48d8644cd18de7396c
2015-10-22 08:10:38 -05:00
Ethan Yonker
11309e912d Union sepolicy within TWRP to make SELinux permissive
This patch set should make it easier to build TWRP in non-Omni
trees as it allows TWRP to modify the sepolicy instead of having
to merge a patch in external/sepolicy to meet TWRP's needs.

Change-Id: I73205343556abb0852ff4c5f8cbf293d840b95d9
2015-10-16 22:49:19 +02:00
Ethan Yonker
c798c9cd24 Merge up to AOSP marshmallow-release
In order to maintain compatibility with older trees, we now have
minadbd.old and minui.old. I had to use a TARGET_GLOBAL_CFLAG to
handle ifdef issues in minui/minui.d because healthd includes
minui/minui.h and there was no other alternative to make minui.h
compatible with older trees without having to modify healthd rules
which is outside of TWRP.

Note that the new minui does not currently have support for qcom
overlay graphics. Support for this graphics mode will likely be
added in a later patch set. If you are building in a 6.0 tree and
have a device that needs qcom overlay graphics, be warned, as off
mode charging may not work properly. A dead battery in this case
could potentially brick your device if it is unable to charge as
healthd handles charging duties.

Update rules for building toolbox and add rules for making toybox

Use permissive.sh in init.rc which will follow symlinks so we do
not have to worry about what binary is supplying the setenforce
functionality (toolbox, toybox, or busybox).

Fix a few warnings in the main recovery binary source code.

Fix a few includes that were missing that prevented compiling in
6.0

Change-Id: Ia67aa2107d260883da5e365475a19bea538e8b97
2015-10-09 11:15:29 -05:00
Ethan Yonker
b81d905165 Add ntfs-3g support
Add support for mounting ntfs via ntfs-3g and support for wiping
and repairing ntfs partitions.

Change-Id: I82dc4626f459bb93b86eb9ebba64ad3a6560781b
2015-07-14 16:54:04 +02:00
Matt Mower
ec009e8cd4 Allow devices to override USB init
This enables devices to provide their own USB configuration. The
contents of init.recovery.usb.rc can most simply be modified and
included in a device's init.recovery.${ro.hardware}.rc.

Use option:
TW_EXCLUDE_DEFAULT_USB_INIT := true

Rationale: Some devices handle USB pid switching in the kernel. In this
case, USB init provides switching functions which differ from the
standard on property:sys.usb.config=xyz. Other devices should not see
USB attempt mtp,adb mode when TW_EXCLUDE_MTP is set.

Cherry-picked from android-5.0

Change-Id: Ief0fcaf46a1782102166fc1b733a34b1a1ba0802
2015-07-14 16:48:43 +02:00
Agontuk
a29361a8e6 Don't try to read temparature file if TW_NO_CPU_TEMP is set to true.
Otherwise, recovery log gets filled up with
"I:Cannot find file /sys/class/thermal/thermal_zone0/temp"

This also fixes build warnings due to duplicate definition of TW_NO_CPU_TEMP.

Change-Id: Ib7fdcd103d6684249c38c8b14ec85f2faba158f6
2015-06-01 02:56:19 +02:00
Matt Mower
f746dbb054 Only include uncrypt if not in system/core
Some android trees have uncrypt in system/core (cm-11.0). This breaks
building recovery since two modules of the same name conflict. Only
include the local copy of uncrypt if it doesn't already exist in
system/core.

Change-Id: Ie2d7cdedf0d4c9ad148c43b317d1f22d1e50e1f7
2015-05-19 21:08:46 +02:00
Tom Marshall
56fe5e71e5 recovery: Add lz4 libs if available
* Required by transparent compresssion in make_ext4fs.

Change-Id: I566c9e1281cc0dd725e96db32da0a1c3c000030e
2015-05-19 21:06:12 +02:00
Elliott Hughes
8fd86d77f1 Move the menu header out of the menu.
This makes it easier for us to deal with arbitrary information at the
top, and means that headers added by specific commands don't overwrite
the default ones.

Add the fingerprint back, but broken up so it fits even on sprout's
display.

Change-Id: Id71da79ab1aa455a611d72756a3100a97ceb4c1c
2015-04-13 15:46:15 -07:00
Elliott Hughes
ec28340cf3 Move "Mount /system" to the main menu.
Everyone's adding secret key combinations for this anyway, and it's
very useful when debugging.

Change-Id: Iad549452b872a7af963dd649f283ebcd3ea24234
2015-04-10 10:01:53 -07:00
Elliott Hughes
9e7ae8a626 Move default implementations into Device.
The current abstract class was a nice idea but has led to a lot of
copy & paste in practice. Right now, no one we know of has any extra
menu items, so let's make the default menu available to everyone.

(If we assume that someone somewhere really does need custom
device-specific menu options, a better API would let them add to
our menu rather than replacing it.)

Change-Id: I59f6a92f3ecd830c2ce78ce9da19eaaf472c5dfa
2015-04-09 13:40:31 -07:00
Ethan Yonker
4f6a976212 Make TWRP compile for x86-64 CPU target
Also add a short while loop to wait for fb0 to be created as was
needed on the x86-64 target for the Android emulator.

Change-Id: Ib1b87bea028ac3eac0541283334a0157cdfbce11
2015-03-13 17:20:57 +01:00
Ying Wang
5a50b1bce5 Install the recovery binary directly to the recovery image.
This eliminated the previous hack, that doesn't work reliably with the
"LOCAL_REQUIRED_MODULES := mkfs.f2fs".

Bug: 19666886
Change-Id: I1f0a2d41129f402c0165f3b86b6fda077291f282
2015-03-10 11:58:37 -07:00
Dan Albert
f3a5726919 Kill of most of the remainder of minadbd.
I think everything left now is here to stay (services.c might get
massaged in to libadbd if it gets refactored).

Bug: 17626262
Change-Id: I01faf8b277a601a40e3a0f4c3b8206c97f1d2ce6
2015-02-19 15:41:35 -08:00
Dan Albert
1ddd350504 Use headers from adb.
adb.h has diverged a bit, so that one will be more involved, but these
three are all trivial, unimportant changes.

Change-Id: Ief8474c1c2927d7e955adf04f887c76ab37077a6
2015-02-18 16:14:16 -08:00
Dan Albert
8f1bfead3f Lose USB transport code to libadb.
Bug: 17626262
Change-Id: If41031ba20a3a75fa510f155c654a482b47e409d
2015-02-18 15:11:29 -08:00
Elliott Hughes
5db3f97877 Merge "Fix build when TARGET_USERIMAGES_USE_EXT4 is not defined" 2015-02-11 01:37:49 +00:00
bigbiff
7abc5fe195 Add cancel backup capability.
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-27 15:07:19 +01:00
Dan Albert
eaeb55f745 Merge "Start losing code to libadb." 2015-01-27 00:51:09 +00:00
Adam Langley
6ed899a9b6 Remove superfluous OpenSSL include paths.
This include path was needed because system/vold/cryptfs.h included an
OpenSSL header just to get the length of a SHA-256 hash. This has been
fixed in https://android-review.googlesource.com/#/c/124477/1.

Change-Id: I06a8ba0ee5b9efcc3260598f07d9819f065711de
2015-01-22 16:47:36 -08:00
Dees Troy
3454ade92d Use /twres instead of /res for theme resources
AOSP and other ROM trees now do a rm -rf of the res folder during
the ramdisk creation process that removes the TWRP resources.
Using /twres instead of /res works around this issue making TWRP
more compatible with AOSP and other build trees.

Change-Id: I0d4c7e06ca381ac5aa0069b6f2b8c47f7dec49e7
2015-01-22 15:21:27 -06:00
Ethan Yonker
1db509094e Remove mtdutils source from libaosprecovery
Change-Id: I836ae4491f8da75fd13e73193774677e26daf16d
2015-01-05 09:12:59 -06:00
bigbiff
7b4c7a681c Update blkid to 2.25.0
Break libblkid into 4 libraries: libblkid, libuuid, libutil-linux and libfdisk.

This should help in later patch updates.

Change-Id: I680d9a7feb031e5c29a603e9c58aff4b65826262
2015-01-05 04:38:42 +01:00
Ethan Yonker
2d11d498ca Fix compiling of dosfstools for arm64
Change-Id: If99d0be4b73cdeb388c6cb1b35a215d3b8b3b58d
2014-12-12 11:43:21 -06:00
Ethan Yonker
4b94cfd391 Attempt to set the proper uid/gid/contexts on new files and dirs
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-12 09:20:42 -06:00
Dees Troy
b47f28b05a Fix generating symlinks for older trees
Symlinks for unpigz, toolbox, and busybox were not generating in
older trees.

Change-Id: I3ca2a2047510954e66fb3cf49eef6af713d3268e
2014-12-12 15:20:55 +01:00
Ethan Yonker
738be7a3ff Use one mizip for all
The new minzip did not compile in older trees due to needing
mmap64. For older trees we will just use mmap instead. Remove all
files and code pertaining to minzipold. Updater should now build
properly in older trees as well.

Eliminate use of PLATFORM_VERSION in favor of PLATFORM_SDK_VERSION
which should be more consistent and reliable.

Change-Id: I38d2b604a73d1b17a2072c7d60e990b81ece0c10
2014-12-10 11:54:02 -06:00
Matt Mower
201727911f Fix mkexfatfs exclusion when TW_NO_EXFAT enabled
Push to android-5.0

Conflicts:
	Android.mk

Change-Id: I0b831a4e6e52e4b314751035b750e6a398cb4d2d
2014-12-10 16:40:43 +01:00
Ethan Yonker
1902c79d11 Use linker64 on AArch64
Patch Set 3: Combine into one sed - by bigbiff

Change-Id: Ice3147fae76575f6e09c7df201bcd3f949aa24ea
2014-12-09 04:32:34 +01:00
Ethan Yonker
253368a072 Reduce libs needed for decrypt and clean up old decypt files
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-12-04 17:30:16 +01:00
erikcas
1db013bf28 bootable recovery: we upgraded to 5.0.1
Change-Id: I9e2f359dd7274e1ae885f6a3b392d5ab5ca99ac9
2014-12-03 16:05:35 +01:00
Ethan Yonker
75bf041a8a Make the android-5.0 branch compile in 4.4 to 4.1
Migrate previous minzip to minzipold replacing the existing
minzipold. This will break compatibility with trees that do not
support selinux (ICS and older). Migrate former verifier files to
verifierold.

Add fuse.h to recovery source because older trees do not have it.

Add LOCAL_MODULE_TAGS where needed for 4.1 tree.

Change-Id: Iade57cb2b0115af7fce9f56aa98636b1744a1ef4
2014-12-02 10:34:15 -06:00
Dan Albert
a01ce3a229 Start losing code to libadb.
Bug: 17626262
Change-Id: I8ce7cff2b7789f39f35a4211d7120d072c05a863
2014-11-25 10:59:42 -08:00
Ethan Yonker
560e65f899 Make libmincrypttwrp a shared library
Change-Id: I8c3f084fc34b00edb4cd1b652290df8bc80ea1db
2014-11-17 11:37:20 -06:00
Ethan Yonker
4eca40d7d8 Add lollipop decrypt support
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-12 18:07:24 +01:00