Commit Graph

110 Commits

Author SHA1 Message Date
bigbiff
437b93a087 Merge remote-tracking branch 'origin/android-9.0' into android-10.0
Change-Id: Ie850f431f0d2c39c86b9c10701676a24770ab447
2020-05-10 20:06:41 -04:00
bigbiff
63d7add7cf logd: make logd run and relink logcat
Change-Id: I5a2984ea2649bebd923d42e6b984856b36b18fbd
2020-03-31 18:00:59 -04:00
Andreas Schneider
a4e510ee54 init: ueventd already needs /acct
Change-Id: Ifae7078aedc1a520ee003160fb17c8893041cb09
(cherry picked from commit ec350e9d0d)
2020-03-30 17:06:17 -04:00
Andreas Schneider
ec350e9d0d init: ueventd already needs /acct
Change-Id: Ifae7078aedc1a520ee003160fb17c8893041cb09
2020-03-30 21:02:48 +00:00
theimpulson
d95dcd207c bootable: Move to optional tags everywhere
FAILED:
bootable/recovery/etc/Android.mk: error: init.recovery.ldconfig.rc: LOCAL_MODULE_TAGS := eng is obsolete. See https://android.googlesource.com/platform/build/+/master/Changes.md#LOCAL_MODULE_TAGS
build/make/core/base_rules.mk:171: error: done.
18:29:38 ckati failed with: exit status 1

Change-Id: I056f019aa3249c185b808140bcef45a4777d21b3
Signed-off-by: theimpulson <aayushgupta219@gmail.com>
2020-03-23 15:09:31 -04:00
bigbiff
d58ba18272 AOSP10 TWRP Merge: fix conflicts and update libraries needed
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.
2020-03-23 11:18:29 -04:00
bigbiff
26d5d5f0b9 Merge tag 'android-10.0.0_r25' into aosp10-4
Android 10.0.0 release 25
2020-03-23 09:56:16 -04: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
Captain Throwback
986130473e Clean up logd init file
- Remove unnecessary services

Change-Id: I4c9227cd49eeef1176d321ae61ca3ca8c3f54596
2019-04-29 17:45:31 -04:00
big biff
6b9ee0e0b2 Merge "Revert "Fix ld.config.txt errors on Android 8.1 system root devices"" into android-9.0 2019-03-15 00:40:46 +01:00
Captain Throwback
5ab596451a mksh: add mkshrc when using TW_USE_TOOLBOX
Fixes broken shell prompt in Terminal and adb shell

Before: https://del.dog/7vphlkc
After: https://del.dog/vhkjgo8

Add as prebuilt with suffix "_twrp" to avoid conflict
with original mkshrc and rename via POST_INSTALL_CMD

Prebuilt version adjusts TMPDIR variable from
"/data/local/tmp" to "/tmp" for TWRP

Change-Id: I42a1b2a8c114f66dbe659c07485f1dfae8a5d314
2019-03-07 18:34:15 +01:00
Captain Throwback
5cb78dc280 Revert "Fix ld.config.txt errors on Android 8.1 system root devices"
This reverts commit 1ccdefab79.

Reason for revert: Causes delay during boot resulting in failed decryption on FDE devices. Recommend having device maintainers specify this variable manually in rc file and include actual ld.config.txt (or placeholder) in ramdisk directly.

Change-Id: Ib2410675396b38522d690c6057057d164cc0cff2
2019-01-22 19:28:02 +01:00
Tao Bao
a89c21c9e5 Start charger at /system/bin/charger.
Bug: 114042635
Test: Boot into recovery mode on walleye. Check that charger keeps
      working.
Change-Id: I818536a6d261c860dd6f6c08774c2355e14f4236
2018-09-14 15:52:29 -07:00
Hridya Valsaraju
e4ef453914 Fix sideload for user devices by adding a new sideload config
Bug: 113563995
Test: Tested the 'adb sideload' command on marlin user/userdebug builds
and walleye user/userdebug builds

Change-Id: I00d565547b85f2db87012e4a08316609e03395ac
2018-09-07 15:02:43 -07:00
Ethan Yonker
58f2132bc3 Merge AOSP android-9.0.0_r3
Fix conflicts and make it build in 5.1, 6.0, 7.1, 8.1, and 9.0

Change-Id: Ida0a64c29ff27d339b7f42a18d820930964ac6e4
2018-08-24 11:17:39 -05:00
Elliott Hughes
a4495b5ee2 Add /dev/stdin, /dev/stdout, and /dev/stderr in recovery too.
Now these are in the main image, there's some chance of code assuming
they're present in recovery too (or command-line users using them out
of habit).

Bug: http://b/31824379
Test: builds
Change-Id: Ia19272cd1959685765099f3e15d1d1e63babd279
2018-08-23 08:31:59 -07:00
Hridya Valsaraju
20c81b308d Add fastboot mode to recovery
Add a fastboot mode to recovery that can be
entered with command line args or with the ui.

Add usb property triggers to switch between
fastboot and adb configurations.

Allow switching between fastboot and adb through
usb commands by opening a unix socket. adbd/fastbootd
writes to this socket, which interrupts the ui and
switches to the new mode.

Test: Use fastboot mode
Bug: 78793464
Change-Id: I7891bb84427ec734a21a872036629b95ab3fb13c
2018-08-13 21:18:18 -07:00
Tom Cherry
aceb244401 Merge "ueventd is now at /system/bin/ueventd" 2018-08-07 16:08:55 +00:00
Ethan Yonker
1ccdefab79 Fix ld.config.txt errors on Android 8.1 system root devices
Change-Id: I17dcb8a2d77519799292d1c0fb5d94de21d7e6cb
2018-07-27 19:02:21 +02:00
Hridya Valsaraju
cfb3c92302 Move recovery from /sbin to /system/bin
Executables should be in /system/bin
rather than sbin.

Bug: 78793464
Test: boot into recovery, try adb sideload
Change-Id: I194589119a099d29e56b0648f0906a5ae2aa6770
2018-07-26 17:12:40 -07:00
Tom Cherry
b2fd16841a ueventd is now at /system/bin/ueventd
Bug: 79758715
Test: boot into recovery
Change-Id: I9bf47b2487993e275419befdc9718cc0ac8d3ea7
2018-07-24 15:58:29 -07:00
Jiyong Park
8b7af4c0ee Recovery image is self-contained
Now recovery mode is self-contained, which means we don't need to mount
system.img to run shell, etc. What is needed in recovery mode is all in
the recovery ramdisk image.

Since we no longer use /system as the mount point for the system.img,
this allows us to have identical filesystem layout as the system.img.
Executables and libs are installed to /system/bin and /system/lib.
Right now, we only have adbd, sh, toybox in /system/bin but will move
static executables from /sbin to /system/bin as soon as they are
converted to dynamic executables.

system.img is mounted to /mnt/system instead.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: `adb root && adb shell` and then
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: I801ebd18f3e0a112db3d9a11e4fbb4e49181652a
2018-06-07 23:24:33 +09:00
Elliott Hughes
4dca6f12db Add a /bin symlink for consistency.
Bug: http://b/63142920
Test: builds
Change-Id: I1f96935daca4d79f753e172067e07f8e27ea819e
2017-12-06 08:41:50 -08:00
Ethan Yonker
8373cfe28c Update to AOSP 8.0 base
Change-Id: I29fe722b4eb9718765327902779046840a01433e
2017-09-08 07:14:59 -05:00
that
9c3b7e990e etc: remove "." from LD_LIBRARY_PATH
We shouldn't load libraries from some random working directory.
For example it breaks busybox when you're in /system/lib.

Change-Id: Ia1f8f4fda9e6182c0cd8c5ac727c2b1eb09c84a2
2017-05-16 22:56:51 +02:00
Tom Cherry
37ac94978c init.rc: Remove sys.powerctl action
Init now handles this property change directly.

Bug: 37209359
Bug: 37415192

Test: Init reboots normally.
Change-Id: I9a4925897fb83bed180d12c871d9a71126fa4aa8
(cherry picked from commit 4608daf0fe)
2017-04-18 12:23:25 -07:00
Tom Cherry
c58e03ec23 Merge "init.rc: Remove sys.powerctl action" am: 9848209088 am: 9fcc7c8253
am: 6e575ccd0f

Change-Id: Iec1eb05ea5ec85c035d6ae7e232699ab3a6f6878
2017-04-18 18:33:09 +00:00
Tom Cherry
4608daf0fe init.rc: Remove sys.powerctl action
Init now handles this property change directly.

Bug: 37209359
Bug: 37415192

Test: Init reboots normally.
Change-Id: I9a4925897fb83bed180d12c871d9a71126fa4aa8
2017-04-17 16:55:54 -07:00
nkk71
71c6c50d0d crypto: Use system's vold for decryption
If TWRP crypto fails to decrypt partition, mount the system
  partition and use system's own vold to attempt decryption.
  This provides a fallback for proprietary OEM encryption as well as
  encryption methods which TWRP hasn't been updated for.

  Requirements in device tree:
  * fstab.{ro.hardware} in device/recovery/root
    The fstab does not need to be complete, but it does need the
    data partition and the encryption entries.

  * 'TW_CRYPTO_USE_SYSTEM_VOLD := true' in BoardConfig
  or
  * 'TW_CRYPTO_USE_SYSTEM_VOLD := <list of services>'

  Notes:
  * Setting the flag to 'true' will just use system's vdc+vold
    or
  * Setting the flag with additional services, will also start them
    prior to attempting vdc+vold decryption, eg: for qualcomm based
    devices you usually need 'TW_CRYPTO_USE_SYSTEM_VOLD := qseecomd'

  * For each service listed an additional import will be automatically
    added to the vold_decrypt.rc file in the form of
    init.recovery.vold_decrypt.{service}.rc
    You will need to add any not already existing .rc files in
    your device/recovery/root folder.

  * The service names specified in the vold_decrypt.{service}.rc files
    have to be named 'sys_{service}'
    eg: 'service sys_qseecomd /system/bin/qseecomd'

  * Any service already existing in TWRP as {service} or sbin{service} will
    be stopped and restarted as needed.

  * You can override the default init.recovery.vold_decrypt.rc file(s)
    by placing same named ones in your device/recovery/root folder.
    If you do, you'll need to manually add the needed imports.

  * If /vendor and /firmware folders are temporarily moved and symlinked
    to the folders and files in the system partition, the properties
    'vold_decrypt.symlinked_vendor' and 'vold_decrypt.symlinked_firmware'
    will be set to 1.
    This allows for additional control in the .rc files for any extra
    actions (symlinks, cp files, etc) that may be needed for decryption
    by using: on property:vold_decrypt.symlinked_vendor=1 and/or
    on property:vold_decrypt.symlinked_firmware=1 triggers.

  Debug mode: 'TW_CRYPTO_SYSTEM_VOLD_DEBUG := true' in BoardConfig
  * Specifying this flag, will enable strace on init and vdc, which will
    create separate log files in /tmp for every process created, allowing
    for detailed analysis of which services and files are being accessed.
  * Note that enabling strace will expose the password in the logs!!
  * You need to manually add strace to your build.

Thanks to @Captain_Throwback for co-authoring and testing.

Tested successfully on HTC devices:
M8 (KK through MM), M9 (MM and N), A9 (N), 10 (N), Bolt (N),
Desire 626s (MM), U Ultra (N)

HTC One X9 (MTK device)

And by Nikolay Jeliazkov on: Xiaomi Mi Max

Change-Id: I4d22ab55baf6a2a50adde2e4c1c510c142714227
2017-03-06 18:50:52 +02:00
Captain Throwback
1b3fa22d71 logd: add seclabel so that service runs in 7.1 tree builds
Change-Id: If9bfcf6bdeac91e82e9615b671acbee5acffe0cc
2017-02-23 13:16:02 -06:00
Matt Mower
84830ce015 Only change USB mode to mtp when ready for MTP
Commit 'Do not toggle USB ID during MTP startup if not needed' changed
the default USB mode to 'mtp,adb'. Depending on the device, this can
result in an unfortunate side effect of crashing an ORS sideload
midway through the process (it's not clear to me whether the kernel or
the connected computer is responsible). Only put USB into mtp mode
when MTP storage is starting-up.

The hack to change the USB mode to adb when a user compiles TWRP
without MTP support is no longer necessary now that 'adb' is the
startup mode.

Change-Id: I8ed13d6ab8e85621533997b8c37ef7ebec0fcf85
2017-02-23 12:30:59 -06:00
Matt Mower
18bdccb790 init: Remove duplicate trigger of load_system_props_action
Change-Id: I29ba5c4d78be24de3dabc0083fe291fb2b65fa54
2017-01-18 13:04:35 -06:00
Jerry Zhang
a61a672674 Write aliases before ffs mount in recovery
This is necessary to support kernel changes
that allow for multiple ffs functions. Some
kernels require aliases in order to name
function instances before mount time.

Test: Reboot into recovery, verify adb works
Bug: 34070894
Change-Id: I8376304d92af9b3e8c734fdb8cc77f0dc8bc4850
2017-01-04 11:20:19 -08:00
Jerry Zhang
e66f861a7c Write aliases before ffs mount in recovery
This is necessary to support kernel changes
that allow for multiple ffs functions. Some
kernels require aliases in order to name
function instances before mount time.

Test: Reboot into recovery, verify adb works
Bug: 34070894
Change-Id: I8376304d92af9b3e8c734fdb8cc77f0dc8bc4850
2017-01-04 11:16:02 -08:00
Sandeep Patil
c4b381c44b healthd: change how charger is launched in recovery.
This is triggered by changes in healthd which spits out 2 binaries.
Recovery needs to use static binary which is now renamed to 'charger'.
So, change the .rc file to match the rename.

Update the seclable according to new healthd-charger split

Test: Tested recovery on angler using 'reboot recovery' to ensure
healthd is working as before

Change-Id: I9e6018156e677e7224dd2e5894941ed2a7cac1d0
Signed-off-by: Sandeep Patil <sspatil@google.com>
2016-11-01 14:27:23 -07:00
Andriy Naborskyy
544a1562d9 init: move healthd to late-init
Starting healthd in early-init is not needed and can delay coldboot done
Now healthd is starting at boot as usual service.

Test: check kmsg that healthd starting after /dev/.coldboot_done

Bug: 30292927
Change-Id: I367d022f5885122da49181db3db536012e83f564
2016-10-10 17:29:11 -07:00
Ethan Yonker
4bf259fab7 Make naming scheme more meaningful
Change-Id: Ifcaf00c760ff452b0e85a88b54e91ca0f2f4644a
2016-08-29 11:50:34 -05:00
Ethan Yonker
f117962eb2 Make it backwards compatible with 4.4
Change-Id: I668604cddc8e8afbf78709f3f872bea4e9f4aa06
2016-08-25 15:36:13 -05:00
Ethan Yonker
34ae483e02 Update to 7.0
Change-Id: I621cc47352f7ac552d9602485825ae3a6f9ae516
2016-08-24 15:32:18 -05:00
Elliott Hughes
48ebb07211 init now uses libprocessgroup, so set up /acct.
Change-Id: Iec1492dfaf2ceae6f4d8618dd725d07316ee960b
2016-06-15 15:15:15 -07:00
Elliott Hughes
ad29b10c00 Remove etc/META-INF/com/google/android/update-script.
Bug: http://b/29250988
Change-Id: I61f8c6717b38de2242e4ea8e0913237c1ce5bfea
2016-06-09 18:03:05 -07:00
Alex Deymo
080f522fb9 Restore labels on /postinstall during recovery.
This patch mirrors what was done in the main init.rc to relabel
/postinstall.

Bug: 27178350
Bug: 27177071

(cherry picked from commit 6bcc8af6e5)

Change-Id: I8320559f014cfb14216dcc350e016fc1db05cb14
2016-03-04 15:50:27 -08:00
Alex Deymo
6bcc8af6e5 Restore labels on /postinstall during recovery.
This patch mirrors what was done in the main init.rc to relabel
/postinstall.

Bug: 27178350
Bug: 27177071
Change-Id: I39cd03f3c55a42c03367957e8c259c9a3155203c
2016-03-02 14:35:51 -08:00
Ethan Yonker
e5a288c96b Fix up logd make file rules
logd, the init.recovery.logd.rc, and other related files were
included by default if your device configs specified
TARGET_USES_LOGD := true which would be the case for any device
that has a full ROM tree instead of a minimal TWRP tree.

Change-Id: Ia1e55703631f0f22beab2f4d4479599b88539e1a
2016-02-15 09:27:02 -06:00
Captain Throwback
1f12775707 Add TWRP flags to enable logd and/or logcat in recovery
Developers and device maintainers may find it useful to have access
to logcat in recovery. This patch set adds the following build flags:

TARGET_USES_LOGD - This is an Android build flag that enables logd
support. Devices that don't have built in kernel logging to dev/log/*
will need this flag for logcat. We'll also use this to include the
necessary support files for logd in TWRP.

TWRP_INCLUDE_LOGCAT - This enables logcat support in recovery.

I pulled the init entries from my HTC One M8 GPE boot.img,
so I'm not certain whether these will work for all devices
or if they're all necessary.

Feedback is welcome.

PS2: Use "TARGET_USES_LOGD" instead as this flag already exists, and
previous flag was named incorrectly (logd isn't kernel logging)

PS3: Start logd service on load_persist_props action, needed for 6.0+

PS4: More info on "TARGET_USES_LOGD" flag as related to liblog
compilation can be found at the below links:

https://android.googlesource.com/platform/system/core/+/android-6.0.1_r10/liblog/Android.mk#27
https://android.googlesource.com/platform/system/core/+/android-6.0.1_r10/liblog/Android.mk#50

Whether or not this flag is needed for logcat in TWRP is dependent
on whether liblog was compiled with this flag.

PS5: Update commit message to better describe "TARGET_USES_LOGD" flag

PS6: Another commit message update

Change-Id: Iaac6c6c822dc93fbe4b6eadcf24eef6995dd6b50
2016-02-04 15:09:58 +01:00
Matt Mower
4251a9bcff init: Add new props triggers
Both Omni and CM split props loading into load_system_props_action and
load_persist_props_actions in Android 6.0 instead of all_props action.
Add these triggers. Unrecognized triggers do not cause failures in init
for versions of Android which do not have these.

Change-Id: I9682690ff7d378dc0d5e1598754f7a29600c1c2d
2015-12-23 22:34:32 +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
HandyMenny
37d42994cd Properly set sys.usb.config when ums is enabled.
Use sys.usb.config also for ums, but leave sys.storage.ums.enabled for compatibility with custom init.rc that use it.

PS2: Rebased - moved updates to init.recovery.usb.rc

Change-Id: Iad3441d23ac37612e58f63e4038d05c5c1a37b25
2015-10-15 16:04:16 +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
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