[OFFICIAL][TWRP]Official TWRP For Xiaomi Redmi 5 - Xiaomi Redmi 5 ROMs, Kernels, Recoveries, & Other

Team Win Recovery Project 3.x, or TWRP3.x for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.
Code:
/*
* Your warranty is now void.
*
* We are not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at us for messing up your device, we will laugh at you.
*
*/
Download : TWRP For Rosy
Source Device Tree: Device Tree For Building TWRP

Does it support Redmi 5a?

exodius48 said:
Does it support Redmi 5a?
Click to expand...
Click to collapse
Nope..They are different model

Please correct the link in the OP to https://twrp.me/xiaomi/xiaomiredmi5.html

TingyiChen said:
Nope..They are different model
Click to expand...
Click to collapse
Could you add support Redmi 5a if possible?

TingyiChen said:
Team Win Recovery Project 3.x, or TWRP3.x for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.
Download : TWRP For Rosy
Source Device Tree: Device Tree For Building TWRP
Click to expand...
Click to collapse
Can we expect any custom ROMs for this device?
PS:Sorry for Quoting the OP:3

when I installed both flash from official twrp app and flash from adb. but it's stop on boot logo. Is it bug. Have anyone this error.

TingyiChen said:
Team Win Recovery Project 3.x, or TWRP3.x for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.
Download : TWRP For Rosy
Source Device Tree: Device Tree For Building TWRP
Click to expand...
Click to collapse
Thread is dead for so long..
Do u plan to support Rosy? In the future?

TWRP flash is successful But cannot reboot into TWRP
I successfully flashed TWRP via fastboot. But every time I reboot into recovery, it reboots into Mi Recovery. I tried flashing multiple times, but get the same result every time. Please help.

Where can I find older versions 3.1.1.0 for Redmi 5 (Rosy)

miteshmhapankar said:
I successfully flashed TWRP via fastboot. But every time I reboot into recovery, it reboots into Mi Recovery. I tried flashing multiple times, but get the same result every time. Please help.
Click to expand...
Click to collapse
you might want to try lazy flasher

kmu.mahesh said:
you might want to try lazy flasher
Click to expand...
Click to collapse
Yep Thanks. Did that.

I have twrp now installed for about 2 weeks
but every time I use it the settings are gone, so language time
vibration and so on
There seems to be no memory access

decryption not working
to fix:
repo init twrp source
add rosy device
add qcom common device
device/xiaomi/rosy:
Code:
diff --git a/BoardConfig.mk b/BoardConfig.mk
index e51c06e..9d4ba21 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -71,6 +71,10 @@ TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true
+# Crypto
+TARGET_HW_DISK_ENCRYPTION := true
+
# TWRP Configuration
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/twrp.fstab
RECOVERY_SDCARD_ON_DATA := true
diff --git a/omni.dependencies b/omni.dependencies
deleted file mode 100644
index 0d4f101..0000000
--- a/omni.dependencies
+++ /dev/null
@@ -1,2 +0,0 @@
-[
-]
dl:
https://drive.google.com/file/d/1rfaaQ0f6JqE7MgYdhEq-o0Olo7d_ZxzP/view?usp=sharing
edit:
TARGET_KEYMASTER_WAIT_FOR_QSEE := true not needed

vetzki said:
decryption not working
to fix:
repo init twrp source
add rosy device
add qcom common device
device/xiaomi/rosy:
dl:
https://drive.google.com/file/d/1rfaaQ0f6JqE7MgYdhEq-o0Olo7d_ZxzP/view?usp=sharing
Click to expand...
Click to collapse
Report this to tingyi!!

Any way to also add treble support for [ROM][UNOFFICIAL][ROSY][8.1] Lineage os 15.1_r46 for XIaomi redmi 5 [TREBLE]?
Thanks!

for treble support only different fstab and BoardConfig parameter needed (at least I think so),
Code:
diff --git a/BoardConfig.mk b/BoardConfig.mk
index ce63750..c631a53 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -90,3 +90,7 @@ TW_THEME := portrait_hdpi
# Disable Mouse Cursor
TW_INPUT_BLACKLIST := "hbtp_vm"
+
+# Treble
+BOARD_NEEDS_VENDORIMAGE_SYMLINK := false
+TARGET_COPY_OUT_VENDOR := vendor
diff --git a/twrp.fstab b/twrp.fstab
index a581921..97dad11 100644
--- a/twrp.fstab
+++ b/twrp.fstab
@@ -3,15 +3,45 @@
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/system ext4 /dev/block/bootdevice/by-name/system flags=display="System"
-/data ext4 /dev/block/bootdevice/by-name/userdata flags=length=-16384
+#/system_image emmc /dev/block/bootdevice/by-name/system flags=backup=0;flashimg=1
+/system_image emmc /dev/block/bootdevice/by-name/system flags=flashimg=1;display="Image system partition"
+#/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384
+/data ext4 /dev/block/bootdevice/by-name/userdata length=-16384
+/data_image emmc /dev/block/bootdevice/by-name/userdata flags=backup=1;display="Image data partition"
+/boot emmc /dev/block/bootdevice/by-name/boot flags=display="Boot"
/cache ext4 /dev/block/bootdevice/by-name/cache flags=display="Cache"
-/cust ext4 /dev/block/bootdevice/by-name/cust flags=display="Cust";backup=1
+/storage ext4 /data/media/0 flags=display="Internal Storage";usermrf;backup=1;fsflags="bind";removable
+/vendor ext4 /dev/block/bootdevice/by-name/cust flags=display="Vendor";backup=1;wipeingui
+/vendor_image emmc /dev/block/bootdevice/by-name/cust flags=backup=0;flashimg=1
+
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=display="Recovery";backup=1
-/boot emmc /dev/block/bootdevice/by-name/boot flags=display="Boot"
/misc emmc /dev/block/bootdevice/by-name/misc flags=display="Misc"
-/efs1 emmc /dev/block/bootdevice/by-name/modemst1 flags=display="EFS";backup=1
-/efs2 emmc /dev/block/bootdevice/by-name/modemst2 flags=backup=1;subpartitionof=/efs1
-/firmware vfat /dev/block/bootdevice/by-name/modem flags=display="Firmware";mounttodecrypt
/persist ext4 /dev/block/bootdevice/by-name/persist flags=display="Persist";backup=1
+/persist_image emmc /dev/block/bootdevice/by-name/persist flags=backup=0;flashimg=1
+/splash emmc /dev/block/bootdevice/by-name/splash flags=display="Boot Logo";backup=1;flashimg=1
+
/sdcard1 auto /dev/block/mmcblk1p1 flags=display="MicroSD";storage;wipeingui;removable
/usb-otg auto /dev/block/sda1 flags=display="USB Storage";storage;wipeingui;removable
+
+# Bootloader
+/aboot emmc /dev/block/bootdevice/by-name/aboot flags=backup=1;display="Bootloader"
+/cmnlib emmc /dev/block/bootdevice/by-name/cmnlib flags=backup=1;subpartitionof=/aboot
+/tz emmc /dev/block/bootdevice/by-name/tz flags=backup=1;subpartitionof=/aboot
+/rpm emmc /dev/block/bootdevice/by-name/rpm flags=backup=1;subpartitionof=/aboot
+/keymaster emmc /dev/block/bootdevice/by-name/keymaster flags=backup=1;subpartitionof=/aboot
+/devcfg emmc /dev/block/bootdevice/by-name/devcfg flags=backup=1;subpartitionof=/aboot
+
+# Modem backup/restore
+/firmware vfat /dev/block/bootdevice/by-name/modem flags=display="Firmware";backup=0;mounttodecrypt;fsflags=ro
+/modem emmc /dev/block/bootdevice/by-name/modem flags=display="Modem (Image)";backup=1;flashimg=1
+/dsp emmc /dev/block/bootdevice/by-name/dsp flags=backup=1;subpartitionof=/firmware
+/sec emmc /dev/block/bootdevice/by-name/sec flags=backup=1;display="Sec"
+#/config emmc /dev/block/bootdevice/by-name/config flags=display="OEM";backup=1
+#/sec emmc /dev/block/bootdevice/by-name/sec flags=display="Sec";backup=1;subpartitionof=/config
+
+
+# EFS backup/restore
+/efs1 emmc /dev/block/bootdevice/by-name/modemst1 flags=backup=1;display="EFS"
+/efs2 emmc /dev/block/bootdevice/by-name/modemst2 flags=backup=1;subpartitionof=/efs1
+/efsg emmc /dev/block/bootdevice/by-name/fsg flags=backup=1;subpartitionof=/efs1
+/efsc emmc /dev/block/bootdevice/by-name/fsc flags=backup=1;subpartitionof=/efs1
(note: not all partitions needed, e.g. efs, bootloader, _image stuff)
built recovery but didn't test anything beside backup and flashing xiaomi.eu rom
but do you need such a recovery to install los-15.1 ?

TingyiChen said:
Source Device Tree: Device Tree For Building TWRP
Click to expand...
Click to collapse
Any possibility that you push the crypto support to official repo?

Is OrangeFox a better idea than TWRP for this device?

hkjo said:
Is OrangeFox a better idea than TWRP for this device?
Click to expand...
Click to collapse
It is different in some respects - but "better" or not is a matter of taste! However, I do not think that this is the place for that discussion

Related

[APP][ROOT] ZipInstaller 5.0.3 for CWM + TWRP + 4EXT Recoveries

ZipInstaller 5.0.3
A fast and easy way to install ZIPs
This app was posted in XDA portal
Review at AndroidDissected
Overview
ZipInstaller is a tool that makes it easier and faster to pick up and install zip files through your recovery. Instead of manually rebooting into the recovery and selecting files from there, you can pick up all the zips you want with your favorite file manager from the sdcard and install them with just one click, that's it.
TWRP, 4EXT and CWM-based recoveries are fully supported.
Closed source CWM is only supported through RomManager premium.
Features
- Install as much zips you want in a row
- Add zips directly from a file manager
- Add zips through folder rules
- Click on the zips added to see its properties, remove it from the list or mark it to delete after flashing.
- You can define the recovery and the sdcard mount point name in the menu.
- If you add a zip that was already added, it goes down to the last position.
- Reorder the list using drag and drop.
- Use the app to download zips, they're added to the install list
- Backup, restore and delete backup.
- Check MD5 sum (manually or automatically through *.md5sum)
- Application automatic updates
- Sync backups in the cloud (dropbox and drive)
- Get notifications of updates of your rom if they are on goo.im or ota-update-center
- Download the new version of your rom and add it to the list automatically
- Navigate Goo.im
- ONandroid backup (backups without rebooting) thanks to Ameer Dawood
- Flash boot and recovery images if available
- Open source!
Features purchased version
- No ADS
Source code
The source code is available here: https://github.com/beerbong/com_beerbong_zipinst
Feel free to download it and modify as you want.
Download free version
Find latest version of the apk here: http://goo.im/devs/beerbong/apps/ZipInstaller
Purchase application
Support the dev buying the pro version so he can have a beer
Play Store link: https://play.google.com/store/apps/details?id=com.beerbong.zipinst
Bugs
Did you find a bug? Please report it in the app's github repo: https://github.com/beerbong/com_beerbong_zipinst/issues
Translators
- Catalan: beerbong
- Slovak: pyler
- Spanish: beerbong
- Japanese: ThJap
Credits
Developed by beerbong
Initially tested by The Beer Gang members jmico and davidshaper
Initially tested by the xda recognized contributor chasmodo
Changelog
Changelog
Code:
Version 5.0.3:
- Fix: sometimes the "purchase the app" message appears even if purchased
Version 5.0.2:
- Bug fix
Version 5.0.1:
- Little bug fix
Version 5.0.0:
- Reworked UI and app's structure
Version 4.1.7:
- Delete rules individually
- Check for recovery changes on startup
- Pro: Option to download TWRP (Menu -> Install recovery)
- Bug fixes
Version 4.1.6:
- Bug fixes
Version 4.1.4:
- Select zips from external sd using kitkat's storage manager
- Test root access from settings
- Option to force using /data/media/ in CWM
- Bug fixes
Version 4.1.3:
- Fix backups folder path for CWM recoveries
Version 4.1.2:
- Select zips from internal sd with kitkat's new storage manager
- Zip and synchronize backups with dropbox and google drive
- Purchased version: flash boot image
- Purchased version: flash recovery image
- Purchased version: handle twrp backup options with onandroid
- Visual and performance changes
Version 4.1.1:
- Support for official closed source CWM (ROMManager premium must be installed)
- ONandroid suport only in purchased version (thanks to Ameer Dawood)
- Support for android 4.4 KitKat
- Bug fixes
Version 4.1.0:
- GPLv3 license
- Backup and restore in external sdcard (not fully tested in TWRP)
- Disabled su alert
- Added ads (pro version doesn't have it)
- Option to login to goo.im
- Moar bug fixes
Version 4.0.5:
- Initialization improvements
- Visualization improvements
- Option to force CWM to mount external sdcard
- Bug fixes
Version 4.0.4:
- Works with SolidExplorer
- File/Folder picker improvements
- Bug fixes
Versión 4.0.3:
- Added rules to add files to the list (default folder must be set)
- Option to delete the file after flashing (through file info dialog)
- Bug fixes
Version 4.0.2:
- Added option to list zip files from a predefined folder
- Other improvements
Version 4.0.1:
- Fix: the zip position option wasn't correctly stored
Version 4.0.0:
- New style (hope you like it)
- Backup options in TWRP
- Fix: manage properly the zip files send/share and download options
Version 3.4.0:
- Android 4.3 support and other small fixes
Version 3.3.7:
- Fix: corrected external sdcard value
Version 3.3.6:
- Fix crash on free version
Version 3.3.5:
- Purchased: performance improvements
- Purchased: added option to not check for updates
Version 3.3.4:
- Fix: can't read internal storage path in some devices
Version 3.3.3:
- Fix crash on some devices without external storage
- Fix update dialog not showing in settings
Version 3.3.1 and 3.3.2:
- Bugs and stability fixes
Version 3.3.0:
- Added ability to flash from the external sdcard
- Recovery: added wipe data and wipe caches option
Version 3.2.2:
- Added android.permission.ACCESS_SUPERUSER
- Add wipe system option to settings
Version 3.2.1:
- Wipe system option
- Internal improvements
Version 3.2.0:
- Option to check sdcard space before doing a backup
- Don't add files that doesn't exist
- Purchased: Added option to change the time between updates searches (again)
- Purchased: Fix when developer doesn't exist in goo.im
Version 3.1.4:
- Fix: the app was managing all the zip downloads
Version 3.1.3:
- Fix: fix permissions wasn't called from dialog
Version 3.1.2:
- Quick fix
Version 3.1.1:
- Fixed: RebootManager crash
Version 3.1.0:
- Fixed: zips with spaces
- Added ability to chose which options to show pressing "Install Now"
- Ability to execute sh scripts
- Option to run fix permissions
Version 3.0.5:
- Added option to select the position to add the zips
- Downloads: change zip name if already exists and deal with unknown file names
- Purchased: Navigate goo.im (GooManager style)
- Purchased: Added option to change the time between updates searches
Version 3.0.4:
- Purchased: Fix service initialization
Version 3.0.3:
- Fixed update dialog not showing in settings
- Added option to auto load list on startup
- Purchased: OTA service with Goo.im and OTA-update-center
Version 3.0.2:
- Fixed md5sum with leading zeros
- Listen browser to download zip files
- Readded slovak translation (thanks to pyler)
Version 3.0.1:
- Fixed crash when not using Drag&Drop
- Corrected path in file properties
- Added japanese translation (thanks to hayashikejinan)
Version 3.0.0:
- Visual improvements
- Fixed list deleted after rotation
- Fixed Drag&Drop
- Fixed backups with spaces crashing in CWM-based
- Added Holo theme
- Added option to check if files exists
- Added option to check md5sum files automatically
- Added option to override the list when loading saved list
- Added option to delete backup
- Added option to reboot to recovery
- Check and install updates
- Download zip files
Version 2.5.4:
- Fixed last modified date in zip properties
- Added option to check MD5 sum (from zip properties dialog)
- Added slovak translation (thanks to pyler)
Version 2.5.3:
- Zip list shows full path in summary
- More info in zip properties
- Backup and restore options are shown in ActionBar
- Added option to show/hide backup option in reboot dialog
Version 2.5.2:
- Use RebootManager if installed as a system app
Version 2.5.1:
- Workaround to make HTC devices reboot
Version 2.5.0:
- Added backup and restore
Version 2.4.7:
- Added option to disable Drag and Drop
- Reorganized settings
Version 2.4.6:
- Fixed crash on touching category
Version 2.4.5:
- Added ability to reorder the list of zips
- Added option to save and load the list of zips
Version 2.4.4:
- Added hability to receive zips from other apps
- Added support for TWRP2.2-
Version 2.4.3:
- Minor changes
Version 2.4.2:
- Support for CWM-based recovery 5.0.x
Version 2.4.1:
- Fix bug while wiping
Version 2.4:
- ZipInstaller now works as a user app
- Tries to configure recovery automatically
Version 2.3:
- Support for 4EXT recovery
Version 2.2:
- Support for TWRP recovery
- Fix bug writing shared preferences
- Changed icon
- System style
Version 2.1:
- Added dalvik cache wipe
- Added android_secure wipe
Version 2.0:
- Multi zip install
- Show zip properties
- Remove zip from list
- Change sdcard mount point name
- Can't remember...
Version 1.0 to 1.3:
- This branch is totally discontinued
- First release
Q&A and troubleshooting
Q&A and troubleshooting
I have ClockworkMod (official Koush's one) recovery and it's giving me this error: "Error processing ROM Manager script"
You've got to select CWM-official in settings and have RomManager premium installed.
The recovery throws this error: "Can't mount /emmc/..."
Change the internal sd card path to sdcard in menu -> SD card.
I hit the "Install now" button but nothing happens
Install the app as a system app. Should work now.
good to see this type of thing when you don't want to use rom manager
galaxy mini people will love this
dheeraj (dhlalit11) said:
good to see this type of thing when you don't want to use rom manager
galaxy mini people will love this
Click to expand...
Click to collapse
I'll give it a go as soon as I get back home, don't have my Note with me ATM. Thanks a million, BB.
Sent from Nexus 7
This is pretty sweet. Will give it a go today.
Hi BB.
I have just tried it on Nexus 7 and it didn't work. Here's the recovery.log for you to hopefully discover what went wrong.
Code:
Starting recovery on Fri Oct 5 06:15:27 2012
can't open /dev/tty0: No such file or directory
framebuffer: fd 3 (800 x 1280)
ClockworkMod Recovery v6.0.1.0
recovery filesystem table
=========================
0 /tmp ramdisk (null) (null) 0
1 /sdcard datamedia /dev/null (null) 0
2 /system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP (null) 0
3 /cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC (null) 0
4 /data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA (null) 0
5 /recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS (null) 0
6 /boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX (null) 0
W:Unable to get recovery.fstab info for /datadata during fstab generation!
W:Unable to get recovery.fstab info for /emmc during fstab generation!
W:Unable to get recovery.fstab info for /sd-ext during fstab generation!
I:Completed outputting fstab.
I:Processing arguments.
I:Checking arguments.
I:device_recovery_start()
Command: "/sbin/recovery"
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=1
persist.sys.usb.config=adb
ro.build.id=IMM76L
ro.build.display.id=cm_grouper-userdebug 4.0.4 IMM76L eng.koush.20120721.115347 test-keys
ro.build.version.incremental=eng.koush.20120721.115347
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.4
ro.build.date=Sat Jul 21 11:55:15 PDT 2012
ro.build.date.utc=0
ro.build.type=userdebug
ro.build.user=koush
ro.build.host=Koushik-Lion.local
ro.build.tags=test-keys
ro.product.model=grouper
ro.product.brand=asus
ro.product.name=cm_grouper
ro.product.device=grouper
ro.product.board=grouper
ro.product.cpu.abi=armeabi
ro.product.manufacturer=asus
ro.product.locale.language=en
ro.product.locale.region=US
ro.wifi.channels=
ro.board.platform=unknown
ro.build.product=grouper
ro.build.description=cm_grouper-userdebug 4.0.4 IMM76L eng.koush.20120721.115347 test-keys
ro.build.fingerprint=asus/cm_grouper/grouper:4.0.4/IMM76L/eng.koush.20120721.115347:userdebug/test-keys
ro.build.characteristics=default
ro.cm.device=grouper
ro.rommanager.developerid=cyanogenmod
keyguard.no_require_sim=true
ro.url.legal=http://www.google.com/intl/%s/mobile/android/basic/phone-legal.html
ro.url.legal.android_privacy=http://www.google.com/intl/%s/mobile/android/basic/privacy.html
ro.com.google.clientidbase=android-google
ro.com.android.wifi-watchlist=GoogleGuest
ro.setupwizard.enterprise_mode=1
ro.com.android.dateformat=MM-dd-yyyy
ro.com.android.dataroaming=false
ro.cm.version=9-20120721-UNOFFICIAL-grouper
ro.modversion=9-20120721-UNOFFICIAL-grouper
ro.config.ringtone=CyanTone.ogg
ro.config.notification_sound=CyanMessage.ogg
ro.config.alarm_alert=CyanAlarm.ogg
ro.ril.hsxpa=1
ro.ril.gprsclass=10
ro.adb.qemud=1
dalvik.vm.lockprof.threshold=500
net.bt.name=Android
net.change=net.bt.name
dalvik.vm.stack-trace-file=/data/anr/traces.txt
ro.factorytest=0
ro.serialno=015d257861242209
ro.bootmode=unknown
ro.baseband=unknown
ro.carrier=unknown
ro.bootloader=3.34
ro.hardware=grouper
ro.revision=0
ro.emmc=0
init.svc.recovery=running
service.adb.root=1
init.svc.adbd=running
I:Checking for extendedcommand...
I:Running extendedcommand...
Waiting for SD Card to mount (20s)
I:using /data/media for /sdcard.
SD Card mounted...
Verifying SD Card marker...
SD Card marker not found...
44d064bc55690a583858ed575314e820
Error processing ROM Manager script. Please verify that you are performing the backup, restore, or ROM installation from ROM Manager v4.4.0.0 or higher.
I:using /data/media for /sdcard.
chasmodo said:
Hi BB.
I have just tried it on Nexus 7 and it didn't work. Here's the recovery.log for you to hopefully discover what went wrong.
Code:
Starting recovery on Fri Oct 5 06:15:27 2012
can't open /dev/tty0: No such file or directory
framebuffer: fd 3 (800 x 1280)
ClockworkMod Recovery v6.0.1.0
recovery filesystem table
=========================
0 /tmp ramdisk (null) (null) 0
1 /sdcard datamedia /dev/null (null) 0
2 /system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP (null) 0
3 /cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC (null) 0
4 /data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA (null) 0
5 /recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS (null) 0
6 /boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX (null) 0
W:Unable to get recovery.fstab info for /datadata during fstab generation!
W:Unable to get recovery.fstab info for /emmc during fstab generation!
W:Unable to get recovery.fstab info for /sd-ext during fstab generation!
I:Completed outputting fstab.
I:Processing arguments.
I:Checking arguments.
I:device_recovery_start()
Command: "/sbin/recovery"
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=1
persist.sys.usb.config=adb
ro.build.id=IMM76L
ro.build.display.id=cm_grouper-userdebug 4.0.4 IMM76L eng.koush.20120721.115347 test-keys
ro.build.version.incremental=eng.koush.20120721.115347
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.4
ro.build.date=Sat Jul 21 11:55:15 PDT 2012
ro.build.date.utc=0
ro.build.type=userdebug
ro.build.user=koush
ro.build.host=Koushik-Lion.local
ro.build.tags=test-keys
ro.product.model=grouper
ro.product.brand=asus
ro.product.name=cm_grouper
ro.product.device=grouper
ro.product.board=grouper
ro.product.cpu.abi=armeabi
ro.product.manufacturer=asus
ro.product.locale.language=en
ro.product.locale.region=US
ro.wifi.channels=
ro.board.platform=unknown
ro.build.product=grouper
ro.build.description=cm_grouper-userdebug 4.0.4 IMM76L eng.koush.20120721.115347 test-keys
ro.build.fingerprint=asus/cm_grouper/grouper:4.0.4/IMM76L/eng.koush.20120721.115347:userdebug/test-keys
ro.build.characteristics=default
ro.cm.device=grouper
ro.rommanager.developerid=cyanogenmod
keyguard.no_require_sim=true
ro.url.legal=http://www.google.com/intl/%s/mobile/android/basic/phone-legal.html
ro.url.legal.android_privacy=http://www.google.com/intl/%s/mobile/android/basic/privacy.html
ro.com.google.clientidbase=android-google
ro.com.android.wifi-watchlist=GoogleGuest
ro.setupwizard.enterprise_mode=1
ro.com.android.dateformat=MM-dd-yyyy
ro.com.android.dataroaming=false
ro.cm.version=9-20120721-UNOFFICIAL-grouper
ro.modversion=9-20120721-UNOFFICIAL-grouper
ro.config.ringtone=CyanTone.ogg
ro.config.notification_sound=CyanMessage.ogg
ro.config.alarm_alert=CyanAlarm.ogg
ro.ril.hsxpa=1
ro.ril.gprsclass=10
ro.adb.qemud=1
dalvik.vm.lockprof.threshold=500
net.bt.name=Android
net.change=net.bt.name
dalvik.vm.stack-trace-file=/data/anr/traces.txt
ro.factorytest=0
ro.serialno=015d257861242209
ro.bootmode=unknown
ro.baseband=unknown
ro.carrier=unknown
ro.bootloader=3.34
ro.hardware=grouper
ro.revision=0
ro.emmc=0
init.svc.recovery=running
service.adb.root=1
init.svc.adbd=running
I:Checking for extendedcommand...
I:Running extendedcommand...
Waiting for SD Card to mount (20s)
I:using /data/media for /sdcard.
SD Card mounted...
Verifying SD Card marker...
SD Card marker not found...
44d064bc55690a583858ed575314e820
Error processing ROM Manager script. Please verify that you are performing the backup, restore, or ROM installation from ROM Manager v4.4.0.0 or higher.
I:using /data/media for /sdcard.
Click to expand...
Click to collapse
Well, chas, you don't have a "CWM-based Recovery", you have a "ClockworkMod Recovery". The ClockworkMod Recoveries prevent from using the extendedcommand scripts.
Nothing i can do... you can update your recovery or talk to the rom developer (if he builds from source) to change one of these two pieces of code of android_bootable_recovery
in Android.mk
Code:
ifdef I_AM_KOUSH
RECOVERY_NAME := ClockworkMod Recovery
LOCAL_CFLAGS += -DI_AM_KOUSH
else
RECOVERY_NAME := CWM-based Recovery
endif
or in edifyscripting.c
Code:
#ifdef I_AM_KOUSH
if (0 != (ret = before_run_script(tmp))) {
ui_print("Error processing ROM Manager script. Please verify that you are performing the backup, restore, or ROM installation from ROM Manager v4.4.0.0 or higher.\n");
return ret;
}
#endif
beerbong said:
Well, chas, you don't have a "CWM-based Recovery", you have a "ClockworkMod Recovery". The ClockworkMod Recoveries prevent from using the extendedcommand scripts.
Nothing i can do... you can update your recovery or talk to the rom developer (if he builds from source) to change one of these two pieces of code of android_bootable_recovery
in Android.mk
Code:
ifdef I_AM_KOUSH
RECOVERY_NAME := ClockworkMod Recovery
LOCAL_CFLAGS += -DI_AM_KOUSH
else
RECOVERY_NAME := CWM-based Recovery
endif
or in edifyscripting.c
Code:
#ifdef I_AM_KOUSH
if (0 != (ret = before_run_script(tmp))) {
ui_print("Error processing ROM Manager script. Please verify that you are performing the backup, restore, or ROM installation from ROM Manager v4.4.0.0 or higher.\n");
return ret;
}
#endif
Click to expand...
Click to collapse
Thanks for clarifying that for me. Would it work on TWRP, perhaps? These are the only two recoveries available for N7 AFAIK.
chasmodo said:
Thanks for clarifying that for me. Would it work on TWRP, perhaps? These are the only two recoveries available for N7 AFAIK.
Click to expand...
Click to collapse
TWRP has it's own scripting language called OpenRecoveryScript, interesting, do you know if TWRP supports the n7000? if so, i'll install it and make some test.
beerbong said:
TWRP has it's own scripting language called OpenRecoveryScript, interesting, do you know if TWRP supports the n7000? if so, i'll install it and make some test.
Click to expand...
Click to collapse
I remeber Note AOKP had TWRP at some point, but they abandoned it for some reason or another.
Betatesters needed for version 2.2.
I have to test ZipInstaller in a TWRP recovery, so if you have a device with this recovery and wanna help me, please send me a PM or post it here.
Version 2.2 released
TWRP support not fully tested. If you test it, try switching the internal storage mount point name to "sdcard" or "data/media" (in menu -> internal storage). Min version of TWRP is 2.2
Uploaded to goo.im. Check when it's available.
the app didn't work on my Samsung captivate running android v4.0 and have cwm recovery v6
the app is a bit off of the screen
in the below link you can find the screenshot and last log of the recovery
https://www.box.com/shared/38ye7g8ppf6rtikzoj8r
one thing I noted in the last log is it took my internal memory as emmc
dheeraj (dhlalit11) said:
the app didn't work on my Samsung captivate running android v4.0 and have cwm recovery v6
the app is a bit off of the screen
in the below link you can find the screenshot and last log of the recovery
https://www.box.com/shared/38ye7g8ppf6rtikzoj8r
one thing I noted in the last log is it took my internal memory as emmc
Click to expand...
Click to collapse
Download version 2.2 when it's online and try changing the internal storage mount point name.
Enviat des d'es meu GNote amb so Tapatalk
Version 2.2 is online... test and give some feedback
Why it doens't support External SD ?
the newer version also didn't work, also changed the internal sdcard to sdcard
here is the last log
https://www.box.com/shared/c5hamj7akz9udyz6fyrz
also the app get fc'ed when I tap on any selected zip file
dheeraj (dhlalit11) said:
the newer version also didn't work, also changed the internal sdcard to sdcard
here is the last log
https://www.box.com/shared/c5hamj7akz9udyz6fyrz
also the app get fc'ed when I tap on any selected zip file
Click to expand...
Click to collapse
You are using a recovery called "Devil" that i don't know about. It seems to be using both extendedcommand and openrecoveryscript (althought the TWRP version is lower than 2.2 cause it can't handle the print command). The sdcard path seems correct, so is emmc, maybe the problem are the spaces in the zip name.
Also, if there are FCs, please provide a logcat.
indeed its devil kernel which have both cwm based recovery and twrp, am thinking about the sdcard marker, it could be the problem and also the space in the name could be
i can take logcat
but it would be good if you can give the command to log the events which are related only with your app, so that only useful events would be logged

Flashing and repartitioning Xiaomi MI2S running MIUI6

After upgrading from MIUIv4 to v6, I've discovered that the new version comes with a bootloader that
reflashes the recovery partition each time it's run with the stock recovery, which makes it impossible to use a custom recovery in order to install unsigned .zip patches,
doesn't support download mode, which makes it impossible to connect the phone to a computer as a block device and repartition it.
Since resolving this wasn't completely trivial (to me) and required a bit of research, I took some notes for future reference. I later decided to publish these notes, since someone might find them useful. Keep in mind that, while I do have technical background, I'm not intimately acquainted with the inner workings of Android and there was some trial and error involved. As a result, certain steps may be too heavy-handed or even unnecessary and I encourage comments on that.
Prerequisites
The guide presumes one has the adb, fastboot and parted binaries installed on an OS that enables access to connected block devices via the filesystem. For most users, that means a linux box.
Download mode
Booting into download mode appears to be disabled in MIUI6 v5.8.6. You will therefore need to boot into a custom recovery (see Booting into a custom recovery mode) and flash an alternative ROM (it would likely suffice to flash only certain partitions?):
Code:
$ adb push cm-11-20150802-NIGHTLY-aries.zip /storage/sdcard0
To boot into the download mode with an alternative ROM, consult [3] or run adb reboot dload against the phone in the system or in the recovery mode.
Repartitioning the internal flash memory
In my experience, the default size of the /system partition is insufficient to accommodate all the system applications along with the ever-growing Google Apps. The original inspiration came from [4]. To adjust the partition sizes, I used the parted command-line tool, since it comes with full support for GPT partitions and labels. Gparted used, but (as of v0.19.0-2) appeared to be much slower compared to parted and didn't seem to fully support GPT partition labels. Keep in mind that, unlike gparted, parted applies the changes to the block device immediately. Proceed with caution.
Before starting, it's best to backup the current partition table for a reference:
Code:
# gparted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit MiB
(parted) print
Number Start End Size File system Name Flags
1 0,02MiB 85,0MiB 85,0MiB fat16 modem msftdata
2 85,0MiB 170MiB 85,0MiB fat16 modem1 msftdata
3 170MiB 171MiB 0,50MiB sbl1
4 171MiB 171MiB 0,50MiB sbl2
5 171MiB 172MiB 1,00MiB sbl3
6 172MiB 173MiB 1,00MiB rpm
7 173MiB 174MiB 1,00MiB tz
8 174MiB 175MiB 0,50MiB DDR
9 175MiB 179MiB 4,00MiB aboot
10 179MiB 180MiB 1,00MiB misc
11 180MiB 182MiB 2,85MiB logo
12 182MiB 183MiB 0,76MiB m9kefs1
13 183MiB 184MiB 0,76MiB m9kefs2
14 184MiB 184MiB 0,00MiB m9kefsc
15 184MiB 192MiB 8,11MiB bk1
16 192MiB 193MiB 0,76MiB m9kefs3
17 193MiB 256MiB 63,2MiB bk2
18 256MiB 271MiB 15,0MiB boot
19 271MiB 286MiB 15,0MiB boot1
20 286MiB 301MiB 15,0MiB recovery
21 301MiB 312MiB 11,0MiB bk3
22 312MiB 320MiB 8,00MiB ext4 persist
23 320MiB 832MiB 512MiB ext4 system
24 832MiB 1344MiB 512MiB ext2 system1
25 1344MiB 1728MiB 384MiB ext4 cache
26 1728MiB 5312MiB 3584MiB ext4 userdata
27 5312MiB 29820MiB 24509MiB ext4 storage
Mind that /dev/sdc refers to the block device of my phone and will differ on your system depending on the amount of other block devices connected and the type of your system. It's also best to backup either the entire block device (/dev/sdc) or at last the specific partitions you are going to be messing with (/dev/sdcXY) – this is doubly important for partitions <= 22, the correct content of which may be difficult to retrieve when damaged. Labels (most likely) aren't important, the partition numbers are, so make sure you keep the order of the partitions when fiddling with them.
After finishing, reconnect the phone to make the kernel recognize the new partition structure and create the filesystem (mkfs.ext4) for any partitions you have created. The following example makes the system and system1 partitions 1GiB each and the userdata partition 4GiB at the expense of the storage partition:
Code:
# parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) rm 23
(parted) rm 24
(parted) rm 25
(parted) rm 26
(parted) rm 27
(parted) mkpart physical ext4 320MiB 1344MiB
(parted) mkpart physical ext4 1344MiB 2368MiB
(parted) mkpart physical ext4 2368MiB 2752MiB
(parted) mkpart physical ext4 2752MiB 6848MiB
(parted) mkpart physical ext4 6848MiB 29819MiB
(parted) name 23 system
(parted) name 24 system1
(parted) name 25 cache
(parted) name 26 userdata
(parted) name 27 storage
(parted) quit
# sync
And then, after reattaching the phone to the computer:
Code:
# for i in /dev/sdc2[34567]; do mkfs.ext4 $i; done
# sync
Recovery mode
For booting into recovery, consult [3].
Booting into a custom recovery
Use the process described at [2], with steps 7-8 interchanged with 9-10. I used the emms_appsboot.mbm and recovery-clockwork-6.0.5.0-aries-20140718.img files (see List of files) from the fastboot mode as follows:
Code:
$ fastboot flash recovery recovery-clockwork-6.0.5.0-aries-20140718.img
$ fastboot flash aboot emmc_appsboot.mbn
$ fastboot boot recovery-clockwork-6.0.5.0-aries-20140718.img
If the phone gets stuck at booting during the last step, restart the phone and try again.
You should now be in the custom recovery. For me, this only lasted until a reboot. Then, the recovery was replaced with the stock one and it became impossible to boot into the system, effectively softbricking the phone. To fix this, flash the stock emmc_appsboot.mbm bootloader image extracted from the .zip of the MIUI ROM you are using and flash it from the fastboot mode:
Code:
$ fastboot flash aboot ./the/original/emmc_appsboot.mbn
$ fastboot continue
Fastboot mode
To boot into the fastboot mode, either:
Reboot the phone while holding the volume down button.
Run adb reboot bootloader against the phone in the system or in the recovery mode.
List of files
You don't need these files, it's only what I used, which should enable the reproducibility of my results.
xiaomi.eu_multi_aries_5.8.6_v6-5.0.zip – The MIUI6 v5.8.6 Czech ROM. Downloaded from [5].
emms_appsboot.mbm – A fixed bootloader for MIUI6 v5.8.6, which allows for the installation of recoveries other than the
built-in one (see Reinstalling the recovery). Downloaded from [2].
recovery-clockwork-6.0.5.0-aries-20140718.img – A recovery image of a custom version of the clockworkmod. Extracted from the archive downloaded from [1].
cm-11-20150802-NIGHTLY-aries.zip – An alternative ROM (Cyanogenmod 11). downloaded from [6].
Links
[2014-07-08] ClockworkMod Recovery 6.0.5.0
[Tools, Tips & Tutorials] [Device Team] How to get Custom Recoveries working again on Mi 2/2S with MIUI 6
[Tips & Tutorials] [Mods' Insight] Understanding Recovery mode & Download Mode
[SCRIPT] Fix partition table for Android 4.4
MIUIV6 OFFICIAL RELEASE
Browse Files for Samsung Galaxy S - aries
Hi, I updated partitioning tutorial to install Android 10: https://forum.xda-developers.com/t/guide-tutorial-howto-xiaomi-mi-2-2s-stock-to-android-10.4391775/

i9100 emulated sdcard, partition resizing and full disk encryption

I recently upgraded a Galaxy S2 to Cyanogenmod 12.1 / android 5.1. I also wanted to use full disk encryption with the device and being able to access the internal memory via MTP instead of having a mass storage device. The removable sd card may be accessed via MTP, too, but will not be encrypted. Updating the recovery images to reflect the changes in the storage configuration (in case this is necessary) is not in scope, either.
Cyanogenmod by default only encrypts the /data partition. Newer models emulate the sdcard storage and save the data to /data/media, so everything gets encrypted. However, being an older phone there is still a separate sdcard-partition on the phone which is physically and directly mounted and which will not be touched by encryption.
In order to achieve the goal of full disk encryption two steps are necessary:
1. Change storage configuration to emulated media
2. Shrink old /sdcard partition and grow /data partition
= Change storage configuration to emulated media =
Emulating the sdcard in /data/media instead of physically mounting it directly requires changes to fstab.hardware (fstab.smdk4210), storage_list.xml and init.hardware.rc (init.smdk4210.rc). These files have to be changed in the Cyanogenmod source code and compiled to a new image. The configuration is based on the "Emulated primary, physical secondary" example given in h t t p s : / / source . android . com / devices / storage / config-example.html (cannot properly post URL due to new user restriction).
Here are the relevant changes in init.hardware.rc (init.smdk4210.rc):
Code:
--- init.smdk4210.rc.bak 2015-11-22 23:01:49.259579157 +0000
+++ init.smdk4210.rc.final 2015-11-30 20:21:37.977943177 +0000
@@ -2,35 +2,47 @@
import init.gps.rc
on init
- export EXTERNAL_STORAGE /storage/sdcard0
+ export EXTERNAL_STORAGE /storage/emulated/legacy
+ export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
+ export EMULATED_STORAGE_TARGET /storage/emulated
export SECONDARY_STORAGE /storage/sdcard1
- mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
- mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
mkdir /mnt/media_rw/usbdisk0 0700 media_rw media_rw
- mkdir /storage/sdcard0 0770 root root
- mkdir /storage/sdcard1 0770 root root
+ mkdir /mnt/shell/emulated 0700 shell shell
+ mkdir /storage/emulated 0555 root root
+ mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
+ mkdir /storage/sdcard1 0700 root root
+
mkdir /storage/usbdisk0 0770 root root
+ mkdir /storage/sdcard1 0775 system system
+
mkdir /efs 0771 radio system
mkdir /preload 0771 system system
mkdir /mnt 0775 root system
mkdir /mnt/.lfs 0755 root root
# for backwards compatibility
- symlink /storage/sdcard0 /sdcard
- symlink /storage/sdcard0 /mnt/sdcard
- symlink /storage/sdcard1 /extSdCard
- symlink /storage/sdcard1 /mnt/extSdCard
symlink /storage/usbdisk0 /usbdisk0
symlink /storage/usbdisk0 /mnt/usbdisk0
+ symlink /storage/emulated/legacy /sdcard
+ symlink /storage/emulated/legacy /mnt/sdcard
+ symlink /storage/emulated/legacy /storage/sdcard0
+ symlink /mnt/shell/emulated/0 /storage/emulated/legacy
+ symlink /storage/sdcard1 /ext_card
+ symlink /storage/sdcard1 /mnt/ext_card
+
+
+
# Disable CFQ slice idle delay
write /sys/block/mmcblk0/queue/iosched/slice_idle 0
on fs
mount_all /fstab.smdk4210
+ setprop ro.crypto.fuse_sdcard true
+
swapon_all /fstab.smdk4210
mkdir /efs/bluetooth
@@ -428,11 +440,10 @@
oneshot
keycodes 114 115 116
-service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0
+service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
class late_start
- disabled
-service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
+service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
class late_start
disabled
Here are the relevant changes in fstab.hardware (fstab.smdk4210):
Code:
--- fstab.smdk4210.bak 2015-11-29 23:52:30.652913883 +0000
+++ fstab.smdk4210.final 2015-11-30 20:20:23.513945994 +0000
@@ -11,8 +11,8 @@
/dev/block/mmcblk0p12 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait
# vold-managed volumes ("block device" is actually a sysfs devpath)
-/devices/platform/dw_mmc/mmc_host/mmc0/mmc0* auto auto defaults wait,voldmanaged=sdcard0:11,nonremovable,noemulatedsd
-/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults wait,voldmanaged=sdcard1:auto,noemulatedsd
+/devices/platform/dw_mmc/mmc_host/mmc0/mmc0* auto auto defaults wait,voldmanaged=sdcard0:11,nonremovable
+/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults wait,voldmanaged=sdcard1:auto
/devices/platform/s3c_otghcd/usb* auto auto defaults voldmanaged=usbdisk0:auto
# recovery
Here are the relevant changes in storage_list.xml:
Code:
--- storage_list.xml.bak2 2015-11-30 21:38:14.565769302 +0000
+++ storage_list.xml.final 2015-11-30 21:43:21.697757684 +0000
@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<StorageList xmlns:android="h t t p : / / schemas . android . com / apk / res / android "(cannot properly post URL due to new user restriction)>
- <storage android:mountPoint="/storage/sdcard0"
- android:storageDescription="@string/storage_internal"
- android:primary="true"
- android:removable="false"
- android:allowMassStorage="true" />
+ <storage android:storageDescription="@string/storage_internal"
+ android:emulated="true"
+ android:mtpReserve="100" />
<storage android:mountPoint="/storage/sdcard1"
android:storageDescription="@string/storage_sd_card"
- android:primary="false"
android:removable="true"
- android:allowMassStorage="true" />
+ android:maxFileSize="4096" />
<storage android:mountPoint="/storage/usbdisk0"
android:storageDescription="@string/storage_usb"
@@ -18,3 +15,4 @@
android:removable="true" />
</StorageList>
Compile Cyanogenmod and flash your phone. It should boot, but the amount of available storage should be significantly lower as the sdcard is emulated on the /data partition which has not been grown, yet.
= Shrink old /sdcard partition and grow /data partition =
Use PIT Magic to resize the partitions to an appropriate size. For a stock i9100 having 16GB of internal memory my configuration was as follows (according to the backup .pit-file downloaded via heimdall):
Code:
DATAFS:
start: 1,392,640
block count: 4,194,304
end: 5,586,943
UMS:
start: 5,586,944
block count: 24,133,632
end: 29,720,575
Hidden:
start: 29,720,576
block count: 1,048,576
end: 30,769,151
I changed the partition layout to the following sizes:
Code:
DATAFS:
start: 1,392,640
block count: 28,295,167
end: 29,687,807
UMS:
start: 29,687,808
block count: 32,768
end: 29,720,575
Hidden:
start: 29,720,576
block count: 1,048,576
end: 30,769,151
Deleting the UMS or hidden partitions or shrinking the hidden led to Cyanogenmod not booting. Upload the new .pit-file using heimdall and boot the modified Cyanogenmod. Reboot to Cyanogenmod recovery and wipe data. Formatting again using the Cyanogenmod recovery was required as apparently only this recovery honours the "encryptable=footer,length=-16384" option for the /data partition in fstab.hardware which directs the formatting tools to leave 16 kiB of space at the end of the partition for in-place encryption.
Is there a way to achieve emulated SD, without changing source code and recompiling?
Like editing fstab and other config files?
I run CM13 at the moment and would like to achieve full encryption through emulated SD.
I was playing around with the idea that i would resize the sdcard partition to 8mb and resize the /data partition (~14gb), so that applications have a hefty space and i would use the external sdcard (sdcard1) for storing data and media files. Would that be possible to with an emulated sdcard ? I was hoping that with the introduction of Android 6.0 it would allow me to merge (LVM?) the /sdcard0 and /sdcard1 but instead it merges /data and /sdcard1.
fireburner-de said:
Is there a way to achieve emulated SD, without changing source code and recompiling?
Like editing fstab and other config files?
Click to expand...
Click to collapse
I cannot prove that there is no way without having to recompile. However, I couldn't find storage_list.xml in the filesystem on my phone, so I assume that this file is only used during image compilation and therefore it's probably hard/impossible to achieve emulated SD without recompiling.
Maybe this configuration is easier to achieve using Cyanogenmod 13 / Android 6 as the storage_list.xml resource overlay has been removed.
PelzigesOhr, thank you sharing and documenting your experience so well, it has inspired me to try the same on Replicant 4.2 (distro based on CyanogenMod 10).
https:// github . com / GrimKriegor / replicant42-device_samsung_galaxys2-common / commit / 84c5a91a45b059a147921d0ea32367534904b314
However it seems the best way to create a partition table is using PitMagic, which seems to be proprietary software. Would you consider sharing your PIT file please?
Thank you for your time, all of this is greatly appreciated!
EDIT:
If you still have memory of the heimdall parameters used to flash this partition table, please do share as well.
EDIT2:
Managed to create a PIT file similar to yours, thanks for documenting it.
The following thread also includes a patch compatible with Replicant/Android 4.2.
Best of luck!
redmine . replicant . us / boards / 39 / topics / 13707
GrimKriegor said:
Would you consider sharing your PIT file please?
Thank you for your time, all of this is greatly appreciated!
EDIT:
If you still have memory of the heimdall parameters used to flash this partition table, please do share as well.
EDIT2:
Managed to create a PIT file similar to yours, thanks for documenting it.
The following thread also includes a patch compatible with Replicant/Android 4.2.
Click to expand...
Click to collapse
Thanks for the praise, I'm happy that the instructions are of use to someone else. Good to know that you managed everything yourself, I'll answer anyway: This forum doesn't seem to support attachments, so I haven't attached the .pit-file. Feeding the parameters I provided to PIT Magic should yield a good result, though. PIT Magic is indeed a proprietary Windows binary, but it runs fine using wine (at least that's the way I use it).
All the flashing has been done by loading clockworkmodrecovery (
Code:
heimdall flash --KERNEL clockworkmodrecovery.6050.i9100.touch.img
) and afterwards sideloading the compiled ROM.
PelzigesOhr said:
Thanks for the praise, I'm happy that the instructions are of use to someone else. Good to know that you managed everything yourself, I'll answer anyway: This forum doesn't seem to support attachments, so I haven't attached the .pit-file. Feeding the parameters I provided to PIT Magic should yield a good result, though. PIT Magic is indeed a proprietary Windows binary, but it runs fine using wine (at least that's the way I use it).
All the flashing has been done by loading clockworkmodrecovery (
Code:
heimdall flash --KERNEL clockworkmodrecovery.6050.i9100.touch.img
) and afterwards sideloading the compiled ROM.
Click to expand...
Click to collapse
Thanks for the reply sir.
Which partitions did you upload via Heimdall when you flashed the PIT file? I believe repartitioning could delete the contents of important partitions such as BOOT and MODEM, but I am unsure. Do you think maintaining their block boundaries would preserve the data in the respective partitions?
guy i can't mount /storage/sdcard0
i use Cyanogenmod 12.1 android 5.1.1
i need help guy
GrimKriegor said:
Which partitions did you upload via Heimdall when you flashed the PIT file? I believe repartitioning could delete the contents of important partitions such as BOOT and MODEM, but I am unsure. Do you think maintaining their block boundaries would preserve the data in the respective partitions?
Click to expand...
Click to collapse
The exact command I used for repartitioning with Heimdall-1.3.1 was as follows:
Code:
heimdall flash --repartition --pit <filename>
Data should be preserved and if you don't mess with the boundaries of partitions other than DATAFS, UMS and HIDDEN you should be fine. Before repartitioning I backed up all partitions as a precautionary measure, but I didn't have to restore any of them. See also http://forum.xda-developers.com/galaxy-s2/orig-development/guide-enlarge-datafs-partition-rid-t2353551
PelzigesOhr said:
The exact command I used for repartitioning with Heimdall-1.3.1 was as follows:
Code:
heimdall flash --repartition --pit <filename>
Data should be preserved and if you don't mess with the boundaries of partitions other than DATAFS, UMS and HIDDEN you should be fine. Before repartitioning I backed up all partitions as a precautionary measure, but I didn't have to restore any of them. See also http://forum.xda-developers.com/galaxy-s2/orig-development/guide-enlarge-datafs-partition-rid-t2353551
Click to expand...
Click to collapse
Ah! This is excellent, thanks for clarifying this! Just one last question if I may, how did you backup the partitions? Did you use Heimdall to download their contents as image files, did you use DD or maybe even ADB?
Thank you for your time!
GrimKriegor said:
Just one last question if I may, how did you backup the partitions? Did you use Heimdall to download their contents as image files, did you use DD or maybe even ADB?
Click to expand...
Click to collapse
Good guess, I used dd and adb. Get a shell on the phone with adb and dump the partitions to files using dd:
Code:
dd if=/dev/block/mmcblk0pX of=/sdcard/mmcblk0pX.bin bs=512
And then copy the files to your computer using adb pull. You may want to get the mountpoints of the partitions (e.g. using mount) so that you can associate them easily.
Read here for an easy way to switch to emulated storage. Thanks to @Lanchon
https://forum.xda-developers.com/galaxy-s2/orig-development/mod-switch-emulated-to-emulated-t3539651

TWRP Flags for BoardConfig.mk

Check out this script by @yuweng to auto(matically|magically) compile TWRP for your device!
Lately the TWRP Compiling guide, has been seeing a lot of newbies who were struggling with TWRP flags to ensure they compile a usable build. So without delay, here we go!
If no input has been suggested, assume true/false
CREDITS :
@Android-Andi for some explanations here
@SdtBarbarossa for some more explanations here
@yuweng for HUGE amount of explanations provided through PM!
# Automatically implies these:
BOARD_HAS_NO_REAL_SDCARD := true
TW_USE_TOOLBOX := true
TW_EXCLUDE_SUPERSU := true
TW_EXCLUDE_MTP := true
TW_OEM_BUILD := true
# Add EXT4 support
TARGET_USERIMAGES_USE_EXT4 := true
# Disable/enable SELinux. Only suggested when you want to enable SELinux support
TWHAVE_SELINUX := true
# Remove MTP support
TW_EXCLUDE_MTP := true
# No screen timeout
TW_NO_SCREEN_TIMEOUT := true
# disables things like sdcard partitioning and may save you some space if TWRP isn't fitting in your recovery patition
BOARD_HAS_NO_REAL_SDCARD := true
# this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus
RECOVERY_SDCARD_ON_DATA := true
# HTC Dumlock for those devices which need it
TW_INCLUDE_DUMLOCK := true
Partition defines
Code:
TW_INTERNAL_STORAGE_PATH
TW_INTERNAL_STORAGE_MOUNT_POINT
TW_EXTERNAL_STORAGE_PATH
TW_EXTERNAL_STORAGE_MOUNT_POINT
# If your device has recovery as a second ramdisk of boot.img
TW_HAS_NO_RECOVERY_PARTITION := true
# To prevent /boot partition not found error
TW_HAS_NO_BOOT_PARTITION := true
# Removes the 'Reboot bootloader' button
TW_NO_REBOOT_BOOTLOADER := true
# Removes the 'Reboot recovery' button
TW_NO_REBOOT_RECOVERY := true
# Disable the battery percentage for devices where it doesn't work properly
TW_NO_BATT_PERCENT := true
# Same as above, for CPU Temperature
TW_NO_CPU_TEMP := true
# Allows you to map a custom keycode for power button, takes in a number, usually three digits
TW_CUSTOM_POWER_BUTTON := 107
# Always use rm -rf to wipe
TW_ALWAYS_RMRF := true
# Prevent TWRP from unmounting /system
TW_NEVER_UNMOUNT_SYSTEM := true
# Removes USB Storage capability
TW_NO_USB_STORAGE := true
# Inject TWRP as a second ramdisk for Samsung devices, which keep recoveries that way.
TW_INCLUDE_INJECTTWRP := true
TW_INCLUDE_BLOBPACK -- NEED HELP
# Specify a path to the lun file on device
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/class/android_usb/android0/f_mass_storage/lun0/file"
# Not very sure, I guess it allows you to simply pop in the lunfile itself
BOARD_UMS_LUNFILE :=
TW_HAS_DOWNLOAD_MODE -- For Samsung devices
TW_NO_SCREEN_BLANK -- NEED HELP
TW_SDEXT_NO_EXT4 -- Blocks EXT4 FS for SD-EXT partitions
# Forces use of /proc/cpuinfo for determining device id. Look here : https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/data.cpp#l183-l184
TW_FORCE_CPUINFO_FOR_DEVICE_ID := true
# For older devices. See here :https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/Android.mk#l383
TW_NO_EXFAT_FUSE := true
# Decryption support for /data
TW_INCLUDE_CRYPTO -- General decryption modules
# On some device, TWRP backup folder name will show 0000000000 bcos cpuinfo has no serial number. Using this flag then it will use ro.product.model as the folder name instead of all 0000000000
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true
# Set the path to the sysfs entry which controls the brightness
TW_BRIGHTNESS_PATH := /sys/devices/platform/s3c24xx-pwm.0/pwm-backlight.0/backlight/pwm-backlight.0/backlight
# A seconday path for the above
TW_SECONDARY_BRIGHTNESS_PATH :=
# Max brightness to prevent display damage
TW_MAX_BRIGHTNESS := 255
# Default brightness for TWRP
TW_DEFAULT_BRIGHTNESS := 150
# Custom battery readout path, don't use the given path though, it is intended to be used for a full diagnostic.
TW_CUSTOM_BATTERY_PATH := /sys/class/power_supply/battery/batt_attr_text
# CPU temp sysfs path, if it is zero all the time.
TW_CUSTOM_CPU_TEMP_PATH := true
# Remove the ability to encrypt backups with a password
TW_EXCLUDE_ENCRYPTED_BACKUPS := true
# Timezone fixes for some Qcom devices.
TARGET_RECOVERY_QCOM_RTC_FIX
TW_NO_LEGACY_PROPS -- NEED HELP
# Supply a custom init.rc for the recovery
TARGET_RECOVERY_INITRC := device/htc/pico/ramdisk/recovery/init.recovery.rc
# Set the default language, if not english
TW_DEFAULT_LANGUAGE := en-US
# Specify architecture
TARGET_ARCH := arm
# For people who would want to have ToyBox rather than Busybox
TW_USE_TOOLBOX := true
# Remove exFAT formatting binaries
TW_NO_EXFAT := true
# Remove SuperSU and stop TWRP prompts to install it
TW_EXCLUDE_SUPERSU := true
# An awesome way to take screenshots. Back-end improvement, no noticeable user side changes. Screenshots work without it too
TW_INCLUDE_FB2PNG := true
BOARD_USES_BML_OVER_MTD -- NEED HELP
# include Logcat daemon for help in debugging
TWRP_INCLUDE_LOGCAT := true
# See here : https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/Android.mk#L435
TARGET_RECOVERY_DEVICE_MODULES := true
TARGET_USERIMAGES_USE_F2FS -- Include mkfs.f2fs for formatting partitions as F2FS
# Include a custom hardwarekeyboard.cpp . Can't see the point though.
TWRP_CUSTOM_KEYBOARD := device/lge/hammerhead/recovery/hardwarekeyboard.cpp
# Log touch input
TWRP_EVENT_LOGGING := true
# @yuwneg :My experience on MTK tablet, typical is RECOVERY_TOUCHSCREEN_SWAP_XY & RECOVERY_TOUCHSCREEN_FLIP_Y is use is pair as MTK vendor tend to use landscape LCD but a normal portrait Touch Screen !
TW_X_OFFSET -- X-Axis offset for borked displays
TW_Y_OFFSET -- Y-Axis offset for borked displays
# Smartwatch optimisation
TW_ROUND_SCREEN := true
TW_THEME -- New flag, takes in the following : portrait_mdpi, landscape_mdpi, portrait_hdpi,landscape_hdpi,watch_mdpi . It should be caps but when I was compiling a minute ago, it threw me an error and asked to de-caps it. So, see for yourself what works
TW_CUSTOM_THEME -- Use a custom theme like materialised by @z31s1g . Give the path to the contents here.
TWRP_NEW_THEME -- Old is gold. Put false to use the old one.
TW_EXTRA_LANGUAGES -- Set to true and enable localisation
TW_MTP_DEVICE -- Specify a custom device name for MTP
TW_TARGET_USES_QCOM_BSP -- Qcom specific enhancements
TARGET_PREBUILT_KERNEL -- Use a prebuilt kernel rather than building from source
TARGET_RECOVERY_PIXEL_FORMAT -- Use RGBA,RGBX,ARGB and whatever, I don't remember, see the main thread for that info.
TARGET_RECOVERY_OVERSCAN_PERCENT -- Defines the padding to leave around the screen edges
BOARD_USE_CUSTOM_RECOVERY_FONT -- Specify a .ttf file to use as default font
BOARD_CUSTOM_GRAPHICS -- include customised graphics backends if 3.0.0-0 broke stuff for you
TARGET_CUSTOM_KERNEL_HEADERS -- NEED HELP
TW_NEW_ION_HEAP -- NEED HELP
Self Explanatory
Code:
RECOVERY_TOUCHSCREEN_SWAP_XY
RECOVERY_TOUCHSCREEN_FLIP_X
RECOVERY_TOUCHSCREEN_FLIP_Y
RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH -- Fixes slanty graphics
TW_DISABLE_DOUBLE_BUFFERING -- NEED HELP
TARGET_RECOVERY_FORCE_PIXEL_FORMAT -- NEED HELP FOR POSSIBLE INPUTS
BOARD_HAS_FLIPPED_SCREEN -- For people whose screens were mounted the wrong side across
TW_IGNORE_MAJOR_AXIS_0 -- NEED HELP
TW_IGNORE_MT_POSITION_0 -- NEED HELP
TW_IGNORE_ABS_MT_TRACKING_ID -- NEED HELP
TW_INPUT_BLACKLIST -- NEED HELP
TW_WHITELIST_INPUT -- NEED HELP
TARGET_HW_DISK_ENCRYPTION -- NEED HELP
TW_HAVE_X86_ACCELERATED_PIXELFLINGER -- Improvements for x86 based devices
ARCH_ARM_HAVE_NEON -- Take advantage of ARM-NEON optimisations
# remove TrueType fonts
TW_DISABLE_TTF:= true
# building of an OEM friendly TWRP. excludes SuperSu, uses Toolbox instead busybox, disables themeing. MORE INFOS TO BE ADDED
TW_OEM_BUILD := true
# Adds EXT4 formatting binaries
TARGET_USERIMAGES_USE_EXT4 := true
# exclude mtp from twrp (disable if you are not able to fix it device/kernel side, safes some space)
TW_EXCLUDE_MTP := true
# screen will stay awake
TW_NO_SCREEN_TIMEOUT := true
# needed on devices without a recovery partition (some devices have recovery included im boot.img)
TW_HAS_NO_RECOVERY_PARTITION := true
# removes the reboot option to boot into boooader, needed e.g. on samsung devices which use Download mode instead
TW_NO_REBOOT_BOOTLOADER := true
# add an option in reboot menu to reboot into Download Mode
TW_HAS_DOWNLOAD_MODE := true
# some devices don't have a temp sensor, disable in such case to stop spamming recovery.log
TW_NO_CPU_TEMP := true
# recursive delete by default instead fotmatting (available optional inside recovery settings too)
TW_ALWAYS_RMRF := true
# system won't be unmounted,
TW_NEVER_UNMOUNT_SYSTEM := true
# don't blank screen (available optional inside recovery settings too)
TW_NO_SCREEN_BLANK := true
# deprecated, use TW_INCLUDE_CRYPTO instead
TW_INCLUDE_JB_CRYPTO := true
# add support for encryption
TW_INCLUDE_CRYPTO := true
# use a custom init.rc in recovery, add the path. Example:
TARGET_RECOVERY_INITRC := device/samsung/p3100/rootdir/init.twrp.rc
# ToyBox (disables busybox?)
TW_USE_TOOLBOX := true
# exclude SuperSu e.g. to save some space or for different other reasons (supersu still included bx default?)
TW_EXCLUDE_SUPERSU := true
# include f2fs support (make sure your kernel supports f2fs!)
TARGET_USERIMAGES_USE_F2FS := true
# device resolution - deprecated, use TW_THEME instead
DEVICE_RESOLUTION :=
# define the theme for your device resolution, note: you can also use smaller/bigger themes because the theme get scaled for your deviceresolution anyway):
# 240x240 280x280 320x320
TW_THEME := watch_mdpi
# 320x480 480x800 480x854 540x960
TW_THEME := portrait_mdpi
# 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
TW_THEME := portrait_hdpi
# 800x480 1024x600 1024x768
TW_THEME := landscape_mdpi
# 1280x800 1920x1200 2560x1600
TW_THEME := landscape_hdpi
# auto copy files placed in device/$VENDOR/$DEVICENAME/recovery/root inside recovery ramdisk (e.g. init.recivery*.rc which get removed from recoveryramdisk by default). example:
TARGET_RECOVERY_DEVICE_DIRS += device/samsung/espresso-common
# path to a prebuild kernel (can be used if you are unable to compile a kernel yourself, e.g. if no kernel source available)
TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/prebuilt/zImage
# swap x anf y axis for touch
RECOVERY_TOUCHSCREEN_SWAP_XY := true
# flip x axis for touch
RECOVERY_TOUCHSCREEN_FLIP_X := true
# flip y axis for touch,
RECOVERY_TOUCHSCREEN_FLIP_Y := true
Gesendet von meinem LG-H815 mit Tapatalk
---------- Post added at 05:23 PM ---------- Previous post was at 05:19 PM ----------
# don't include default init.recovery.usb.rc, provide your own or use needed defines inside init.recovery.$DEVICE.rc
TW_EXCLUDE_DEFAULT_USB_INIT := true
Gesendet von meinem LG-H815 mit Tapatalk
Android-Andi said:
...
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Thanks sir for the suggestions. I can see I've included the descriptions for most of them already, but I'll be sure to attribute to and add the rest tomorrow. I would be grateful if you could shed some light on the ones I've marked "NEED HELP"
MSF Jarvis said:
Thanks sir for the suggestions. I can see I've included the descriptions for most of them already, but I'll be sure to attribute to and add the rest tomorrow. I would be grateful if you could shed some light on the ones I've marked "NEED HELP"
Click to expand...
Click to collapse
I've done those stuff offline from your gist[emoji14]have seen this thread after that but maybe you like the way i showed the defines as it's setup the way you would do in your BoardConfig.mk.
Haven't done those flags i am not sure about myself, maybe @_that or @Dees_Troy can bring light to some of them.
Gesendet von meinem LG-H815 mit Tapatalk
This thread is a great idea.
Especially with the update to twrp 3.0 with new flags.
I've been lucky enough to be able to guess/puzzle out/grab from other device trees enough to build and use the recovery on my personal devices, but information like this is very helpful to have consolidated.
Thanks for sharing.
Android-Andi said:
I've done those stuff offline from your gist[emoji14]have seen this thread after that but maybe you like the way i showed the defines as it's setup the way you would do in your BoardConfig.mk.
Haven't done those flags i am not sure about myself, maybe @_that or @Dees_Troy can bring light to some of them.
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Yeah, I just didn't have enough time to beautify it. Will gradually do so.
TW_CUSTOM_THEME := /path/to/theme/
this one is used to replace the stocktheme with a different one (like material-play)
the theme will be directly in ramdisk
TW_INCLUDE_INJECTTWRP := true — adds ability to inject TWRP into some Samsung boot images for Samsung devices that have recovery as a second ramdisk in the boot image
the second flag is quotes by dees_troy!
TW_NEW_ION_HEAP
this has sonething to do with 3.10 kernels and a different naming in /include/linux/ion.h ... like a switch between old heap_mask and new heap_id_mask
Sent from my Xperia T using XDA Free mobile app
Nice initiative with this thread, this has been oh say 2 years too long in the making haha.
TARGET_RECOVERY_FORCE_PIXEL_FORMAT
Not sure but I would imagine it overrides what TWRP detects nor do I see the difference between it and TARGET_RECOVERY_PIXEL_FORMAT. The only possible varible right now is RGB_565. BGRA_8888, RGBA_8888 and RGBX_8888 are not yet implemented.
TW_INPUT_BLACKLIST
Black list input devices that interfere with touch. For multiple input devices the delimiter is \x0a. You would basically build a special TWRP with TWRP_EVENT_LOGGING := true. Put it on the device and read the more verbose log to see what inputs you want to blacklist.
EDIT: Ah here is a copy of the wording I had in one of my xda posts about the subject and the commit link https://github.com/omnirom/android_bootable_recovery/commit/5742a40b87dfdc26df3bd9fe94197ae414ece546
Usage:
TW_INPUT_BLACKLIST := accelerometer
TW_INPUT_BLACKLIST := "accelerometer\x0agyroscope"
This can be used to fix touch input on devices where an input
device is breaking touch processing in TWRP.
We are using new line chars to separate multiple devices and in
the make file you specify the new line character with \x0a which
is the hex code in ASCII for a new line.
The new line character might be a bit of a pain to use as a
delimeter, but it is highly unlikely that an OEM will ever name
an input device with a new line character in the name.
Change-Id: I255136b7a686909a23e649918c661843153c2853
Click to expand...
Click to collapse
and here is an example from my BoardConfig
TW_INPUT_BLACKLIST := "accelerometer\x0admard06\x0alis3dh_acc\x0alis3de_acc"
On a side note is there a link somewhere to fixing graphics issues induced in 3.0? I see a lot of talk about it but nothing substantial.
aicjofs said:
On a side note is there a link somewhere to fixing graphics issues induced in 3.0? I see a lot of talk about it but nothing substantial.
Click to expand...
Click to collapse
Not really. Slanty graphics can be fixed with linelength, but as such there's nothing on that front. You might wanna slap a recovery.log onto Dees_Troy at #twrp on webchat.freenode.net though.
Every version has new flags introduced & also flags deprecated...
TARGET_USES_LOGD => Source
TW_SCREEN_BLANK_ON_BOOT ( Deprecated on android-6.0 => Source, on some legacy devices, TWRP will not boot without this flag)
Dees_Troy said:
There are other build flags which you can locate by scanning the Android.mk files in the recovery source. Most of the other build flags are not often used and thus I won't document them all here.
Source
Click to expand...
Click to collapse
Use the_silver_searcher, its extremely fast ! :good:
Code:
cd ~/cm/bootable
ag -ia "[URL="https://gerrit.omnirom.org/#/c/16610/"]TW_INCLUDE_JPEG[/URL]" recovery/
recovery/minuitwrp/resources.cpp
34:#ifdef TW_INCLUDE_JPEG
256:#ifdef TW_INCLUDE_JPEG
361:#ifdef TW_INCLUDE_JPEG
367:#ifdef TW_INCLUDE_JPEG
recovery/minuitwrp/Android.mk
61:ifneq ($(TW_INCLUDE_JPEG),)
64: LOCAL_CFLAGS += -DTW_INCLUDE_JPEG
176:ifneq ($(TW_INCLUDE_JPEG),)
recovery/prebuilt/Android.mk
126:ifneq ($(TW_INCLUDE_JPEG),)
Code:
ag -ia "[COLOR="Blue"]TW_FLASH_FROM_STORAGE[/COLOR]" recovery/
recovery/Android.mk
262:#ifeq ($(TW_FLASH_FROM_STORAGE), true) [COLOR="Blue"]Making this the default behavior[/COLOR]
263: LOCAL_CFLAGS += -DTW_FLASH_FROM_STORAGE
As the code says, its already the default therefore you don't need to specify it again on BoardConfig.mk
Code:
ag -ia "[URL="https://gerrit.omnirom.org/#/c/14099/"]TW_INCLUDE_NTFS_3G[/URL]" recovery/
recovery/Android.mk
440:ifeq ($(TW_INCLUDE_NTFS_3G),true)
recovery/prebuilt/Android.mk
201:ifeq ($(TW_INCLUDE_NTFS_3G),true)
At the omnirom gerrit, you'll find all commits though you gotta search for it or try this or this for TWRP related
Code:
ag -ia "[COLOR="blue"]TW_BOARD_CUSTOM_GRAPHICS[/COLOR]" recovery/
recovery/minuitwrp/Android.mk
14:ifneq ($(TW_BOARD_CUSTOM_GRAPHICS),)
16: $(warning * TW_BOARD_CUSTOM_GRAPHICS support has been deprecated in TWRP. *)
Code:
ag -ia "[COLOR="Blue"]TW_DISABLE_TTF[/COLOR]" recovery/
recovery/minuitwrp/Android.mk
165:ifeq ($(TW_DISABLE_TTF), true)
167: $(warning * TW_DISABLE_TTF support has been deprecated in TWRP. *)
recovery/prebuilt/Android.mk
192:ifneq ($(TW_DISABLE_TTF), true)
Code:
BOARD_SUPPRESS_SECURE_ERASE := true
BOARD_SUPPRESS_EMMC_WIPE := true
Source, further explanation here
Code:
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixr!
Fix tzdata on recovery.log => Source
AIO-TWRP-Compiler on BBQLinux
First step
Refer to here on how to setup BBQLinux either native boot, dual-boot or on VBox... :good:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download the script & extract it to your HOME or if you are 100% sure that you have already setup a fully working Build Environment on Ubuntu or any other linux distro then remark these lines.
Start Terminal => Edit => Profile Preferences => Colors => unchecked => Use colors from system theme => Built-in schemes => White on Black => Close
BBQLinux => Menu => Administration => BBQLinux Python Switcher => Python 2
BBQLinux => Menu => Administration => BBQLinux Java Switcher => OpenJDK 7
Start the script with below command
Code:
sh twrp
Menu 1
You can use either OmniROM or Cyanogenmod repo to build TWRP
Choose either to use TWRP branch android-5.1 or android-6.0. Typically, for legacy devices with ICS or JB doesn't support TTF so if TWRP android-6.0 doesn't boot then you'll have to use android-5.1 branch.
You can either choose to use Full-Source or Part-Source. Compiled out recovery.img will have exactly the same size & files on ramdisk.
Yes, Part-Source is only using 41 of the projects to build a fully working TWRP. Syncing in progress. After syncing, you can refer to ~/AIO-TWRP-Compiler/sync.log for any error
Typically, when you have already downloaded the base repo, re-syncing it will only take a few seconds
Menu 2
Copy either your boot or recovery.img to ~/AIO-TWRP-Compiler folder
Key-in your vendor name
Key-in your device name
This step is extracting the ro.product.device & ro.product.model from your device directly which is typically require for identification when flashing update.zip from your vendor
Credits to RD osm0sis, the script will auto download osm0sis's unpackbootimg for mkbootimg arguments required for repacking recovery.img . . . :good:
mkbootimg arguments will be display & auto updated to the BoardConfig.mk
Part of the original mkvendor.sh script is adapted for the extraction of boot or recovery.img which also does the git initialization. If the ramdisk can be unpack then the recovery.fstab will be copied to the device tree folder, if not then it will create a basic MTK recovery.fstab, boot.mk & also BOARD_CUSTOM_BOOTIMG_MK. If you're not building for MTK then remove that line from BoardConfig.mk
You will need to add/ remove TWRP flags accordingly & manual edit on the TARGET_CPU_VARIANT either cortex-a7 or cortex-a9 for older MTK, refer to your device spec. Possible values are cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, scorpion. Use generic for devices that do not have a CPU similar to any of the supported cpu variants
You will need to manual edit on the recovery.fstab to suit your device or TWRP-ify the extracted stock recovery.fstab
Menu 3
omni.dependencies is only a warning, will continue to build when you choose OmniROM repo
Make 4.1 is only a warning, will continue to build
Java 1.7 is only a warning, will continue to build
When you have build earlier, subsequent build will only take few minutes bcos of CCACHE... :good:
Menu 4
Updated Menu 4 support for Others. Or you can use Flashify or Rashr or above Others to install compiled recovery.img to your device, do check if they are compatible or it will brick your recovery or worse, whole device !
Key-in your device recovery partition path. Above is typical for LG
Done, test TWRP on your device to make sure it is working properly if not then add or remove flags accordingly & use Menu 3 to build again
Menu 5
Choose either Option 1 or 2, Option 2 is recommended & it won't take long if you are using Part-Source.
Menu 6
The script will auto open up a new browser for you to register a new account on github
Your device tree on github
AIO-TWRP-Compiler
bash script itself is self-explanatory. Thanks to the OP, he has offer to take over the maintenance of this script so hit your Thanks button to him... :good: If you found any error/ bug or have any new ideas/ features for this script then pm the OP or do a git pull request... :good:
Above is the detail explanation on the script GUI front-end, here i'll explained what the script actually does.
Menu 1
This menu will create a local_manifest.xml to remove unwanted projects based on your selection. When select Full-Source, it will also create local_manifest.xml to remove existing recovery & replace it with TWRP based on your selection.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="android_bootable_recovery" />
<project path="bootable/recovery" name="omnirom/android_bootable_recovery" revision="[COLOR="Blue"]android-6.0[/COLOR]" />
</manifest>
Part-Source
It is normal that OmniROM & CM will consistently add new projects to their repo when they introduce new features or functions to it. The beauty of this Part-Source is that even when projects grows, this script will grep -v only the needed projects for building TWRP on any base repo.
This Part-Source is the extreme minimal for building TWRP therefore some of the additional projects are needed when you use particular TWRP flags. As of today ( March 2016 ), it will build a fully working TWRP with only 44 projects on both OmniROM 4.4 & CM 11 base repo. In the future, Teamwin may also add a new feature or function then you will also need to add additional projects to it too or OP will update it based on your feedback. Refer to compile.log for details.
Code:
# Optional => TARGET_USERIMAGES_USE_F2FS := true
[COLOR="Red"]#[/COLOR]grep -v f2fs-tools ~/x > ~/x.tmp;mv ~/x.tmp ~/x
If you use TARGET_USERIMAGES_USE_F2FS := true then remove the remark #
Code:
# Optional => TW_INCLUDE_NTFS_3G := true
[COLOR="Red"]#[/COLOR]grep -v external/ntfs-3g ~/x > ~/x.tmp;mv ~/x.tmp ~/x
if you use TW_INCLUDE_NTFS_3G := true then remove the remark #
Code:
# Optional => TW_USE_TOOLBOX := true
[COLOR="red"][B]#[/B][/COLOR]grep -v external/toybox ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="Red"]#[/COLOR]grep -v external/mksh ~/x > ~/x.tmp;mv ~/x.tmp ~/x
If you use TW_USE_TOOLBOX := true then remove the remark #. toybox available on android-6.0/ cm-13.0 only, don't have such projects on android-4.4 but it'll work, refer to the end for more info.
Code:
# un-remark the below required for x64
[COLOR="Red"]#[/COLOR]grep -v linux-x86/aarch64/aarch64-linux-android-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/aarch64/aarch64-linux-android-4.9 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
Code:
TARGET_ARCH := arm64
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 := armeabi-v7a
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_VARIANT := generic
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a7
If you are building x64 TWRP then remove the remark # & update BoardConfig.mk accordingly. Take note, not available on android-4.4/ cm-11.0 base repo, use later base repo.
Code:
# un-remark the below required for kernel compiling if not using TARGET_PREBUILT_KERNEL
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.6 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.7 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
if you are building your own kernel then remove the remark #
Code:
# Optional for x86 SoC
[COLOR="Red"]#[/COLOR]grep -v linux-x86/x86/i686-linux-android-4.7 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/x86/x86_64-linux-android-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/x86/x86_64-linux-android-4.9 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
Code:
TARGET_ARCH := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_ABI := armeabi
TARGET_ARCH_VARIANT := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_VARIANT := [COLOR="blue"]x86[/COLOR]
if you are building for Intel SoC then remove the remark # & edit the BoardConfig.mk accordingly
This script has been tested & it works on any base repo from OmniROM android-4.4, 5.0, 5.1 & 6.0 & Cyanogenmod cm-11.0, cm-12.0, cm12.1 & cm13.0 using Full-Source or Part-Source but why use Full-Source to build TWRP when Part-Source works, most importantly, you are not building OmniROM or Cyanogenmod but TWRP.... Using android-4.4/ cm-11.0 base repo has its advantage, compiled TWRP size will be smaller & it can build all version.
If you use android-6.0/ cm-13.0 then obviously you can only build TWRP android-6.0 only, just edit the line 62, 63 for OmniROM or 72, 73 for CM accordingly. Building TWRP android-4.4 on cm-13.0 or on OmniROM android-6.0 will result in a build error ! Later base repo won't build TWRP older version !
Many newbies doesn't know that OmniROM/ CM repo are incremental updates & they create a separate cm11, cm12, cm12.1, cm13 each & sync individually to each of these folders.
Above syncing cm-13.0 & as you can see, it is also using source from cm-10.1, 10.2 & 11. Syncing all to the same ~/omni or ~/cm folder will do.
Sometimes on certain devices, OmniROM android-4.4 or Cyanogenmod cm-11.0 base repo just won't boot then you can try by editing this line to android-5.0 or cm-12.0 & updating it will only take a very short time if you use Part-Source.
Menu 2
Device tree
This script will create a barebone minimal device tree for building TWRP. Anything less will result in a build error. It will create five files which is just sufficient to build a fully working TWRP using prebuilt kernel. It will build kernels too, just update the correct kernel config to BoardConfig.mk & remove the remark # needed projects for building kernels. However, i don't see the needs to build the same kernel with every TWRP new build, it will take a longer time to build, most importantly, you are not building a ROM.
Code:
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/cm_[COLOR="blue"]device name that you have key-in[/COLOR].mk
AndroidProduct.mk
Code:
TARGET_ARCH := arm
TARGET_CPU_ABI := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := [COLOR="blue"]cortex-a9[/COLOR] [COLOR="Red"]<= You only need to change this to suit your device[/COLOR]
BOARD_RECOVERYIMAGE_PARTITION_SIZE := [COLOR="Red"]0x105c0000[/COLOR] [COLOR="red"]<= You need to update this so that build will error out when the size exceed your recovery partition size[/COLOR]
BOARD_FLASH_BLOCK_SIZE := 131072
TARGET_PREBUILT_KERNEL := device/TD2/9300/kernel
BOARD_MKBOOTIMG_ARGS := --base 10000000 --pagesize 2048 --kernel_offset 00008000 --ramdisk_offset 01000000 --tags_offset 00000100
[COLOR="Blue"]#MTK common twrp flags[/COLOR] [COLOR="Red"]<= You only need to change the below flags to suit your device[/COLOR]
TW_NO_EXFAT := true
TWHAVE_SELINUX := true
TW_DISABLE_TTF := true [COLOR="red"]<= Will error out on TWRP android-6.0[/COLOR]
[COLOR="red"]#[/COLOR]TW_USE_TOOLBOX := true [COLOR="red"]<= You'll need extra projects for this flag, edit the script accordingly[/COLOR]
TW_NO_EXFAT_FUSE := true
TW_THEME := [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/gui/Android.mk#l96-L100"]portrait_mdpi[/URL]
[COLOR="red"]#[/COLOR]RECOVERY_SDCARD_ON_DATA := true [COLOR="red"]<= For [URL="https://twrp.me/faq/datamedia.html"]data/media[/URL] device[/COLOR]
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/mt_usb/gadget/lun%d/file"
BoardConfig.mk
Code:
# Inherit device configuration
$(call inherit-product, device/[COLOR="blue"]TD2[/COLOR]/[COLOR="blue"]9300[/COLOR]/device_[COLOR="blue"]9300[/COLOR].mk)
## Device identifier. This must come after all inclusions
PRODUCT_DEVICE := [COLOR="blue"]9300[/COLOR]
PRODUCT_NAME := cm_[COLOR="blue"]9300[/COLOR]
PRODUCT_BRAND := [COLOR="blue"]TD2[/COLOR]
PRODUCT_MODEL := [COLOR="blue"]9300[/COLOR]
PRODUCT_MANUFACTURER := TD2
Code:
$(call inherit-product, build/target/product/[URL="https://github.com/CyanogenMod/android_build/blob/cm-11.0/target/product/full_base_telephony.mk"]full_base_telephony.mk[/URL])
# Time Zone data [COLOR="red"]<= This have been disable as some device will not boot, to enable it just remove the remark [B]#[/B] below[/COLOR]
[COLOR="red"]#[/COLOR]PRODUCT_COPY_FILES += \
[COLOR="Red"]#[/COLOR]bionic/libc/zoneinfo/tzdata:recovery/root/system/usr/share/zoneinfo/tzdata
PRODUCT_BUILD_PROP_OVERRIDES += \
PRODUCT_MODEL="i9300" \ [COLOR="Red"]<= This is where Menu 2 will get the ro.product.device & ro.product.model info[/COLOR]
TARGET_DEVICE="bird77_a_cu_ics2"
PRODUCT_NAME := full_[COLOR="Blue"]9300[/COLOR]
PRODUCT_DEVICE := [COLOR="blue"]9300[/COLOR]
device_(device-name).mk & cm.mk will be auto-created based on what you have key-in for the vendor & device name at Menu 2
For building recovery, you don't need to use full.mk, using it will result in need of extra projects on the Part-Source & it will also copy the extra fstab.goldfish & ueventd.goldfish.rc to the root of the ramdisk
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/recovery emmc /dev/recovery
/system ext4 /dev/block/mmcblk0p3
/cache ext4 /dev/block/mmcblk0p4
/data ext4 /dev/block/mmcblk0p5
/emmc vfat /dev/block/mmcblk0p6 flags=display="Phone Storage";settingsstorage
/sdcard vfat /dev/block/mmcblk1p1 flags=display="SD Card";storage;removable
/sd-ext auto /dev/block/mmcblk1p2
/nvram emmc /dev/nvram flags=display="Nvram";backup=1
/uboot emmc /dev/uboot flags=display="Uboot";backup=1
#/boot emmc /dev/block/platform/mtk-msdc.0/by-name/boot flags=display="Boot";backup=1
#/recovery emmc /dev/block/platform/mtk-msdc.0/by-name/recovery flags=display="Recovery";backup=1
#/system ext4 /dev/block/platform/mtk-msdc.0/by-name/system flags=display="System";backup=1
#/cache ext4 /dev/block/platform/mtk-msdc.0/by-name/cache flags=display="Cache"
#/data ext4 /dev/block/platform/mtk-msdc.0/by-name/userdata flags=encryptable=/dev/block/platform/mtk-msdc.0/by-name/metadata
#/nvram emmc /dev/block/platform/mtk-msdc.0/by-name/nvram flags=display="Nvram";backup=1;flashimg=1
#/external_sd auto /dev/block/mmcblk1p1 flags=display="External SDcard";storage;wipeingui;removable;backup=0
#/usbotg auto /dev/block/sda1 flags=display="Usb-Otg";storage;removable;backup=0
#/boot mtd boot
#/recovery mtd recovery
#/cache yaffs2 cache
#/data yaffs2 userdata
#/misc mtd misc
#/system yaffs2 system
#/sdcard vfat /dev/block/mmcblk0p1
#/sd-ext ext4 /dev/block/mmcblk0p2
recovery.fstab - Edit or delete whatever that is not relevant to your device. Use osm0sis AIK to unpack your stock recovery.img & TWRP-ify the recovery.fstab... :good:
Code:
#
# Copyright (C) 2013 Intel Mobile Communications GmbH
#
# Sec Class: Intel Confidential (IC)
#
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID068 /system ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID069 /data ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID070 /cache ext4 defaults defaults
/dev/block/mmcblk1p1 /sdcard vfat defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID076 /nvm_fs_partition ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID074 /misc emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID071 /boot emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID119 /recovery emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID120 /recoverym emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID001 /mobilevisor emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID013 /splash_screen emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID115 /mvconfig emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID118 /secvm emmc defaults defaults
Most latest Android devices are using fstab version 2 AKA fstab 2 while TWRP is using fstab 1. Eg. Above is my Intel X3 stock recovery.fstab
Code:
# mount point fstype device [device2]
/boot emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID071
/recovery emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID119 flags=display=recovery;backup=1
/imei emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID022 flags=display=imei;backup=1
/mobilevisor emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID001 flags=display=mobilevisor;backup=1
/mvconfig emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID115 flags=display=mvconfig;backup=1
/secvm emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID118 flags=display=secvm;backup=1
/system ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID068
/data ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID069
/cache ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID070
/nvm_fs_partition ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID076
/external_sd vfat /dev/block/mmcblk1p1 flags=display="Micro SDCard";storage;removable
/usbotg auto /dev/block/sda1 flags=display=USB-OTG;storage;removable
My TWRP-ify recovery.fstab. Typically, for ext4 partition, you don't need to specify flags=display= & backup=1, it will be taken care of by TWRP, for more info regarding fstab flags then refer to Main Thread for *RECOVERY.FSTAB*... :good:
RD osm0sis's unpackbootimg is able to extract --second <2ndbootloader-filename> & also --second_offset <address>
The repack arguments will be auto-updated to the BoardConfig.mk Thanks to RD osm0sis. Some TWRP flags ref taken from here... :good:
osm0sis's unpackbootimg also support --dt <filename> :good:
Some devices require additional info for factory update.zip then add it accordingly to the device tree, typically is your device_(device-name).mk. Look at other device tree here & here & here for reference. On CM base repo, you can also use mkvendor.sh... :good: However, you will need to manually edit certain files as no DEV has been updating it, currently it will result in a build error even when using Full-Source !
Do take note that even an extra space on some of the lines at BoardConfig.mk will result in a build error !
Menu 3
Below are the commands to build TWRP, thats it !
Code:
cd ~/omni
[COLOR="blue"]OR[/COLOR]
cd ~/cm
prebuilts/misc/linux-x86/ccache/ccache -M 25G
export USE_CCACHE=1
export LC_ALL=C
source build/envsetup.sh
lunch [COLOR="blue"]omni[/COLOR]_S939-eng [COLOR="blue"]<= S939 is the device name[/COLOR]
[COLOR="Blue"]OR[/COLOR]
lunch [COLOR="blue"]cm[/COLOR]_S939-eng
make -j4 recoveryimage
Menu 4
Below command generically will work on most Android devices. Updates : Has updated this menu to support this, just key-in /path-to-your-device-recovery-partition
Code:
adb push [COLOR="blue"]$OUT[/COLOR]/recovery.img /data/local/tmp
adb shell su -c "dd if=/data/local/tmp/recovery.img of=/[COLOR="blue"]path-to-your-device-recovery-partition[/COLOR]"
To use the $OUT path, you must first source it then lunch your device name, refer to previous Menu 3 for info.
Menu 5
Option 1 is make clean
Option 2 is wipe the whole repo base folder except the hidden .repo folder. As mention on the script GUI front-end, after that, use Menu 1 will have all the files extracted out.
Menu 6
This menu is using curl to create github repo.
It is for you to publish your device tree either for diagnostic & debugging when you ask for help. It is also for you to share a working build so that others can refer to it when they make a build of their own or git clone yours & build it themselves.
Preface & Credits
Many newbies make mistake by using other DEV's device tree which is normally meant for building ROMs, using it to build TWRP therefore will result in alot of build errors !
Above script can also be use to build TWRP for any Android devices that uses standard Android header, except for Menu 4 which is specifically for MTK devices only. Just edit the script to add support for your device... :good: Updated support for other devices
This project was actually started way back at 2013 & this is the main reason why TWRP doesn't build is bcos of the tedious, confusing & wrong Build Environment setup, it is all so different on so many different linux distros & OSes version, i went on to developed Easy Magic TWRP.... Now i use Intel device & this script did build a working TWRP for it too.... :laugh:
That's why i strongly recommends BBQLinux for beginners, Thanks to RD codeworkx, i can guarantee that any Build Error is not cause by wrong BE setup as its already built-in on BBQLinux... :good:
The other reason TWRP doesn't boot is bcos of wrong mkbootimg repack arguments, Thanks to RD osm0sis for his awesome unpackbootimg... :good:
Since many newbies are having problems with building TWRP & flooding the TWRP thread here
Dees_Troy said:
This guide isn't going to be a step-by-step, word-for-word type of guide. If you're not familiar with basic Linux commands and/or building in AOSP then you probably won't be able to do this.
Click to expand...
Click to collapse
Which is actually meant for intermediate users, i've offered to share this script when OP decided to open up a new thread here for TWRP flags.... :good:
Credits Updates
Hacker432 for testing & feedbacks on this script, now it uses the ATC folder so that it'll support other languages other than English & TWRP will boot now when build on cm-12.1 base repo... :good:
OP for giving this script a glamour name ATC aka AIO-TWRP-Compiler... :laugh: :highfive: :good:
My TWRP doesn't boot
Try unpack/ repack your stock 3e recovery.img with AIK, push it to your device & if it doesn't boot then obviously your device is not using standard Android header & so does this script will not build a bootable TWRP. Try google your device info on how they did it, Eg. Sony devices uses BOARD_CUSTOM_BOOTIMG_MK for repacking boot & recovery.img & update it accordingly to your BoardConfig.mk
Code:
adb shell cat /proc/last_kmsg
[COLOR="Blue"]OR[/COLOR]
adb shell cat /proc/last_kmsg > kmsg.txt
[U][COLOR="blue"]On Android-6.0 Marshmallow[/COLOR][/U]
adb shell cat /sys/fs/pstore/console-ramoops
[COLOR="blue"]OR[/COLOR]
adb shell cat /sys/fs/pstore/console-ramoops > kmsg.txt
Source
Extreme minimal, TWRP require this only one flag TW_THEME := to build or it will error out. You will also need other flags as well, refer to the OP. Some devices won't boot when certain TWRP flag is used or not used bcos its not compatible with your device kernel ! Most legacy device doesn't support TTF & TWRP won't boot so you have to build with TWRP android-5.1 with TW_DISABLE_TTF := true flag
Code:
[URL="https://github.com/TeamWin/android_device_kazam_thunder_q45/blob/cm-10.2/BoardConfig.mk#l49"]TW_NO_EXFAT := true[/URL] [COLOR="Red"]<= To disable exfat[/COLOR]
[URL="https://github.com/TeamWin/android_device_kazam_tornado_348/blob/android-4.4/BoardConfig.mk#l50"]TW_NO_EXFAT_FUSE := true[/URL] [COLOR="Red"]<= To disable exfat[/COLOR]
[URL="https://github.com/carliv/device_elephone_p6000/blob/cm-11.0/BoardConfig.mk#l110"]TW_USE_TOOLBOX := true[/URL] [COLOR="red"]<= Using this flag will use toolbox instead of busybox[/COLOR]
Above are some of the flags that can cause TWRP not to boot up. If you are using Part-Source then you need to add additional projects to support these flags as most of them are disabled on the script. Just remove the remarks # from the script for that particular projects. More detail info refer to above post #11 Part-Source.
Refer to the most bottom Bug Report on how to obtain recovery.log, without it nobody is able to help you.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l122-l130"]TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888[/URL]
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_RECOVERY_PIXEL_FORMAT := BGRA_8888
The other reason it doesn't boot is that it actually does boot up but the screen is blank ! Try adb shell & it should work on this scenario.
Try different pixel format one at a time, one of them should work.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l114-l116"]TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGB_565[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l79"]RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH := true[/URL]
[URL="https://gerrit.omnirom.org/#/c/13948/"]TW_DISABLE_DOUBLE_BUFFERING := true[/URL]
When not setting any pixel format, the default is RGB565 & it should work on most Android devices. You can also try the above when non of them works.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#L14-L19"]TW_BOARD_CUSTOM_GRAPHICS[/URL]
If your existing device tree uses this & all the above doesn't work then drop by at TWRP IRC channel to get further help.
Source
Miscellaneous Tips
As mentioned many times, most of the time build error is bcos of wrong BE setup, use BBQLinux & you'll get over it. If you have already build on other distro then refer to here on how to use this script or migrate the source code .repo to BBQLinux.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/variables.h#l173"]TARGET_USE_CUSTOM_LUN_FILE_PATH[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l828"]TW_BRIGHTNESS_PATH[/URL] [COLOR="blue"]<= If not define, TWRP will look for it [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l840-l841"]here[/URL][/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l855"]TW_SECONDARY_BRIGHTNESS_PATH[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l1076"]TW_MAX_BRIGHTNESS[/URL] [COLOR="blue"]<= If not define, TWRP will [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l56-l58"]set it[/URL][/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l967"]TW_CUSTOM_BATTERY_PATH[/URL] [COLOR="Blue"]<= If not define, TWRP will use [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l972"]this[/URL] or [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l986"]this[/URL] [/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l937"]TW_CUSTOM_CPU_TEMP_PATH[/URL] [COLOR="blue"]<= if not define, TWRP will use [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l942"]this[/URL][/COLOR]
TWRP has everything specified to standard Android path unless when it doesn't work then you'll need to find that out yourself. Do take note that some device doesn't support certain feature such as CPU temperature, battery level, mount USB storage & etc then refer to the OP for flags to disable it.
Code:
adb shell su -c "ls -R" > [COLOR="Blue"]myAndroid.txt[/COLOR]
Above command will list out everything on your device.
Code:
adb shell su -c cat /sys/class/power_supply/battery/capacity
[COLOR="blue"]88[/COLOR]
Eg. Say the battery capacity doesn't work then look for that path at myAndroid.txt for something that says battery/capacity & specify it at BoardConfig.mk
Code:
adb shell cat /sys/class/thermal/thermal_zone0/temp
[COLOR="Blue"]27516[/COLOR]
If CPU temperature doesn't work then look for thermal/temp
Code:
adb shell
su
echo 0 > /sys/devices/platform/i2c-gpio.24/i2c-24/24-002c/backlight/lcd-backlight/brightness
echo 255 > /sys/devices/platform/i2c-gpio.24/i2c-24/24-002c/backlight/lcd-backlight/brightness
If brightness doesn't work, look for lcd-backlight/brightness, Eg. above command should be able to change the level of brightness if that is the correct path as indicated at myAndroid.txt.
Sync corruption
git & repo is like a Super Intelligent Source Code Auto-Resume Downloader when working together . . . :good:
You can stop it at any time, restart it back & it will auto-resume. cm repo & source code is located at ~/cm/.repo, omni at ~/omni/.repo it is a hidden folder & to view hidden folder via File Manager, you need to press Ctrl + h
Sometimes you have corruption then repo sync wouldn't work & normally you just need to delete manifests, manifests.git, manifests.xml with a repo init & repo sync then you'll be back to normal.
If still this doesn't solve the problem then delete everything EXCEPT the folder project-objects & projects, both of this is the actual source code folder.
After this a repo init then repo sync & everything will be back to normal, i guarantee, done this many times, no worries . . . :laugh:
Sometimes when you have severe data corruption, above technique will not work then manually cd ~/cm or ~/omni then repo init then repo sync & see what repo & git has to say then follow the on-screen instructions to remove the corrupted projects.
Scroll back up & see what the error was, remove the corrupted project then repo sync. In this case is rm -rf ~/cm/.repo/projects/prebuilts/clang/linux-x86/host/3.5.git
Subsequent sync show above error. rm -rf ~/cm/.repo/project-objects/CyanogenMod/android_external_icu.git
rm -rf ~/cm/.repo/projects/external/jemalloc.git
rm -rf ~/cm/.repo/projects/system/extras/su.git
rm -rf ~/cm/.repo/projects/external/libcxx.git
rm -rf ~/cm/.repo/projects/external/libcxxabi.git
rm -rf ~/cm/.repo/projects/external/libunwind.git
rm -rf ~/cm/.repo/project-objects/CyanogenMod/android_external_busybox.git
And finally all corrupted projects has been removed, subsequent repo sync & all files will be auto-extracted out.
Corrupted .repo folder
i've make a back up of my .repo folder using tar.gz compression years ago & when extracting out, normally will end with data corruptions except if you use lrzip... :good: You will need to manually remove all the text files such as hooks, pre-auto-gc & commit-msg which is supposed to be a symlink files.
After you force overwrite extraction, a repo init & repo sync will end with above message.
You will need to manually delete all the hooks.txt file found at .repo folder
You will need to manually delete all the commit-msg.txt file
You will need to manually delete all the pre-auto-gc.txt file. You might need to repo sync --force-sync many times to overwrite all the corrupted projects & after that, you won't be getting any of these error messages again.
Syncing work tree error - Doesn't check out all files
This operation must be run in a work tree
Run the below command will give you hint
Code:
repo --trace sync -l
Above hints the corrupted projects so remove it => rm -rf /home/yuweng/cm/.repo/projects/frameworks/ex.git
repo sync still it doesn't extract out all the files so you need to run repo --trace sync -l again. Delete the hinted project => rm -rf /home/yuweng/cm/.repo/projects/frameworks/webview.git
When all error has been fixed, a repo sync & all the files will be extracted out correctly
Source
Bug report
Zip & attach the ~/AIO-TWRP-Compiler/compile.log to your post when replying.
Refer to here on how to submit a proper TWRP bug report . . . :good:
How to obtain recovery log
adb pull /tmp/recovery.log -> Attach to your post
At TWRP -> BackUp -> After Backup go to Advanced -> Copy Log to SDCard
Typically you will find the recovery.log at
Typical Internal SdCard
/emmc/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
/data/media
/data/media/0
or
Typical External SdCard
/sdcard/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
Attach it to your post.
At TWRP console (Square button at button) -> You can view the log
If TWRP crash when executing certain menu/ function/ feature then you can use My Master Shifu _that gdb technique for debugging & submit the back trace to Teamwin so that they can fix it... :good:
Try IRC channel to get help directly, prepare all required info such as recovery.log, compile.log & android log, refer to here for the best timing . . .
TWRP FAQ
@yuweng the script has really been thought over for a long time and you also have put in tons of work in it. Thanks for it man!
Thanks bro... :highfive: The script initially includes BE setup for Ubuntu that includes setting up of Python, Java, Make, Git, build packages, adb rules & etc, now its half the size bcos we don't need to do all that on BBQLinux... It has went thru alot of revision, i lost track, one has PhilZ Touch on it, one revision will detect the device info such as graphics resolution, emmc or /data/media device & etc, you can actually do wonders with adb shell, automated alot of stuff for BoardConfig.mk, all in all, this script has about 4 years of work in it...
yuweng said:
Thanks bro... :highfive: The script initially includes BE setup for Ubuntu that includes setting up of Python, Java, Make, Git, build packages, adb rules & etc, now its half the size bcos we don't need to do all that on BBQLinux... It has went thru alot of revision, i lost track, one has PhilZ Touch on it, one revision will detect the device info such as graphics resolution, emmc or /data/media device & etc, you can actually do wonders with adb shell, automated alot of stuff for BoardConfig.mk, all in all, this script has about 4 years of work in it...
Click to expand...
Click to collapse
4 YEARS!!!! @Dees_Troy, @bigbiff, @_that this guy deserves a medal! And about the BE Setup, my good friend @thewisenerd had made an Android compiler which included a rather fancy dependencies check in a python program. I'll include it into AIO-TWRP-COMPILER as soon as I finish my school work for the week
Haha, they are all my Master Shifu's & they all have more experience than me on TWRP... :laugh: You are most welcome to add-in new features to it... :good:
yuweng said:
Haha, they are all my Master Shifu's & they all have more experience than me on TWRP... :laugh: You are most welcome to add-in new features to it... :good:
Click to expand...
Click to collapse
Experience?? They're encyclopedias on TWRP. But it's worthless if every humbug on the planet wants to compile it and doesn't even know what "ls -R " is supposed to do You're being a great help to everyone. I'll try and get them to try this when I can make it compatible for people who have already downloaded the source
Actually its quite easy but then again any wrong BE setup will result in build error that's why i strongly recommends BBQLinux for starters, its as easy as Ubuntu to setup, i can guarantee many will like the UI, Thanks to RD codeworkx.... :good:
Code:
mkdir ~/omni
cp -[COLOR="Blue"]R[/COLOR]f /path-to-your-existing-omnirom-folder/.repo ~/omni
[COLOR="blue"]OR[/COLOR]
mkdir ~/cm
cp -[COLOR="blue"]R[/COLOR]f /path-to-your-existing-cm-folder/.repo ~/cm
Remark or delete these lines & it'll work...
Updates - Migrating source code .repo to BBQLinux
So far my experience is that only lrzip is able to compress & extract source code .repo folder without data corruption... :good: Just open Ubuntu Nautilus File Manager & delete everything on your cm or omnirom except the hidden folder .repo
This hidden .repo folder is where the actual source code are, zipping it will be enough for migration, a repo init & repo sync will have all the files extracted out on BBQLinux ...
Code:
sudo apt-get install lrzip
cd /path-to-your-existing-[COLOR="Blue"]omnirom[/COLOR]-or-[COLOR="blue"]cm[/COLOR]-folder
lrztar -l .repo [COLOR="Blue"]<= Will take 10 to 20 minutes depending on your PC CPU, RAM & HDD[/COLOR]
[COLOR="blue"][U]To unzip it[/U][/COLOR]
copy [COLOR="Blue"].repo.tar.lrz[/COLOR] to [COLOR="Blue"]~/omni[/COLOR] or [COLOR="blue"]~/cm[/COLOR] folder accordingly
cd [COLOR="Blue"]~/omni[/COLOR] or [COLOR="blue"]~/cm[/COLOR]
lrzuntar .repo.tar.lrz
MSF Jarvis said:
Experience?? They're encyclopedias on TWRP. But it's worthless if every humbug on the planet wants to compile it and doesn't even know what "ls -R " is supposed to do[emoji14]You're being a great help to everyone. I'll try and get them to try this when I can make it compatible for people who have already downloaded the source
Click to expand...
Click to collapse
I don't know what it does but I compiled twrp(2.8.7.0 because twrp 3 doesn't want to work with my phone)In one month of work xD
yuweng said:
Actually its quite easy but then again any wrong BE setup will result in build error that's why i strongly recommends BBQLinux for starters, its as easy as Ubuntu to setup, i can guarantee many will like the UI, Thanks to RD codeworkx.... :good:
Code:
mkdir ~/omni
cp -rf /path-to-your-existing-omnirom-repo/.repo ~/omni
[COLOR="blue"]OR[/COLOR]
mkdir ~/cm
cp -rf /path-to-your-existing-cm-repo/.repo ~/cm
Remark or delete these lines & it'll work...
Click to expand...
Click to collapse
I use Ubuntu and I had several issues
Luckily I can compile without problems now
Thanks for your work
Inviato dal mio HUAWEI Y550-L03 utilizzando Tapatalk
AIO TWRP Compiler wiki
@yuweng, I have started writing down the wiki for this script at the Github repository. Would be grateful if you started writing the things you have mentioned here in that as well, and I'll proof-read it later on and also keep writing things myself

TWRP fastboot broken on O DP2 - of course...

Here we go again
The new Android O developer preview is out, and when I try to boot the TWRP image via fastboot, I get a blank screen after the google logo.
I am absolutely not surprised google is keeping the devs busy all the time by changing little bits and pieces just enough to stop our stuff from working...
At least ADB is working, so I could get the log:
Code:
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
Starting TWRP 3.0.2-0-RC1-f7176b37 on Wed Jul 29 06:02:03 1970
(pid 681)
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_INCLUDE_CRYPTO := true
I:Found brightness file at '/sys/class/leds/lcd-backlight/brightness'
I:Got max brightness 255 from '/sys/class/leds/lcd-backlight/max_brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:LANG: en
I:AB_OTA_UPDATER := true
Starting the UI...
Overlay graphics may work (mdssfb_90000), but not enabled. Use TW_TARGET_USES_QCOM_BSP := true to enable.
setting DRM_FORMAT_RGB565 and GGL_PIXEL_FORMAT_RGB_565
cannot find/open a drm device: No such file or directory
fb0 reports (possibly inaccurate):
vi.bits_per_pixel = 32
vi.red.offset = 0 .length = 8
vi.green.offset = 8 .length = 8
vi.blue.offset = 16 .length = 8
setting GGL_PIXEL_FORMAT_RGBA_8888
double buffered
framebuffer: 0 (1080 x 1920)
Using fbdev graphics.
I:TWFunc::Set_Brightness: Setting brightness control to 80
I:Loading package: splash (/twres/splash.xml)
I:Load XML directly
I:PageManager::LoadFileToBuffer loading filename: '/twres/splash.xml' directly
I:Checking resolution...
I:Loading resources...
I:Loading variables...
I:Loading mouse cursor...
I:Loading pages...
I:Loading page splash
I:Switching packages (splash)
blacklisting hbtp_vm input device
=> Linking mtab
=> Processing recovery.fstab
I:Processing '/boot'
I:Processing '/system'
I:Processing '/system_image'
I:Processing '/vendor'
I:Processing '/vendor_image'
I:Processing '/data'
I:Processing '/misc'
I:Processing '/efs1'
I:Processing '/efs2'
I:Processing '/usb-otg'
I:Unable to mount '/data'
I:Actual block device: '/dev/block/sda35', current file system: 'ext4'
get_crypt_ftr_info crypto key location: 'footer'
Bad magic for real block device /dev/block/sda35
stack corruption detected
And this repeats. I see two things, if I'm right:
1. the ui fails to start because it doesn't find a DRM device
2. it fails to decrypt the data partition and stops there
I am not enough to solve these things, because I have no clue what is wrong. I'm calling all the devs (pointing to you @Dees_Troy ) to help us again and try to figure out what needs to be done so we can enjoy full freedom on our devices for which we spent a fortune for
I am willing to help, and try things to get this done, just let me know what I should try!
Thanks in advance!
I have ran into this issues since 7.1 lol but i can flash dev prev 2 and then without rebooting just fastboot boot twrp.img (RC1) and it works
I have the same issue where booting twrp RC1 just goes into a blank screen. anyone found a fix?
eqbirvin said:
I have ran into this issues since 7.1 lol but i can flash dev prev 2 and then without rebooting just fastboot boot twrp.img (RC1) and it works
Click to expand...
Click to collapse
hmm... then my guess is that android does something with the encryption.
I flashed DP2, booted (automatic reboot after flash-all) and then tried to fastboot boot twrp.img and got the black screen.
I have already manually flashed twrp since, and can't boot it either. It gets stuck at the splash screen. just like it first did when it failed to decrypt the data patition (around january). Unfortunately this way there is no ADB so no way to see what happens...
I'll try to play around with it a bit, but I have no clue about decrypting the data partition. Don't even know where to start...
Ok well we learned with the first release that it was a bootloader issue so why not attempt to flash the bootloader from the first alpha, boot TWRP and see if SU can be installed? I know you can fastboot boot older bootloaders, I'm at work or I would give it a try
ne0ns4l4m4nder said:
Ok well we learned with the first release that it was a bootloader issue so why not attempt to flash the bootloader from the first alpha, boot TWRP and see if SU can be installed? I know you can fastboot boot older bootloaders, I'm at work or I would give it a try
Click to expand...
Click to collapse
you mean like flash a 7.1 bootloader? hmm i may give that a shot
Okay. I really reached the end of the road, because I can't compile TWRP...
What i found is:
The decryption fails with these lines:
Code:
get_crypt_ftr_info crypto key location: 'footer'
Bad magic for real block device /dev/block/sda35
stack corruption detected
In TWRP source, this Bad magic error message comes from cryptfs.c:
Code:
if (crypt_ftr->magic != CRYPT_MNT_MAGIC) {
printf("Bad magic for real block device %s\n", fname);
goto errout;
}
CRYPT_MNT_MAGIC is a static value, defined in cryptfs.h:
Code:
#define CRYPT_MNT_MAGIC 0xD0B5B1C4
crypt_ftr->magic comes from reading some data from fname (which has the value: /dev/block/sda35):
Code:
if ( ([B]fd = open(fname, O_RDWR)[/B]) < 0) {
printf("Cannot open footer file %s for get\n", fname);
return -1;
}
/* Make sure it's 16 Kbytes in length */
fstat(fd, &statbuf);
if (S_ISREG(statbuf.st_mode) && (statbuf.st_size != 0x4000)) {
printf("footer file %s is not the expected size!\n", fname);
goto errout;
}
/* Seek to the start of the crypt footer */
if (lseek64(fd, starting_off, SEEK_SET) == -1) {
printf("Cannot seek to real block device footer\n");
goto errout;
}
if ( (cnt =[B]read(fd, crypt_ftr, sizeof(struct crypt_mnt_ftr)[/B])) != sizeof(struct crypt_mnt_ftr)) {
printf("Cannot read real block device footer\n");
goto errout;
}
So if we are lucky, we just have to modify the value of CRYPT_MNT_MAGIC. Some changes should be done, to print the value of crypt_ftr->magic, and then change that hardcoded CRYPT_MNT_MAGIC value to that. But as i said, I didn't manage to compile TWRP on my own (yet. since a few months )
I would appreciate the help of someone who did it already for the pixel.
OR someone who knows what the hell that magic number means.
OR someone who tells me that i'm completely wrong, and the problem is only with my device. Although I did clean flash (wiped the whole phone, with userdata and internal storage).
I'm not sure about flashing directly, I was more thinking about fastboot booting it then fastboot booting TWRP over that and then attempting to flash super SU, I'd that's even possible
also wondering what would happen if we flashed the 7.1.2 bootloader to the opposite partition aka ( system is slot A) then you would flash 7.1.2 bootloader to Slot B, and then possibly find away to Fastboot Boot TWRP to that slot but, be able to flash SU to System in Slot A. All just speculation of course im going on the work around that was found to gain root access on the first release of O

Categories

Resources