First of all, I'm not responsible for any damage to your phone if you use anything in this topic.
This is only for Moto Maxx xt1225 with unlocked bootloader.
It's not adviseable to use this version with Lollipop. Source
I'm warning you I'm not an android developer. I'm building TWRP for myself since we don't have any custom recovies for our phone yet.
These are just test builds, many things are broken, that's why I do not recommend flashing these recoveries. Specially Backup/Restore.
@Gundabolu SC has successfully booted via fastboot (fastboot boot recovery.img) and flashed Super SU, but that's all for now. Touch recognition is still buggy, backup is not functional, etc.
If you are one of those guys that don't read OP and warnings and end up bricking your phone, I'm sorry, you have only yourself to blame.
I haven't made any source changes, this is purely TWRP with some configurations to boot into our XT1225.
Apparently works:
- Flashing zips like supersu
Not working:
- Touch is not functional when you boot the recovery. Wait for screen timeout and then it might work.
- Backup is not working. Error:
- Everything else just in case
I would appreciate if any real developer starts supporting TWRP. Just let me know and I'll close this thread.
So here's the first build:
**removed**
Edit November 30th 2014:
I managed to fix the touch issue, now it's ok.
Apparently backing up is fine as well. OTG works too.
I personally havent tested restoring backups and still don't advise to, but looks like @Gundabolu SC has. Thanks for your help.
How to use:
- Extract attached zip file
- Boot your phone to booloader (adb reboot bootloader)
- Boot the extracted img file (fastboot boot file-name.img) or if you want to flash it (fastboot flash recovery file-name.img)
Great ... Following :good:
new build:
https://drive.google.com/file/d/0B9LJnNqd94eNUGNOMmJpLUVlV1E/view?usp=sharing
changes in this build were basically:
Changing paths in PRODUCT_COPY_FILES array to copy a lot of important(?) files to ramdisk's root, like fstab.qcom (device.mk)
Removed two flags from BoardConfig.mk:
- TW_INTERNAL_STORAGE_PATH
- TW_INTERNAL_STORAGE_MOUNT_POINT
- these flags are usually used for devices with dual storages, not our case. Besides that, Moto X 2014 boardconfig doesnt have this flags as well.
Added some other flags:
- BOARD_HAS_NO_SELECT_BUTTON := true
- TARGET_USERIMAGES_USE_EXT4 := true
- TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
- RECOVERY_SDCARD_ON_DATA := true
- TW_DISABLE_TTF := true
- TW_SCREEN_BLANK_ON_BOOT := true
- TW_NO_EXFAT_FUSE := true
- TW_EXCLUDE_ENCRYPTED_BACKUPS := true
respider said:
new build:
https://drive.google.com/file/d/0B9LJnNqd94eNUGNOMmJpLUVlV1E/view?usp=sharing
changes in this build were basically:
Changing paths in PRODUCT_COPY_FILES array to copy a lot of important(?) files to ramdisk's root, like fstab.qcom (device.mk)
Removed two flags from BoardConfig.mk:
- TW_INTERNAL_STORAGE_PATH
- TW_INTERNAL_STORAGE_MOUNT_POINT
- these flags are usually used for devices with dual storages, not our case. Besides that, Moto X 2014 boardconfig doesnt have this flags as well.
Added some other flags:
- BOARD_HAS_NO_SELECT_BUTTON := true
- TARGET_USERIMAGES_USE_EXT4 := true
- TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
- RECOVERY_SDCARD_ON_DATA := true
- TW_DISABLE_TTF := true
- TW_SCREEN_BLANK_ON_BOOT := true
- TW_NO_EXFAT_FUSE := true
- TW_EXCLUDE_ENCRYPTED_BACKUPS := true
Click to expand...
Click to collapse
Doesnt boot anymore! Stuck at Motorola screen! b4 it used to stay blank...
respider said:
First of all, I'm not responsible for any damage to your phone if you use anything in this topic....
Click to expand...
Click to collapse
Keep me posted, I'll be updating the root thread.
Unless you'd rather have me link this thread.
Gundabolu SC said:
Doesnt boot anymore! Stuck at Motorola screen! b4 it used to stay blank...
Click to expand...
Click to collapse
this one is more similar with the first one that booted, I'm just copying fstab.qcom and removing those INTERNAL_STORAGE flags
https://drive.google.com/file/d/0B9LJnNqd94eNQ0ZnZ1ZvS1h6SGM/view?usp=sharing
if you are gonna try this and it didnt boot, let me know if there's a /tmp/recovery.log file
respider said:
this one is more similar with the first one that booted, I'm just copying fstab.qcom and removing those INTERNAL_STORAGE flags
https://drive.google.com/file/d/0B9LJnNqd94eNQ0ZnZ1ZvS1h6SGM/view?usp=sharing
if you are gonna try this and it didnt boot, let me know if there's a /tmp/recovery.log file
Click to expand...
Click to collapse
This boots, but guess you removed the "TW_SCREEN_BLANK_ON_BOOT := true" flag as well so touch doesn't work!! And the error:13 Failed to create backup folder is still there.. At this point in time probably its better to add one flag at a time and test it...
Try just these flags.....
TW_SCREEN_BLANK_ON_BOOT := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
Gundabolu SC said:
This boots, but guess you removed the "TW_SCREEN_BLANK_ON_BOOT := true" flag as well so touch doesn't work!! And the error:13 Failed to create backup folder is still there.. At this point in time probably its better to add one flag at a time and test it...
Try just these flags.....
TW_SCREEN_BLANK_ON_BOOT := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
Click to expand...
Click to collapse
when do you get the error?
when click BACKUP in the main menu or when SWIPE to backup?
respider said:
when do you get the error?
when click BACKUP in the main menu or when SWIPE to backup?
Click to expand...
Click to collapse
Swipe to backup....
---------- Post added at 05:34 PM ---------- Previous post was at 05:25 PM ----------
respider said:
when do you get the error?
when click BACKUP in the main menu or when SWIPE to backup?
Click to expand...
Click to collapse
You still want the recovery log file?
Gundabolu SC said:
Swipe to backup....
---------- Post added at 05:34 PM ---------- Previous post was at 05:25 PM ----------
You still want the recovery log file?
Click to expand...
Click to collapse
nope that's ok
I've just unlocked my bootloader and I'm testing myself
I've fixed the touch and trying to figure out backup error
it's a permission problem as you said earlier, no idea why yet. It's mounted correctly, we can see the /sdcard files from recovery but can't write
Code:
/sdcard # echo a > b
echo a > b
/sbin/sh: can't create b: Permission denied
/sdcard #
fstab looks fine though
I have successfully backed up to a OTG partition using a flash drive :good:
internal sd is the problem
respider said:
nope that's ok
I've just unlocked my bootloader and I'm testing myself
I've fixed the touch and trying to figure out backup error
it's a permission problem as you said earlier, no idea why yet. It's mounted correctly, we can see the /sdcard files from recovery but can't write
Code:
/sdcard # echo a > b
echo a > b
/sbin/sh: can't create b: Permission denied
/sdcard #
fstab looks fine though
I have successfully backed up to a OTG partition using a flash drive :good:
internal sd is the problem
Click to expand...
Click to collapse
Ohhh... Thats awesome! Yeah even i checked the fstab.... It looks almost identical to the Moto X 2014... Maybe we should take a look at Nexus 6's recovery once?
I:Set page: 'backup'
I:Set page: 'backup_run'
Updating partition details...
Iata backup size is 1726MB, free: 17419MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
...done
I:Backup Name is: '2014-11-28--22-19-29 KXG21.50-9'
I:Full_Backup_Path is: '/data/media/0/TWRP/BACKUPS/XXXXXXXX/2014-11-28--22-19-29 KXG21.50-9/'
I:Calculating backup details...
* Total number of partitions to back up: 1
* Total size of all data: 16MB
* Available space: 17419MB
Why is it just mounting the USB and not the data partition?
it was mounting data correctly you can check under advanced filemanager, you'll probably see your files.
I believe the problem was enforcing should be set to permissive
I just managed to backup to internal sd card but I'm not willing to test recover hahaha
I *think* it's fixed
https://docs.google.com/file/d/0B9LJnNqd94eNQmlsWmJGMTYxNkE/edit?usp=docslist_api
respider said:
it was mounting data correctly you can check under advanced filemanager, you'll probably see your files.
I believe the problem was enforcing should be set to permissive
I just managed to backup to internal sd card but I'm not willing to test recover hahaha
I *think* it's fixed
https://docs.google.com/file/d/0B9LJnNqd94eNQmlsWmJGMTYxNkE/edit?usp=docslist_api
Click to expand...
Click to collapse
It is perfect now!!! Backup restore, flashing zips, touch and everything works!!!
Time to update the OP with this link...
Gundabolu SC said:
It is perfect now!!! Backup restore, flashing zips, touch and everything works!!!
Time to update the OP with this link...
Click to expand...
Click to collapse
well not sure if restore works I don't have the guts to test lol
respider said:
well not sure if restore works I don't have the guts to test lol
Click to expand...
Click to collapse
Backed up and restored boot and it worked great!!
EVERYTHING WORKS!!! Yipeeeeeeeeeeeeeeeeee!!!
Got it on my MAXX. Thanks guys
ellopr said:
Got it on my MAXX. Thanks guys
Click to expand...
Click to collapse
You flashed or just booted?
prking07 said:
You flashed or just booted?
Click to expand...
Click to collapse
I flash it with "fastboot flash recovery"
ellopr said:
I flash it with "fastboot flash recovery"
Click to expand...
Click to collapse
Alright, thanks.
Great, now we just need a nexus 6 rom port or other lollipop port.?
Related
TWRP Recovery for the LG F3Q (codenames: fx3q, d520)
Background story (who ever wants to know):
As I'm currently testing around with flashing etc I hated it to re-flash the stock ROM again and again. It is sooo time consuming..
In that kind of ROM compiling learning process I also was able to build a working TWRP recovery for the LG F3Q so that was such a good feeling But as said the caveat was that because of the locked bootloader we can reach TWRP (or CWM) only when executing "adb reboot recovery" from the running system. That was not really satisfying me though..
Some day I've done a factory reset and well I saw that this is starting my TWRP recovery when executing it! Well it isn't such a surprise as TWRP sits on the recovery partition and will be triggered by the factory reset script but... well do you think what I think? When it would be possible to start TWRP fully and not that factory reset part of TWRP than we would have a workaround to reach the recovery mode without booting the system (which is in fact not possible anymore when flashing of system.img/boot.img fails)
That said.. I was in touch with the TWRP developers bigbiff and Dees_Troy and many thanks for the hint they gave me! I have build a new TWRP version based on that information I got and well the idea of that is:
Vol Down + Power -> LG Factory Reset screen appears
Confirming with power 2 times as asked
Voila: No factory reset anymore but TWRP is here!
Well that will have a caveat - READ CAREFULLY:
As you may think of the factory reset in the boot-up process and within the ROM will not working anymore until you flash another recovery!
But if you know that it is not such a caveat because you can choose the wipe options within TWRP to do a "manual" factory reset.
v2.8.1.0 build 5
USE THAT ON YOUR OWN RISK! BACKUP BEFORE!
Working (quickly tested):
Install (to flash a custom Kernel)
Mounting partitions
Reboot Recovery | System
adb shell (also see known issues)
Backup (compressed | uncompressed | encrypted (!) | unencrypted)
Restore (unencrypted | encypted (!) | compressed | uncompressed)
Internal storage /data/media
MTP which mounts the external storage!
File Manager
Terminal Command
Power charging while in TWRP
Displaying CPU temp
Totally untested:
WIPE (should work)
decrypting /data (but should work as it do so for encrypted backups already)
Every option which is not stated as "Known issue" or "Working"
Known issues (with workarounds):
ADB works only when screen "timed out" (manual locking does not help it must time out) therefore ADB can take up to 1 minute after boot until it becomes available (because screen need to be timed out first)
Workaround: set the time limit in the screen menu to e.g. 10 sec (that is the default value for now)
Timezone is not set correctly (that seems to be a well known bug in several devices using TWRP.... )
Workaround: set a timezone which displays the most accurate timezone
Known issues (without workarounds):
When you use the "Power Off" option in the "Reboot" menu the device will reboot instead of powering off
Wiping /data not possible after "factory reset buttons" used. You need to choose "wipe" and then "format data" manually (or use mke2fs on CLI).
Vibration is not working (I will not fix that atm because I like it that way)
Hardware keys at bottom doesn't work
If you use the factory reset button /data partition will be inaccessible and need to be re-flashed (means you will LOOSE your app and system configs when you use factore reset)
Download:
Attached you will find the TWRP v2.8.1.0 version ready to use even with locked bootloader:
BACKUP EVERYTHING BEFORE USING THIS. USE AT YOUR OWN RISK!
DD Image file:twrp_v2.8.1.0_build5_fx3q_FR-OFF.img.zip = FactoryReset is disabled / TWRP will be loaded instead (also see known issues)
Read the Installation & Usage instructions in this thread on how to install that file.
Installation & Usage instructions
Pre-Requirements
Read the FAQ
YOU NEED ROOT! (check FAQ)
YOU SHOULD do a NANDroid BACKUP! (check FAQ)
You need to boot up, enable USB debugging and then connect USB cable.(check FAQ get ROOT - the link contains a guide on that)
You better doing a NANDroid backup right? (I mentioned that before - but DO it! NOW!)
For the best usage experience install the sediKERNEL or use joel's debloated stock ROM which includes it already
Bulletproof Method 1: "the average user"
Use this guide if you simply want to install & use TWRP like it should be. If you're unsure use this guide!
Install:
Download the TWRP recovery file and unzip it
copy it to your device (e.g. adb push or simply copy & paste by your file browser)
Download the loki_tool (https://github.com/djrbliss/loki/raw/master/bin/loki_tool)
copy loki_tool to your device (e.g. adb push or simply copy & paste by your file browser)
execute:
adb shell
su (you may need to grant permission)
mount -oremount,rw /system
cp /PATH-WHERE-YOU-COPIED/loki_tool /system/bin/ && chmod 755 /system/bin/loki_tool
loki_tool flash recovery /PATH-WHERE-YOU-COPIED/twrp_X.X.X.X_recovery_FRoff/off.img
reboot recovery --> you should see the TWRP screen
Usage (sediKERNEL v2.0 or higher installed):
Power on the device
when you see the LG logo the first time do NOTHING!!
When the screen goes black THEN press Volume UP + Volume DOWN. Both the same time and hold them pressed.
Release the buttons when the screen goes black again
Wait. You will see the LG logo a third time and then you will see the recovery screen!
If you see a kernel crash then you have pressed the magic keys too early! Read and follow the above steps carefully and you should be fine.
Usage (without sediKERNEL v2.0 or higher):
boot into your ROM
execute "adb reboot recovery" from your PC or open a Terminal on your device and execute "su" then "reboot recovery"
Bulletproof Method 2: "developers only"
This is the developers preferred way of installing TWRP. It ensures that even when your ROM or Kernel gets damaged that you still be able to boot into recovery. This is to the developers or heavy testers who are knowing what they do ONLY!
But even when you think this is for you: Read the important hint at the end before deciding if you want to choose this method.
Install:
flash recovery image to your RECOVERY partition:
adb shell su -c dd if=/storage/external_SD/twrp_vXXXXX_fx3q_FR-OFF.img of=/dev/block/platform/msm_sdcc.1/by-name/recovery
adb reboot recovery
A user reports the the by-name does not worked for him but this one:
adb shell su -c dd if=/storage/external_SD/twrp_vXXXXX_fx3q_FR-OFF.img of=/dev/block/mmcblk0p17
-> If you can see TWRP now everything is fine - Otherwise DO NOT continue!
BACKUP YOUR WHOLE DEVICE NOW! I highly recommend to backup everything except /data from within TWRP because it is easy and works (from TWRP v2.8build5 or higher)
BACKUP /data is recommended to be done NOW and this way:
adb shell su -c dd if=/dev/block/platform/msm_sdcc.1/by-name/userdata of=/external_sd/userdata_backup_stock.img
--> This can take a long while but it contains also the backup for the internal storage not only /data and that internal part is not backupable over TWRP
while in TWRP flash the same recovery image to your BOOT partition now (do not think that this is dangerous. The boot partition is not a magic thing or so it is only the partition which will be started from the bootloader thats all about it. So yes you can install a recovery image on the boot partition without any harm.):
adb shell su -c dd if=/external_sd/twrp_vXXXXX_fx3q_FR-OFF.img.loki of=/dev/block/platform/msm_sdcc.1/by-name/boot
watch carefully that the process ended without errors and that the size is exactly the same as it should be (about 1,3GB)
adb shell sync
power off the device by taken out the battery (do not use reboot or something we want to be sure that the next step is absolutely really the normal boot up)
Boot up normally --> you should see TWRP !! You're NOT in recovery mode you're booting the normal boot mode!
Go on with flashing the sediKERNEL into your RECOVERY partition:
Download the sediKERNEL from here (the stock one could work, too but never tested ...)
push it to your device with adb or MTP (since v2.8build5)
Flash the sediKERNEL to your RECOVERY partition:
adb shell su -c dd if=/external_sd/sediKERNEL_JB-vXXXX.img of=/dev/block/platform/msm_sdcc.1/by-name/recovery
Reboot into Recovery by using TWRP GUI or by executing "adb reboot recovery"
Your ROM will boot.
Usage:
From now on every time your device booting up you will see the TWRP screen and need to choose Reboot-->Recovery to boot your ROM.
This is the absolute best way to use TWRP if you want to be sure that you will reach the recovery even when your ROM gets damaged and is confirmed to work very well (as always guarantees are not available )
Important hint:
Be sure that you keep in mind that from now on your recovery and boot partition are not the same anymore (you can always revert back to the normal behaviour, of course!). So if you want to flash a kernel image you need to ensure that it goes to the RECOVERY partition instead of the normal BOOT partition (because on boot partition is TWRP now).
If I got my ROM working I will definitively add an option to the installer where this will be ensured and I asked @joel.maxuel for his stock ROM to add that, too. As for now we are the only ones who are developing for the F3Q so you should be save enough atm but you will need to keep that always in mind when you want to replace the kernel and/or ROM.
What would happen if you forget about that? Well nothing really bad because when you install a kernel or ROM the boot image partition simply gets overwritten and that means only that your TWRP is not there anymore but the system will boot (if the new kernel/ROM is not buggy or damaged). You then could install TWRP by method 1 or using method 2 by using the boot image/Kernel you want to install.
Damage your device - booting (NOT RECOMMENDED will loose /data ):
You probably NEVER want to use this method. It is here for reference only.
I highly recommend to choose one of the above bulletproof versions instead of this one because it WILL damage /data and you need to restore that whole partition afterwards.
All my tests has shown that this comes not from TWRP (in one of my tests I disabled everything in the sourcecode of TWRP which wipes /data) but coming from LG itself. The factory reset button/option do something with the /data partition sturucture and afterwards you cannot use that anymore. I also tried to restore the partition info by trying all backup superblocks but that doesn't worked. No backup superblock is accessible.
Restoring them by mke2fs and e2fsck does not work unfortunately.. (mke2fs -S /dev/block/platform/msm_sdcc.1/by-name/userdata && e2fsck -yf /dev/block/platform/msm_sdcc.1/by-name/userdata)
So if you have loosed your /data and/or internal storage you need to have a DD imaged backup near.
Install:
same as for "Bulletproof Method 1" above
Usage:
When you choosen FR-OFF then TWRP will be able to start without booting up the whole system (also see known issues):
Power Off the device (remove battery)
Vol Down + Power --> Then put the battery back --> LG Factory Reset screen appears
Confirming with power button 2 times as asked - if you downloaded and flashed the FRoff version of TWRP it will NOT open the normal reset procedure but /data and the internal storage are not accessible afterwards (read above about the details). That means your app configs and systems configs get lost that way. You have been warned!
Voila: No (full) factory reset anymore but TWRP is here when you have damaged your ROM or for some dev approach
If you want the factory reset back simply choose the file twrp_2.7.1.0_recovery_FRon.img.lok and follow the above instructions. Afterwards you will have TWRP but it will be reachable only when you execute "adb reboot recovery" from the running system.
XDA:DevDB Information
sediTWRP for LG Optimus F3Q, Tool/Utility for the General Discussion
Contributors
xdajog
Source Code: https://github.com/xdajog/bootable_recovery_twrp_fx3q
Version Information
Status: Stable
Current Stable Version: v2.8.1.0 build 5
Stable Release Date: 2014-11-18
Created 2015-05-19
Last Updated 2015-07-20
FAQ
Frequently Asked Questions (FAQ)
What is that "adb" thing?
adb stands for: Android Debug Bridge and can help a lot when it comes to work with your device. It is not for developers only but they use it a lot of course.
But a normal user can use this to exchange files without the need of mounting, backing up the device, reboot the device and use it as a very comfortable way of having a terminal emulator.
Normally adb itself is not available as a standalone application - it comes with the Android SDK which is very big and heavy if you want to use adb and/or fastboot (another great tool) only.
But we live in a great world with many people wanting to make things easy so here you go when you want/need only adb and fastboot:
download & install adb at lifehacker
(Direct link for Windows users: Go to easy ADB install thread)
How to get root for the F3Q?
Here is the tool and guide: Saferoot
[*]What is a "nandroid" backup?
nandroid means essentially: "a full image of all your partitions" so it is a full snapshot of your ROM including all your apps and contents.
The name NANDroid is a portmanteau of "NAND" (as in Flash memory - NAND flash) and "Android." (Source)
[*]How to create a "nandroid" backup?
(See above for the meaning of "nandroid backup")
You have several options on how to do that.
The normal and absolutely recommended way is to do that "offline" (from within recovery mode) but you can also do it "online" (while Android is running).
.
Offline nandroid backup by using TWRP recovery: Guide
If you have no custom recovery installed read on.
.
Online nandroid backup:
by using an app:
There is 1 (known to me) "online" nandroid backup tool available which will backup from within your running Android: PlayStore.
I tested it and still using it since a while and I really like it but I would not fully resist on it.
I had no problems backing up but sometimes an app is lost when restoring. This may have been fixed but well it is like imaging a running Windows or Linux system:
Do not do it online if you can - it may/will work but there could be problems/inconsistencies later!!
If you never made a nandroid before doing it online will not harm anything and should be your first start. So install the Online Nandroid backup tool and begin.
Check out this guide for some hints: Guide
(If you like the Android app do not hesitate to buy the unlock key to support the developer!)
by using commandline tools:
First of all you need "adb" installed (check out the FAQ answer number 1 above).
Then you need someone who is telling you the device partition table and you need a big sized SD card to hold the images.
The reason is that you will use a special command named "dd" which images the whole partition (not the content only!).
dd is a VERY dangerous tool because if you use it wrong your device may get bricked so it is essential that you are using the
correct command and check that twice!
Check out the next FAQ on how to do this for the F3Q.
[*]How to create a "nandroid" backup for the F3Q - WITHOUT having a custom recovery?
The whole process will take a big amount of time but it is worth to follow each step including the md5sum checks at the end.
Please read the previous FAQ first because there you will find more information about background and other options you may have.
Ensure you have a SD card inserted which is big enough and having enough free space available (4GB at least! I recommend at least 8 GB but this depends on the size of your current data partition. A completely stock ROM with nothing installed and unused will need 3 GB space).
.
Install "adb" on your pc (check out the FAQ #1 above).
root your device (check out FAQ #2 above)
connect with adb to your (running) F3Q:
adb shell
(you should see a prompt)
su
(you need to grant permission if you haven't yet)
Then backup your current ROM and data:
dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/storage/external_SD/system.2015-07-20.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/storage/external_SD/boot.2015-07-20.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/userdata of=/storage/external_SD/userdata.2015-07-20.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=/storage/external_SD/recovery.2015-07-20.img
# If you never backed up your EFS you really should do that once:
dd if=/dev/block/platform/msm_sdcc.1/by-name/modemst1 of=/storage/external_SD/modemst1.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/modemst2 of=/storage/external_SD/modemst2.img
Click to expand...
Click to collapse
Just to be sure you can do an online backup now, too ( Guide ) Online Nandroid backup App
.
copy the backup(s) to your device (connect USB cable - open your external storage and drag&drop) <--- DO NOT SKIP THIS STEP!!!! It is absolutely essential!
Check your copy on your device:
md5sum /storage/external_SD/system.2015-07-20.img
md5sum /storage/external_SD/boot.2015-07-20.img
md5sum /storage/external_SD/userdata.2015-07-20.img
md5sum /storage/external_SD/recovery.2015-07-20.img
md5sum /storage/external_SD/modemst1.img
md5sum /storage/external_SD/modemst2.img
Click to expand...
Click to collapse
Download a md5sum checker like this one Windows MD5 and load each file you copied to it (on Linux the "md5sum" command can be used of course).
compare the md5sums from the above output and ensure that they are all matching.
[*]Why is factory reset not working when installing TWRP? (or: AAAAaaaah my /data is inaccessible after doing a factory reset!!!!)
All my tests has shown that this comes not from TWRP (in one of my tests I disabled everything in the sourcecode of TWRP which wipes /data) but coming from LG itself. The factory reset button/option do something with the /data partition sturucture and afterwards you cannot use that anymore. I also tried to restore the partition info by trying all backup superblocks but that doesn't worked. No backup superblock is accessible.
Restoring them by mke2fs and e2fsck does not work unfortunately.. (mke2fs -S /dev/block/platform/msm_sdcc.1/by-name/userdata && e2fsck -yf /dev/block/platform/msm_sdcc.1/by-name/userdata)
So if you have loosed your /data and/or internal storage you need to have a DD imaged backup near. Sorry but you have been warned (known issues) before.
.
if you want the factory reset back simply choose the file twrp_2.7.1.0_recovery_FRon.img.lok and follow the above instructions. Afterwards you will have TWRP but it will be reachable only when you execute "adb reboot recovery" from the running system. v2.7. is not recommended to use but atm the only option if you really want that. Instead I would better try the wipe options from within TWRP and re-installing your ROM of choice or simply using the official LG flashing tool to get your F3Q fully reset.
.
History / Changelog
Previous development (v2.7.1.0)
I HIGHLY RECOMMEND USING v2.8 instead of this version!
You have been warned.. If you still want that buggy version go on here:
USE THAT ON YOUR OWN RISK! I STRONGLY RECOMMEND TO BACKUP EVERYTHING BEFORE PROCEEDING.
Working:
Install (to flash a custom Kernel)
Mounting partitions (see known issues for the internal one)
Reboot Recovery | System
adb shell
File Manager
Terminal Command
Totally untested:
WIPE (may work)
Known issues:
If the device becomes locked and then unlocked by the user adb will restart on the device (or crash and start again. haven't had looked into that yet)
When you use the "Power Off" option in the "Reboot" menu the device will reboot instead of powering off
RESTORE (will NOT work!)
BACKUP (will NOT work!)
You cannot mount the external sd via USB or MTP
Vibration is not working (I will not fix that atm because I like it that way)
Timezone is not set correctly (that seems to be a well known bug in several devices using TWRP....
Internal storage is missing (/data/media)
Hardware keys at bottom doesn't work
If you use the factory reset button /data partition will be inaccessible and need to be re-flashed (means you will LOOSE your app and system configs when you use factore reset)
Download:
Attached you will find the loki'ed TWRP version (v2.7.1.0):
AGAIN: THIS IS A PROOF-OF-CONCEPT only. It definitively WILL have bugs and problems! I want to proof that it will be possible to have TWRP on this device and also have a way to boot up into TWRP without booting the whole system.
twrp_2.7.1.0_recovery_FRoff.img.lok = FactoryReset is disabled / TWRP will be loaded instead
twrp_2.7.1.0_recovery_FRon.img.lok = FactoryReset is enabled / TWRP can be reached with "adb reboot recovery" only
Read the Installation & Usage instructions in the OP on how to install that file.
Awesome work! Saves having to risk modifying the bootloader (for now). :laugh: :highfive: Thanks!
xdajog said:
TWRP Recovery for the LG F3Q / D520
...
Click to expand...
Click to collapse
I'm unable to get logs from TWRP, it does crash reliably when messing about in settings and such.
Timezone fix is needed. (Devices time is set to the correct local time, but TWRPs timezones arent correct.)
Device does not show internal storage.
Wipe menu does not differentiate from internal storage and /data
there's no /mnt, /storage or /sdcard present while in TWRP.
Uhm, I'm sure there's some more I've missed, but that's all I've got for now.
eriklion said:
I'm unable to get logs from TWRP, it does crash reliably when messing about in settings and such.
Click to expand...
Click to collapse
Uhm what do you mean? adb shell and then open /tmp/recovery.log? Clicking on the small mini icon at middle bottom of the screen? Both working for me. Have you tested the above attached version or the one I gave you at dropbox? The above is a more current one!
Timezone fix is needed. (Devices time is set to the correct local time, but TWRPs timezones arent correct.)
Click to expand...
Click to collapse
hm I will look into that
Device does not show internal storage.
Click to expand...
Click to collapse
yeah forgot to mention that. Is that shown in CWM btw?
Wipe menu does not differentiate from internal storage and /data
Click to expand...
Click to collapse
Could you explain what does that means?
there's no /mnt, /storage or /sdcard present while in TWRP.
Click to expand...
Click to collapse
/mnt and /storage are not needed or am I wrong? /sdcard would point to the internal storage I think but I decided to use /external_sd instead which is accessible in the latest version.
Finally got around to test. Looks great, I love having TWRP over CWM!
Unfortunately the backup function is not working. TWRP errors out and reloads itself. I have a pastebin, sorry it's so long but I wanted to try a couple different backup options before I gave up and produced a log file:
http://pastebin.com/QUfNw6Rk
The portions of interest are:
Code:
Backing up Cache...
I:Creating backup...
I:Creating tar file '/external_sd/TWRP/BACKUPS/1db9cba/1970-01-24--22-43-59 JZO54K//cache.ext4.win'
I:addFile '/cache/recovery' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/cache/recovery/log' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
...
Code:
Backing up Data...
I:Creating backup...
I:Creating tar file '/external_sd/TWRP/BACKUPS/1db9cba/1970-01-24--22-43-59 JZO54K//data.ext4.win'
I:addFile '/data/dontpanic' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg0' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/next_count' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg1' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg2' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg3' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg4' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg5' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg6' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
I:addFile '/data/dontpanic/last_kmsg7' including root: 0
Failed to get selinux context: Operation not supported on transport endpoint
__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 posixrules!
Starting TWRP 2.7.1.0 on Sun Jan 25 03:44:01 1970
I:Single storage only.
I:No internal storage defined.
I:No storage defined, defaulting to /sdcard.
I:Lun file '/sys/devices/platform/usb_mass_storage/lun0/file' does not exist, USB storage mode disabled
I:Found brightness file at '/sys/class/leds/lcd-backlight/brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 255
Starting the UI...Pixel format: 480x800 @ 32bpp
Pixel format: RGBX_8888
Not using qualcomm overlay, 'msmfb43_80201'
framebuffer: fd 4 (480 x 800)
=> Linking mtab
=> Processing recovery.fstab
I:Processing '/boot'
I:Processing '/cache'
I:Processing '/data'
I:Processing '/misc'
I:Processing '/recovery'
I:Processing '/external_sd'
I:Processing '/system'
I:Creating Android Secure: /external_sd/.android_secure
I:Backup folder set to '/external_sd/TWRP/BACKUPS/1db9cba'
I:Settings storage is '/external_sd'
Updating partition details...
I:Unmounting main partitions...
E:Unable to unmount '/data'
I have a stock based ROM to test, and I want to make sure I can enter recovery through the bootloader should things go sour. If TWRP can backup and restore, that allows me to go back to my true stock after the test. Any ideas?
joel.maxuel said:
Finally got around to test. Looks great, I love having TWRP over CWM!
Unfortunately the backup function is not working. TWRP errors out and reloads itself. [.....] Any ideas?
Click to expand...
Click to collapse
Yes.
There are several things coming in place when it comes to backing up out of TWRP atm...
You hopefully have read the big fat red warning ? What I mean is the part regarding /data gets lost when you do a factory-reset
That said if you have entered TWRP by pressing the physical keys your /data partition will be wiped (really bad thing but that it is made for and I haven't had the time to look into that further)
The result is a cleaned /data which is not mountable until you format it with mke2fs.
(e.g.: "adb shell mke2fs -T ext4 /dev/block/mmcblk0p15")
If you do not do that what MAY happens is that TWRP failing because of missing /data (and if not then you should ensure that /data was really backed up)
But as your log told me it seems to be not the problem here 'cause the /data partition is detected by TWRP. so it could be 2)
Mounting points.
As stated the mount points are not fully working in TWRP atm. That means when it comes to /sdcard which is the internal device storage it will fail, too because it cannot be found. The reason for this is that LG mounts /sdcard by the sdcard service but that is somehow tricky thats why it is not working atm.
And on top: the internal storage normally needs to be mounted to "/data/media" especially when we want to use MultiROM later.
So +1 for /sdcard or/and internal storage related
background info: http://teamw.in/DataMedia
The last one I could imagine is "something else" which could be catched by "/proc/last_kmsg"
The important thing is that this file gets written only after a crash and when the battery was not removed. So if the device reboots to TWRP again try to adb shell to the device and then paste the last_kmsg again. Maybe we can find something here.
When I will continue on TWRP I think of upgrading to v2.8 because they enable MTP here which could be good for copying data between device and pc..
BTW:
I have no idea what CWM port which is also be available would do in case of starting a backup especially what will REALLY gets backed up!!!!
IMHO the best way on doing a nandroid backup atm is "adb shell dd ...." Takes a long time but then you can be sure. I can give you all the mountpoints if you need them.
As I currently have not such much success with porting the ROM I will now come back here to TWRP and will finish it to have a hopefully fully working recovery. I cannot say the timeline for this but it will definitively be the next what I want to do because when this is done I can better match the rest for the ROM.
xdajog said:
<SNIP>
IMHO the best way on doing a nandroid backup atm is "adb shell dd ...." Takes a long time but then you can be sure. I can give you all the mountpoints if you need them.
As I currently have not such much success with porting the ROM I will now come back here to TWRP and will finish it to have a hopefully fully working recovery. I cannot say the timeline for this but it will definitively be the next what I want to do because when this is done I can better match the rest for the ROM.
Click to expand...
Click to collapse
This should work (I've done it before for eriklion):
Code:
adb shell
dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/storage/external_SD/system.2014-11-12.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/storage/external_SD/boot.2014-11-12.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/cache of=/storage/external_SD/cache.2014-11-12.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/userdata of=/storage/external_SD/userdata.2014-11-12.img
Now, is there a recommended adb command to wipe data and cache, since factory reset function is not the best choice? I see a few with the following process...
Code:
adb shell
su
format DATA
format CACHE
...but not much commentary on it.
I appreciate the second (third, whatever you are on) crack at TWRP. Hopefully the next version will squash the bugs. Btw, I will see if I can provide a /proc/last_kmsg tonight have posted a last_kmsg here.
joel.maxuel said:
This should work (I've done it before for eriklion):
Code:
adb shell
dd /dev/block/platform/msm_sdcc.1/by-name/system /storage/external_SD/system.2014-11-12.img
dd /dev/block/platform/msm_sdcc.1/by-name/boot /storage/external_SD/boot.2014-11-12.img
dd /dev/block/platform/msm_sdcc.1/by-name/cache /storage/external_SD/cache.2014-11-12.img
dd /dev/block/platform/msm_sdcc.1/by-name/userdata /storage/external_SD/userdata.2014-11-12.img
Click to expand...
Click to collapse
yes thats all you need to backup & restore
joel.maxuel said:
Now, is there a recommended adb command to wipe data and cache, since factory reset function is not the best choice? I see a few with the following process...
Code:
adb shell
su
format DATA
format CACHE
...but not much commentary on it.
I appreciate the second (third, whatever you are on) crack at TWRP. Hopefully the next version will squash the bugs. Btw, I will see if I can provide a /proc/last_kmsg tonight.
Click to expand...
Click to collapse
I always do it that way:
Code:
Starting TWRP
adb shell
("su" in TWRP not needed normally)
mke2fs -T ext4 /dev/block/mmcblk0p15 (for userdata)
mke2fs -T ext4 /dev/block/mmcblk0p14 (for cache)
Then you can be sure it is clean and well formatted. ext4 is for both cache and userdata and works fine for me.
twrp v2.8 with many enhancements and fixes is on its way
Stay tuned ....
if you get bored in the meanwhile ... click thanks
Is someone here with running the stock ROM (or absolutely not modified means formatted! /data partition) who is willing to give me a quick help? It must be stock or placed back to stock by using a backuped image dump if you have one.
The following need to be done in recovery so you need to have CWM or TWRP installed. Boot into recovery (adb reboot recovery) and then use "adb shell" to connect.
I need your output of this command:
Code:
mke2fs -n /dev/block/platform/msm_sdcc.1/by-name/userdata
This will not do/destroy/modify anything.
It should display some information about that partition. Read the details here http://linux.die.net/man/8/mke2fs
The reason is that LG factory reset seems to wipe superblocks (wanted by LG or not - fact is that they are thrown) and THEN forwarding to the recovery tool like TWRP but to be sure I need the above output from 1 or 2 people to be sure enough on how to proceed.
Thanks in advance
As Joel investigated that may destroy /data cause of a buggy version of mke2fs!! Oh man..
-----
Sent from my SGH-I927 using XDA Android mobile app
Ok thx to joel I'm able to investigate the LG facotry reset further.
In parallel I will try another way which will be (if I get it working) absolutely smooth and will not have such workaround character like the current idea (hijacking factory reset).
Give me some time but if that works it would be a great solution for accessing recovery..
Stay tuned some good things may happen...
-----
Sent from my SGH-I927 using XDA Android mobile app
Finally v2.8 for F3Q has arrived !!! I think a very good approach now!
Have fun and as usual any thx click.... and so on
Check out the OP for Download and details:
http://forum.xda-developers.com/showpost.php?p=55239027&postcount=1
UPDATE:
I have completely reworked the "Installation & Usage instructions" section in the OP. PLEASE READ and be happy
xdajog said:
Finally v2.8 for F3Q has arrived !!! I think a very good approach now!
Have fun and as usual any thx click.... and so on
Check out the OP for Download and details:
http://forum.xda-developers.com/showpost.php?p=55239027&postcount=1
UPDATE:
I have completely reworked the "Installation & Usage instructions" section in the OP. PLEASE READ and be happy
Click to expand...
Click to collapse
Great work.
Am looking at method two. If I was to install a ROM, wouldn't the boot partition (thus my new recovery) be overwritten by the ROM package's boot.img? And when I was cooking with the Kitchen, the ROM required a specific mount point for the boot partition. If it is supposed to point to recovery, seems to me that neither would boot (overwritten recovery, ROM pointing in the wrong location).
So, what is this solution getting around? So we have an option to load TWRP before a system we don't necessarily trust will boot? Thus avoiding the bootloader fallback even more? Or is it a broken boot.img breaks TWRP as well so even if we try to go in through the bootloader, TWRP fails to load as well?
Sorry for my confusion, still trying to grasp all this new information.
joel.maxuel said:
Great work.
Click to expand...
Click to collapse
Thanks
Am looking at method two. If I was to install a ROM, wouldn't the boot partition (thus my new recovery) be overwritten by the ROM package's boot.img?
Click to expand...
Click to collapse
Method 2 will suggest that if you install a custom ROM that you are be able to use/choose the boot.img partition (I hoped that the "hint" at the was clear enough but better to ask of course!)
And when I was cooking with the Kitchen, the ROM required a specific mount point for the boot partition. If it is supposed to point to recovery, seems to me that neither would boot (overwritten recovery, ROM pointing in the wrong location).
Click to expand...
Click to collapse
Well yes you either need to point to the recovery partition or (and that would be what I recommend) you let the user choose what he wanted to do.
So, what is this solution getting around?
Click to expand...
Click to collapse
The best we can do here (and that is what I will do for my custom ROM if I get it done some day) to use AROMA installer and ask the user if he has a recovery installed in the boot partition or not. Then you can choose what to do in the updater script.
I uploaded an example of my AROMA installation setup for the "sediROM for Samsung Captivate Glide" in this post. This one is VERY complex but you will get the idea and many input on how to do things.
So we have an option to load TWRP before a system we don't necessarily trust will boot? Thus avoiding the bootloader fallback even more?
Click to expand...
Click to collapse
Yes using method 2 we have always coming TWRP up when powering on the device. We then can choose to do things in there or to boot to "recovery" which will be the ROM. What do you meant with "bootloader fallback"?
Or is it a broken boot.img breaks TWRP as well so even if we try to go in through the bootloader, TWRP fails to load as well?
Click to expand...
Click to collapse
Not sure If I got you. When the boot partition gets overwritten TWRP and any possibility to get into TWRP will be lost because it sits only in the boot partition when using method 2. If you choose to do a factory reset when powering on the device or from within the ROM I have no idea what happens then unfortunately. That is untested but if you willing to test..
Sorry for my confusion, still trying to grasp all this new information.
Click to expand...
Click to collapse
No worry about that happy if that is useful for someone
xdajog said:
I uploaded an example of my AROMA installation setup for the "sediROM for Samsung Captivate Glide" in this post. This one is VERY complex but you will get the idea and many input on how to do things.
Click to expand...
Click to collapse
Thanks! I will take a look at this in the next few days.
xdajog said:
Yes using method 2 we have always coming TWRP up when powering on the device. We then can choose to do things in there or to boot to "recovery" which will be the ROM. What do you meant with "bootloader fallback"?
Click to expand...
Click to collapse
Bootloader fallback as in having to access TWRP via the bootloader. Our regular method is to access form the ROM, but if the ROM is bricked for whatever reason, the fallback is through the bootloader.
xdajog said:
Not sure If I got you. When the boot partition gets overwritten TWRP and any possibility to get into TWRP will be lost because it sits only in the boot partition when using method 2. If you choose to do a factory reset when powering on the device or from within the ROM I have no idea what happens then unfortunately. That is untested but if you willing to test..
Click to expand...
Click to collapse
I was alluding to the scenario if one was to choose method one, installed a ROM, and things got busted badly... Would you even be able to access TWRP with a bad boot partition? I think so, because recovery partition should be self sufficient (I think you proved it by swapping their places by way of method two), it is just getting into recovery by way of bootloader) I don't particularly like.
Had to face that fear last night, and ultimately, TWRP started up fast enough from the bootloader that it seemed like nothing happened, but when i went to dump the log, it could not recognize the sdcard. DD'ing my userdata partition back fixed that issue.
joel.maxuel said:
Bootloader fallback as in having to access TWRP via the bootloader. Our regular method is to access form the ROM, but if the ROM is bricked for whatever reason, the fallback is through the bootloader.
Click to expand...
Click to collapse
You mean "factory-reset" right? By either pressing the factory reset buttons (or by choosing from within the ROM) correct?
I was alluding to the scenario if one was to choose method one, installed a ROM, and things got busted badly... Would you even be able to access TWRP with a bad boot partition? I think so, because recovery partition should be self sufficient (I think you proved it by swapping their places by way of method two), it is just getting into recovery by way of bootloader) I don't particularly like.
Click to expand...
Click to collapse
If you install TWRP with method 1 and your boot partition gets corrupt you still be able to reach TWRP by using the factory-reset buttons. But you will loose /data then.
If you install TWRP with method 2 and your boot partition has gone you can not start TWRP anymore because it sits on there.
So you're more bulletproof by choosing method 1 because you would reach TWRP even when the boot partition gets damaged but you will loose /data then! Mentioned in the known issues in the OP.
Had to face that fear last night, and ultimately, TWRP started up fast enough from the bootloader that it seemed like nothing happened, but when i went to dump the log, it could not recognize the sdcard. DD'ing my userdata partition back fixed that issue.
Click to expand...
Click to collapse
When you have TWRP installed with method 1 you will reach TWRP by factory reset buttons and it will DO NOTHING ! Really! It simply starts TWRP because I patched TWRP that way that it will not wipe anything when triggered by the factory-reset command / button!
I can say that for double sure since today because:
1) In one of my tests I had disabled REALLY EVERY wipe option within TWRP - compiled it - installed it and even then /data gets lost!
2) I have installed the BOOT image means KERNEL on the RECOVERY partition today again and then used the factory-reset buttons again (after I restored /data of course)... and /data gets lost AGAIN--?!!
That means even when there is absolutely no custom recovery in place (like TWRP) which would normally handle wiping /data then nevertheless /data gets corrupted! I have tested that twice so I can say now for sure that this has nothing to do with TWRP but it comes from the LG bootloader instead! That bootloader is CRAP. sorry.
I had tested one approach which is build in boot image RAM disk which catches the keys which are pressed and then reboot into recovery. That would work but only as long as you have a working boot image partition. So that is the same good/bad as having TWRP sitting within the boot partition which is much easier to do so I decided to go this way for now.
One last word about the crappy factory-reset by LG: I have tried a lot to find out what really happens to the partition or partition table of /data when those keys are pressed but the only thing I can say is that the superblocks are inaccessible and the same for the backup superblocks. doing a "mke2fs -S" does not work (and wouldn't fix the root cause of the issue) and I have no idea what LG do here. Therefore cannot fix that ..
so I believe we will need to live with one of the 3 methods described in the OP....
Hope that answered some of your questions...
Bad news..
The Desire Z of my wife is completely broken now.
That means I cannot develop anymore..
- I ported and released the latest TWRP version to the F3Q
- I'm able to build AOSP JellyBean (not booting yet though),
- I compiled and released a custom AOSP Kernel (named sediKERNEL)
.... and a lot more..
I have everything I need to continue here in place...
I have the will and the ability to continue...
But no device anymore..
If someone has a F3Q to give away.. then I will continue but I'm not willing to buy a F3Q for developing only. So if you have an idea how we could continue let me know.
Update:
Check out the following link if you want to help http://forum.xda-developers.com/showthread.php?t=2952919
Otherwise that will end here for me unfortunately...
Hopefully not.
Yours
Xdajog.
-----
Sent from my SGH-I927 using XDA Android mobile app
I will update the installation instructions soon!
Because of the new sediKERNEL v2.0 the instructions will be made bullet proof only .. and i try to do it more detailed @Kediil
-----
Sent from my SGH-I927 using XDA Android mobile app
Hello xda forums,
After a lot of experimentation I have been able to get TWRP working with /data decryption support (compatible with stock Sony ROM encryption) using LineageOS 14.1 sources. It is able to mount encrypted stock Sony ROM /data and install Magisk on it.
Credits / Special Thanks:
- LineageOS and @Quarx, @Olivier, @cdesai, Myself5, kali-, banmeifyouwant for android device ivy source tree (which I forked)
- @nailyk for help and ideas from effort on Sony Z3
- AndroPlus Kernel for providing ideas on things to try.
- @Captain_Throwback for help with hw crypto.
Warning:
Do not enable "Encrypt my phone" if you are running Magisk already on stock ROM! Encryption will hang because android will not be able to unmount /data to encrypt it and you will be forced to reboot and then you will be forced to wipe /data. If you plan to use Magisk, first uninstall it completely from recovery, THEN encrypt your phone, THEN install Magisk and whatever modules you want.
Developed on Sony E6533 (Z3+ Dual) but should work on both variants due to the efforts of @Quarx in unifying the device tree. Built from LineageOS 14.1 android ivy device tree.
How to install:
- Power off completely, then hold volume up key, then plug in USB to PC. If done correctly the front LED will light up BLUE.
- Make sure fastboot drivers are installed. If you have generic android drivers, you can install driver "Android bootloader interface" manually for the "S1Boot" entry in device manager on windows when phone is in fastboot mode.
- Download attachment and unzip it to get the img file.
- fastboot flash FOTAKernel recovery.img
How to enter:
- Power off completely.
- Hold volume down key, then push power also.
- Do not release volume down and power until sony logo appears.
- It will enter recovery flashed in FOTAKernel partition.
Help wanted:
- Testing all scenarios on encrypted /data such as backup / restore.
- Charging LED does not work (I don't know the changes needed to make it work in recovery).
Known issues:
- Battery charge indicator only updates once every minute but charging is working fine.
- Reboot to bootloader from within TWRP doesn't work (seems to be Sony bootloader issue, will remove in next build) (use power off, then hold vol. up + plug in usb instead).
- Reboot to recovery from within TWRP doesn't always work (sony bootloader issue, fixed by updating to sony nougat bootloader). (use power off, then hold vol. down + power until sony logo instead).
- "Hotbooting" (ie: fastboot boot recovery.img) this recovery does not work. Phone will hang on Sony logo and heat up and require hard power off using power off button inside side flap (or press Power + Vol Up + Vol Down simultaneously for 3 seconds).
Source:
Device tree: https://github.com/rwasef1830/android_device_sony_ivy/tree/cm-14.1-twrp
TWRP: https://github.com/omnirom/android_bootable_recovery/ (cherry pick https://gerrit.omnirom.org/#/c/22096/ thanks to @Captain_Throwback)
Changelog
2017-02-27:
- Initial release
2017-02-28:
- Embed minimum crypto blobs directly in recovery, now it is completely independent from /system and /firmware. Commented out /firmware from fstab to prevent accidental damage by users.
- Removed accidentally left debug messages in firmware_class.c in previous release.
2017-02-28-02:
- Moved qseecomd binary and libs outside /system to avoid becoming affected by mounting /system.
- Enable qualcomm hardware encryption engine (thanks to @nailyk and @Captain_Throwback for help).
- Use busybox instead of toolbox/toybox to avoid problems with scripts due to missing functions.
2018-03-04-01:
- Sync'd to latest ivy / kitakami sources.
- Updated to latest TWRP on android-7.1 branch.
Developer notes
- Encryption depends on binary blobs in phone "modem" partition: keymaste.* and kmota.* (shipped with firmware FTF). These blobs have now been embedded in the recovery image itself, so recovery runs completely standalone.
- Also needed are cmnlib.* files from /system/etc/firmware but they are embedded in this recovery image to allow crypto to work completely independently of /system.
- Sony firmware package can be flashed with @Androxyde flashtool.
Future ideas
- Generalize the changes needed for TWRP to make it compatible with Kitakami in general (z5 / z5 premium) and make the tree cleaner. If any devs want to help, please reply, I'm a noob myself at this
- Implement charging LED.
Updated 2017-02-28.
Now trying to get cryptfs hw encryption working!
Please!!! Help me....
I'm with boot loop in twrp, how to solve this? I have Dual version on stock ROM V278
EverCH said:
I'm with boot loop in twrp, how to solve this? I have Dual version on stock ROM V278
Click to expand...
Click to collapse
What does boot loop in twrp mean ? If you mean you are unable to reboot from TWRP to system, just go to reboot in menu and power off and then power on. It will go to system.
If you mean something else, please provide more details.
I do this, but when I try to restart the system, it goes back to the twrp, even if it turns off the phone and calls again, it starts directly in twrp, it does not start the OS, it stays in loop in recovery.
EverCH said:
I do this, but when I try to restart the system, it goes back to the twrp, even if it turns off the phone and calls again, it starts directly in twrp, it does not start the OS, it stays in loop in recovery.
Click to expand...
Click to collapse
Unplug phone. From inside TWRP go to reboot menu, and choose power off. Wait for few seconds after screen turn off, then power on using power button only.
Otherwise, try to go in fastboot mode again by doing vol. up + plug in, and then from console do fastboot reboot.
Work great on dual version:victory:
DiscMan55 said:
Unplug phone. From inside TWRP go to reboot menu, and choose power off. Wait for few seconds after screen turn off, then power on using power button only.
Otherwise, try to go in fastboot mode again by doing vol. up + plug in, and then from console do fastboot reboot.
Click to expand...
Click to collapse
I just did this however I got the same result, it never starts the OS, even turning it off for a few minutes when connecting it enters the twrp, remembering that I am with ROM 32.3.A.0.376 dual version
EverCH said:
I just did this however I got the same result, it never starts the OS, even turning it off for a few minutes when connecting it enters the twrp, remembering that I am with ROM 32.3.A.0.376 dual version
Click to expand...
Click to collapse
At this point, I don't know what can be wrong. I would try to reflash with sony flashtool all partitions (except userdata), then flash twrp again from fastboot. Maybe that will reset it.
To anyone familiar with BoardConfig.mk syntax:
I am trying to get TARGET_HW_DISK_ENCRYPTION working. There is a problem with TWRP, it expects libcryptfs_hw.so to be found in $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/libcryptfs_hw.so but in sony tree, libcryptfs for qualcomm comes from default LineageOS qcom opensource cryptfs driver (which delegates to libQSEEComAPI.so which is pulled from blobs) in https://github.com/LineageOS/android_vendor_qcom_opensource_cryptfs_hw/
In the Android.mk in that driver https://github.com/LineageOS/android_vendor_qcom_opensource_cryptfs_hw/blob/cm-14.1/Android.mk LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 are not defined, so libcryptfs_hw.so gets built to default /lib and /lib64 location, so it is not found by TWRP (https://github.com/omnirom/android_bootable_recovery/blob/android-7.1/prebuilt/Android.mk#L172) .
Is there a way in my device BoardConfig.mk where I can make ninja understand to build libcryptfs_hw.so like normal and then have it copy it to where TWRP expects it before building TWRP ?
I'm trying to have my tree "just work" without having to fork the lineage os repo just to add 2 lines. If I add:
Code:
# in vendor/qcom/opensource/cryptfs_hw/Android.mk
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
It builds and works successfully, but I don't want this ugly hack.
DiscMan55 said:
To anyone familiar with BoardConfig.mk syntax:
I am trying to get TARGET_HW_DISK_ENCRYPTION working. There is a problem with TWRP, it expects libcryptfs_hw.so to be found in $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/libcryptfs_hw.so but in sony tree, libcryptfs for qualcomm comes from default LineageOS qcom opensource cryptfs driver (which delegates to libQSEEComAPI.so which is pulled from blobs) in https://github.com/LineageOS/android_vendor_qcom_opensource_cryptfs_hw/
In the Android.mk in that driver https://github.com/LineageOS/android_vendor_qcom_opensource_cryptfs_hw/blob/cm-14.1/Android.mk LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 are not defined, so libcryptfs_hw.so gets built to default /lib and /lib64 location, so it is not found by TWRP (https://github.com/omnirom/android_bootable_recovery/blob/android-7.1/prebuilt/Android.mk#L172) .
Is there a way in my device BoardConfig.mk where I can make ninja understand to build libcryptfs_hw.so like normal and then have it copy it to where TWRP expects it before building TWRP ?
I'm trying to have my tree "just work" without having to fork the lineage os repo just to add 2 lines. If I add:
Code:
# in vendor/qcom/opensource/cryptfs_hw/Android.mk
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
It builds and works successfully, but I don't want this ugly hack.
Click to expand...
Click to collapse
Weird way to include it into twrp. Is it the same into 6.0 branch or does they use dependencies system?
You can try to replace with something like:
Code:
ifneq ($(strip $(TARGET_ARCH)),arm64)
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
else
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
endif
but I think a better way would be to change the include into twrp.
nailyk said:
Weird way to include it into twrp. Is it the same into 6.0 branch or does they use dependencies system?
You can try to replace with something like:
Code:
ifneq ($(strip $(TARGET_ARCH)),arm64)
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
else
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
endif
but I think a better way would be to change the include into twrp.
Click to expand...
Click to collapse
When I modify vendor/qcom/opensource/cryptfs_hw/Android.mk as I quoted, ninja picks up that it is dependency, and it compiles libcryptfs_hw first, and then copies to where TWRP wants, but I can't make it understand to "alias" or build it manually in its default location and then put it where ninja wants to be still recognized as dependency.
I don't want to hack qcom source because I want my same BoardConfig to work for LineageOS build as well as TWRP (I want to make 100% compatible encryption in LineageOS 14.1 with stock sony rom with best performance and lowest battery with hw crypto).
DiscMan55 said:
When I modify vendor/qcom/opensource/cryptfs_hw/Android.mk as I quoted, ninja picks up that it is dependency, and it compiles libcryptfs_hw first, and then copies to where TWRP wants, but I can't make it understand to "alias" or build it manually in its default location and then put it where ninja wants to be still recognized as dependency.
I don't want to hack qcom source because I want my same BoardConfig to work for LineageOS build as well as TWRP (I want to make 100% compatible encryption in LineageOS 14.1 with stock sony rom with best performance and lowest battery with hw crypto).
Click to expand...
Click to collapse
Does TARGET_RECOVERY_DEVICE_MODULES := libcryptfs_hw get the module be built at the right location?
(it should be something like LOCAL_DEPENDENCIES += TARGET_RECOVERY_DEVICE_MODULES into twrp makefiles but can't find it again. I hope they don't remove it...)
I know they get encryption working because pixel is encrypted and afaik it is qcom arm 64 too.
nailyk said:
Does TARGET_RECOVERY_DEVICE_MODULES := libcryptfs_hw get the module be built at the right location?
(it should be something like LOCAL_DEPENDENCIES += TARGET_RECOVERY_DEVICE_MODULES into twrp makefiles but can't find it again. I hope they don't remove it...)
I know they get encryption working because pixel is encrypted and afaik it is qcom arm 64 too.
Click to expand...
Click to collapse
Nope, it gets built but at the default location (which is wrong for twrp) as the normal behavior for android.mk without explicit local_module_path.
Now I am only stuck on how to just copy it to /vendor/ before TWRP builds (how to say that in BoardConfig.mk)
Here's the relevant part of my BoardConfig.mk:
Code:
TARGET_HW_DISK_ENCRYPTION := true
TARGET_CRYPTFS_HW_PATH := vendor/qcom/opensource/cryptfs_hw
TARGET_SWV8_DISK_ENCRYPTION := true
TARGET_RECOVERY_DEVICE_MODULES := libcryptfs_hw
# latest attempt, doesn't work, still complains file is missing
PRODUCT_COPY_FILES += ${TARGET_OUT_SHARED_LIBRARIES}/libcryptfs_hw.so:$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/libcryptfs_hw.so
Cherry-pick this: https://gerrit.omnirom.org/22096
DiscMan55 said:
Nope, it gets built but at the default location (which is wrong for twrp) as the normal behavior for android.mk without explicit local_module_path.
Now I am only stuck on how to just copy it to /vendor/ before TWRP builds (how to say that in BoardConfig.mk)
I tried PRODUCT_COPY_FILES but it didn't work
Click to expand...
Click to collapse
Product copy_files on Lineage is parsed only at bacon time. The only way is to create a dummy target like:
Code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILE := out/target/product/device/xxx/yyy/zzz/libcryptfs_hw.so
LOCAL_MODULE := libcryptfs_hw64
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/lib64/
LOCAL_POST_INSTALL_CMD += \
ln -sfT libcryptfs_hw64.so $(TARGET_RECOVERY_ROOT_OUT)/lib64/libcryptfs_hw.so;
include $(BUILD_PREBUILT)
Or to put it as prebuilt into device/sony/ivy/recovery/root/lib64/ (symlink doesn't get copied, that was my problem )
Maybe you should try the twrp IRC chan, probably somebody had already solved this.
Haha Captain is here your are in good hands now
nailyk said:
Product copy_files on Lineage is parsed only at bacon time. The only way is to create a dummy target like:
Or to put it as prebuilt into device/sony/ivy/recovery/root/lib64/ (symlink doesn't get copied, that was my problem )
Maybe you should try the twrp IRC chan, probably somebody had already solved this.
Click to expand...
Click to collapse
You missed my post .
The Sony Open Devices Project is always happy about volunteers (coding, testing, etc)
Also mainlining your favorite snapdragon powered xperia device into the mainline kernel is possible and we will be glad to help you!
Official site
Unofficial site
Code:
#include <std_disclaimer.h>
/*
*
* 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.
*
*/
Team Win Recovery Project 3.x, or twrp3 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.
FAQ:
Just wiping your phone in TWRP lead into an encrypted & not readable userdata in the stock system.
You need to open advanced wiping and check the entries data and internal storage.
Of course clear the dalvik, too.
If you backed up system and/or vendor partitions and you want to restore them, make sure that TWRP setting "Use rm -rf instead of formatting" is set!.
If after the usage of NewFlasher or the OTA Updater or something else, which installs stock firmware parts you get stuck into the TWRP or SONY Logo, you need again to disable the verification with the vbmeta.img file and its parameters in fastboot.
fastboot & adb
https://developer.sony.com/develop/open-devices/get-started/flash-tool/useful-key-combinations/
https://wiki.lineageos.org/adb_fastboot_guide.html
https://developer.android.com/studio/releases/platform-tools
Weird problems not easily to reproduce by other users require that you make sure, that you
Use the newest platform tools (adb & fastboot)
Downloaded the newest firmware via Xperifirm from XDA and installed the newest firmware via Newflasher from XDA
Newflasher from XDA
Xperifirm from XDA
Removing the stock bloat apps via titanium backup may result in a boot loop. Use a file explorer to remove them, disable them or try to use my unfinished bloat removal script at github.
Your phone reboots into recovery, instead of system? Maybe it crashed too often due to a wrong installation or whatever?
In TWRP:
Code:
cat /dev/block/bootdevice/by-name/misc
shows you the reason.
TWRP -> [WIPE] -> [Advanced Wipe] -> Tick only the misc -> [Swipe to Wipe]
Known Bugs:
The "fastboot boot twrp.img" doesn't work, if you use the hardware buttons to open the blue fastboot bootloader mode. Only use adb, twrp or the android system to reboot into blue fastboot bootloader mode or flash the twrp.img, boot the device, reboot into bootloader and flash the original boot.img back, before booting into twrp.
You can also "fastboot reboot bootloader" in the blue fastboot mode.
This is a bootloader bug, maybe it gets fixed with the stock Q bootloader.
If "fastboot boot twrp.img" results into a blackscreen and reboot of the phone, take a look if you modified the DTBO partition.
It requires a special TWRP for every modified kernel/dtbo until I find some way to unify the twrp kernel with the DTBO (if the bootloader supports it).
Bugtracker:
TWRP Bugtracker -> If you think the problem is in TWRP
My Bugtracker -> If you think the problem is in my implementation
Bugreport:
A bugreport needs your device name, dmesg, the /tmp/recovery.log and a way to reproduce the issue.
If possible use
Code:
logcat -b all
instead of just a dmesg.
If ADB is not working to provide logs
VOLUP+POWER for 1 Seconds -> Forced crash to create a pstore
Boot the normal system.
Give me the files in
Code:
/sys/fs/pstore/
If the TWRP is stuck at the TWRP logo, the chances are high, that the decryption didn't succeed.
To rescue a not responding phone:
VOLUP+POWER for 3 Seconds -> RESTART with one Vibration.
VOLUP+POWER for 20 Seconds -> SHUTDOWN with 3 Vibrations.
VOLUP+POWER+CAMERA for 30 Seconds -> HARDWARE SHUTDOWN by discharging a capacitor.
Thank you very much for your help, code contribution & testing! (Random order):
@dees_troy and his team of volunteers for the TWRP code
@dhacke thank your for providing a download server
Shame on me if I forgot someone after searching through the thread and my PM's!
And many thanks to the few donators!
A telegram group for technical SODP stuff:
https://t.me/xda_tv
XDA:DevDB Information
TWRP, ROM for the Xperia XZ2
Contributors
MartinX3, Sony
Source Code: https://github.com/MartinX3-AndroidDevelopment
ROM OS Version: Android 10
ROM Kernel: Linux 4.x
ROM Firmware Required: Newest recommended
Based On: AOSP
Version Information
Status: Stable
Current Stable Version: 3.4.0-0
Stable Release Date: 2020-06-13
Created 2020-03-29
Last Updated 2020-06-20
Download & Installation
Download:
https://androidfilehost.com/?w=devices&uid=11410963190603893035
https://www.dhsfileserver.de/ftp/martinx3/ Thank you @dhacke for the second download server
Installation:
Update to newest stock firmware before unlocking!!!
Unzip the *.gz files with https://7-zip.org/ or Linux.
Enter fastboot via software, not hardware buttons. See "Known Bugs".
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot boot twrp.img
Advanced menu -> "Install recovery ramdisk" -> Choose twrp.img
Reboot into installed TWRP
Want Root? -> Magisk
(Only if your phone doesn't boot to system anymore) Advanced menu -> "Fix recovery bootloop"
(Optional; Security degradation; Only if you know what you're doing) Switch SELinux to permissive (with my permissive.zip)
News
02.03.2021
Reuploaded the SODP TWRP with a workaround for Android 11 compatibility.
Click to expand...
Click to collapse
15.06.2020
reuploaded the stock twrp for the xz2 premium with a completely fixed touch.
Click to expand...
Click to collapse
14.06.2020
reuploaded the stock twrp with a later touch kernel modules initialization.
Hopefully fixing the randomly happening not working touch.
Click to expand...
Click to collapse
13.06.2020
thanks to the fixes in 3.4.0 we got now a twrp with the following enhancements for stock and sodp:
- this twrp will work with future 10.0 roms, you don't need a new build matching the security patch level of your rom.
- you can install this twrp again with the buildin ramdisk patcher. Please follow the installation instructions.
Click to expand...
Click to collapse
11.06.2020
switch to twrp 3.4.0
sodp twrp 2020-06 security patch level
stock twrp 2020-05 security patch level for firmware 52.1.a.2.1
now both twrp should work without a rom being installed (empty system/vendor/oem partitions) and still be able to decrypt your userdata.
Also the stock twrp touch should now always work instead of playing russian roulette.
Click to expand...
Click to collapse
11.05.2020
reuploaded sodp twrp for 2020-05 security patch level.
It didn't boot with the newest aosp.
Click to expand...
Click to collapse
07.05.2020
sodp twrp for 2020-05 security patch level.
Click to expand...
Click to collapse
14.04.2020
removed stock twrp for firmware 52.1.a.0.672 until sony releases the kernel sources of the new security patch level.
Otherwise the keymaster won't decrypt the userdata for twrp and twrp gets stuck on the twrp logo.
Click to expand...
Click to collapse
13.04.2020
stock twrp for firmware 52.1.a.0.672
sodp twrp for 2020-04 security patch level
hopefully fixed the touch problems of the stock twrp
fixed the forced read only partition mountings of system, vendor, odm
Click to expand...
Click to collapse
31.03.2020
stock twrp for firmware 52.1.a.0.618
Click to expand...
Click to collapse
30.03.2020
sodp twrp for 2020-03 security patch level
installing in ramdisk (to make it persistent) is impossible at the moment, because it is a 9.0 twrp which makes its ramdisk incompatible to the rom.
Of course monthly twrp releases in sync with the current patch level need to be released or i would need to remove the userdata decryption completely.
The stock twrp will follow, after it became ready.
Click to expand...
Click to collapse
30.03.2020
SODP TWRP for 2020-03 security patch level
Installing in Ramdisk (to make it persistent) is impossible at the moment, because it is a 9.0 TWRP which makes its ramdisk incompatible to the ROM.
Of course monthly TWRP releases in sync with the current patch level need to be released or I would need to remove the userdata decryption completely.
The Stock TWRP will follow, after it became ready.
Click to expand...
Click to collapse
PS: AndroidFileHost blocked me for doing too many actions at the same time.
Maybe I can upload it there tomorrow.
Done
can't wait for possibility to install in ramdisk
but now there is a working recovery :highfive:
31.03.2020
Stock TWRP for firmware 52.1.A.0.618
Click to expand...
Click to collapse
xz3 twrp
MartinX3 said:
31.03.2020
Click to expand...
Click to collapse
xz3 twrp won't boot, sodp version is good but there's no install on ramdisk?
hafiidh said:
xz3 twrp won't boot, sodp version is good but there's no install on ramdisk?
Click to expand...
Click to collapse
You mean SODP TWRP works, but not the stock TWRP on your XZ3?
You are stuck on sony logo?
Or on TWRP logo?
I need a bugreport with "logcat -b all" via adb.
Install ramdisk doesn't work at the moment, because it is a TWRP 9.0 hack, since TWRP 10.0 is ready.
But I wrote it in the news
Edit:
Reworked the thread a bit for more clarification
First! Wonderful job!
---EDIT------
Everything works fine! So nice!
@MartinX3 Great job as always bro! :good:
I ran it on my XZ2 (stock 52.1.A.0.618).
Phone has booted to the twrp screen (till the unlock pattern), but the touch is not working (log).
I didn't start from scratch (fresh install), for the record.
Tia!
serajr said:
@MartinX3 Great job as always bro! :good:
I ran it on my XZ2 (stock 52.1.A.0.618).
Phone has booted to the twrp screen (till the unlock pattern), but the touch is not working (log).
I didn't start from scratch (fresh install), for the record.
Tia!
Click to expand...
Click to collapse
Thank you
Are you sure the touch doesn't work?
I tested this release on the same firmware on my XZ2 in stock.
This confuses me now.
You booted stock .618 before and you tried to deactivate & activate the display?
Here it worked right out of the box.
And if it happens again, could you execute "start preptouch"
And if that not works, could you execute "/sbin/preptouch.sh"?
Sjll said:
First! Wonderful job!
---EDIT------
Everything works fine! So nice!
Click to expand...
Click to collapse
Thank you
MartinX3 said:
[...] Are you sure the touch doesn't work?
And if it happens again, could you execute "start preptouch"
And if that not works, could you execute "/sbin/preptouch.sh"?
Click to expand...
Click to collapse
I am. I have tried at least three times so far. Tried turning off and on the screen, but the slide to unlock didn't work, too.
"start preptouch", no response, no working touch
"/sbin/preptouch.sh"...
Code:
insmod: failed to load /sbin/clearpad_rmi_dev.ko: File exists
insmod: failed to load /sbin/clearpad_core.ko: File exists
insmod: failed to load /sbin/clearpad_i2c.ko: File exists
akari:/sbin # ls -l
Tia again
serajr said:
I am. I have tried at least three times so far. Tried turning off and on the screen, but the slide to unlock didn't work, too.
"start preptouch", no response, no working touch
"/sbin/preptouch.sh"...
Code:
insmod: failed to load /sbin/clearpad_rmi_dev.ko: File exists
insmod: failed to load /sbin/clearpad_core.ko: File exists
insmod: failed to load /sbin/clearpad_i2c.ko: File exists
akari:/sbin # ls -l
Tia again
Click to expand...
Click to collapse
And the service menu of android should also say that you use the clearpad driver.
And I assume the 9.0 stock twrp did always touch fine?
The script say that the kernel modules for the touch driver got loaded and I assume the sys path in the script file got executed too, after loading the .ko files.
And you have a normal European firmware?
That's now a mystery for me why it works for me and others, but not in your phone
Especially if you have the clearpad touch hardware
MartinX3 said:
And the service menu of android should also say that you use the clearpad driver.
And I assume the 9.0 stock twrp did always touch fine?
The script say that the kernel modules for the touch driver got loaded and I assume the sys path in the script file got executed too, after loading the .ko files.
And you have a normal European firmware?
That's now a mystery for me why it works for me and others, but not in your phone
Especially if you have the clearpad touch hardware
Click to expand...
Click to collapse
I got the touch working after copying the three .ko libs to the ramdisk /sbin folder, and a small editing (below) in the permissive.sh (also removed "$touch_id" == "3" from preptouch.sh).
Code:
setenforce 0
insmod /sbin/clearpad_rmi_dev.ko
insmod /sbin/clearpad_core.ko
insmod /sbin/clearpad_i2c.ko
echo 1 > /sys/devices/virtual/input/clearpad/post_probe_start
I know this is an awful workaround, but maybe this give you some hint (or sets you more confusing yet )
I'm with the sony stock customized_br fw, as always!
serajr said:
I got the touch working after copying the three .ko libs to the ramdisk /sbin folder, and a small editing (below) in the permissive.sh (also removed "$touch_id" == "3" from preptouch.sh).
Code:
setenforce 0
insmod /sbin/clearpad_rmi_dev.ko
insmod /sbin/clearpad_core.ko
insmod /sbin/clearpad_i2c.ko
echo 1 > /sys/devices/virtual/input/clearpad/post_probe_start
I know this is an awful workaround, but maybe this give you some hint (or sets you more confusing yet )
I'm with the sony stock customized_br fw, as always!
Click to expand...
Click to collapse
Ah you have a XZ2C, not a XZ2?
Because the removed ID 3 is for the XZ2 with clearpad touch.
But the script did already copy the .ko files into your /sbin before and executed the same code, you did now manually.
And according to your logs the setenforce 0 was already executed earlier.
So you just did the same the script did.
Well, yes you confuse me more
Could you try to just execute "echo 1 > /sys/devices/virtual/input/clearpad/post_probe_start" if the touch doesn't work again?
I wonder if the initialization is too early on your device.
Then I could try to delay the preptouch service to a later stage of the device boot.
MartinX3 said:
Ah you have a XZ2C, not a XZ2?
Because the removed ID 3 is for the XZ2 with clearpad touch.
But the script did already copy the .ko files into your /sbin before and executed the same code, you did now manually.
And according to your logs the setenforce 0 was already executed earlier.
So you just did the same the script did.
Well, yes you confuse me more
Could you try to just execute "echo 1 > /sys/devices/virtual/input/clearpad/post_probe_start" if the touch doesn't work again?
I wonder if the initialization is too early on your device.
Then I could try to delay the preptouch service to a later stage of the device boot.
Click to expand...
Click to collapse
I have a regular XZ2 (H8216), and its touch_id is 3 (customized_br fw), so I removed the Id 3.
"Could you try to just execute..." I've already tried that, with no success.
"Then I could try to delay the preptouch..." Cool... As you could notice, it worked here with that awful way I did it, so why not?
:good:
serajr said:
I have a regular XZ2 (H8216), and its touch_id is 3 (customized_br fw), so I removed the Id 3.
"Could you try to just execute..." I've already tried that, with no success.
"Then I could try to delay the preptouch..." Cool... As you could notice, it worked here with that awful way I did it, so why not?
:good:
Click to expand...
Click to collapse
But you tried it also yourself later.
You executed the script again without success at a later stage.
And adding it to the permissive.sh is like executing the script, just earlier.
I assume `cat /sys/devices/dsi_panel_driver/panel_id` gives you the "3" as result?
MartinX3 said:
But you tried it also yourself later.
You executed the script again without success at a later stage.
And adding it to the permissive.sh is like executing the script, just earlier.
I assume `cat /sys/devices/dsi_panel_driver/panel_id` gives you the "3" as result?
Click to expand...
Click to collapse
I ran the scripts/codes manually in the trwp root shell (with the no working touch screen).
Yep, running the script earlier (permissive.sh) did the trick (*.ko files in the ramdisk).
And 3 is the output of the panel_id (that's why I removed the 3 from the preptouch.sh).
Edit: I've noticed this...
The permissions of the libs copied from vendor to sbin (preptouch), as you could see here
Code:
-rw------- 1 root root 1070630 1972-01-22 17:46 clearpad_core.ko
-rw------- 1 root root 251702 1972-01-22 17:46 clearpad_i2c.ko
-rw------- 1 root root 296934 1972-01-22 17:46 clearpad_rmi_dev.ko
Patched twrp
Code:
-rwxrwxrwx 1 root root 1070902 2020-04-02 21:48 clearpad_core.ko
-rwxrwxrwx 1 root root 251830 2020-04-02 21:48 clearpad_i2c.ko
-rwxrwxrwx 1 root root 297054 2020-04-02 21:48 clearpad_rmi_dev.ko
Edit 2: chmod on copied files did the trick (preptouch.sh) - but sometimes still not working (need to boot twice, three times...):
Code:
#XZ2 "3" XZ2C "4" Clearpad
if [[ "$touch_id" == "3" ]] || [[ "$touch_id" == "4" ]]; then
cp /v/lib/modules/clearpad_rmi_dev.ko /sbin/
cp /v/lib/modules/clearpad_core.ko /sbin/
cp /v/lib/modules/clearpad_i2c.ko /sbin/
[B]chmod 777 /sbin/clearpad_rmi_dev.ko
chmod 777 /sbin/clearpad_core.ko
chmod 777 /sbin/clearpad_i2c.ko[/B]
insmod /sbin/clearpad_rmi_dev.ko
insmod /sbin/clearpad_core.ko
insmod /sbin/clearpad_i2c.ko
echo 1 > /sys/devices/virtual/input/clearpad/post_probe_start
fi
Maybe you find out a more elegant way to handle with that!
Edit 3:
I also got it permanently installed on kernel (combo keys does work, too), it's a bit tricky I gotta say, but it works.
You know, twrp's ramdisk.cpio kernel hack (old install procedure).
Hi Martin,
just wanted to let you know that your latest version for Sony stock (0.618 fw) does also not work for me (touch does not respond). Even 'fastboot reboot bootloader' before 'fastboot boot twrp-xz2.img' doesn't change anything.
Device:
Xperia XZ2 (H8216) running Android 10 stock (52.1.A.0.618)
Customized CH
Clearpad Touch version: 3
I'm trying to create a working vendor.img, however so far unsuccessful.
It does create a flashable ROM just fine, however I'm stuck at the Samsung (init) bootscreen/logo (last_kmesg).
Is it possible? How do I need which files to extract? I'm now searching for reference from other sources.
Thanks!
were you able to progress in this?
poppopret_ said:
were you able to progress in this?
Click to expand...
Click to collapse
Yes, I was able to boot, everything worked except the camera and SELinux.
Unfortunately, I don't have a S9 anymore. However you may want to use the linked Github as reference.
francoism90 said:
Yes, I was able to boot, everything worked except the camera and SELinux.
Unfortunately, I don't have a S9 anymore. However you may want to use the linked Github as reference.
Click to expand...
Click to collapse
I'm working with pixel 4a. I had made changes to device.mk to remove some files from being copied to vendor under
PRODUCT_COPY_FILES but vendor.img provided by google gets copied as a whole ignoring these changes. Do you have any idea on how to edit/override or build vendor.img?
I also tried to use proprietary files provided here in vendor folder and included the mk file in aosp-sunfish.mk but every other images get built except vendor.img.
You need to set the following:
Code:
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_COPY_OUT_VENDOR := vendor
BOARD_VENDORIMAGE_PARTITION_SIZE := 679...
Otherwise, it will copy the files to /system/vendor (if I'm not mistaken).
I was able to generate vendor.img successfully, but after I flashed the images, phone gets stuck in google logo. How can this be debugged? Is there a way to retrieve logs?
I tried accessing it through adb but the device is not recognised by adb at this point.
@poppopret_ Are you using TWRP or LineageOS recovery? When booting back to your recovery, they can be used to get the last_kmesg log, which should hopefully provide you with debugging.
francoism90 said:
Yes, I was able to boot, everything worked except the camera and SELinux.
Unfortunately, I don't have a S9 anymore. However you may want to use the linked Github as reference.
Click to expand...
Click to collapse
sir can u please tell me the steps to create vendor.img
francoism90 said:
You need to set the following:
Code:
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_COPY_OUT_VENDOR := vendor
BOARD_VENDORIMAGE_PARTITION_SIZE := 679...
Otherwise, it will copy the files to /system/vendor (if I'm not mistaken).
Click to expand...
Click to collapse
where i write this
Hello, this sounds a little bit impossible but i made some progress with my friend. We made a vendor partition, edited the TWRP but we stuck at the part of making a vendor. Can the g4 community do it? I think you can, especially @steadfasterX. UsU, FWUL and SALT were masterpieces.
Also, it looks so hard. Because there is no phone with S808 and A9.
If you need to know how did i made the vendor partiton, i can help.
I use H815TR UsU'd. If that helps.
You should describe much more detailed what you did and what problems you have after that.
steadfasterX said:
You should describe much more detailed what you did and what problems you have after that.
Click to expand...
Click to collapse
First i put the parted file on the phone and run it via terminal in TWRP.
cp /sdcard/parted /sbin/ && chmod 755 /sbin/parted was the command i used.
Second, i unmounted every partition and wrote the command: parted /dev/block/mmcblk0
After, I wrote p to see what number was my userdata (it was 50) and i wrote rm 50.
After i deleted the userdata, i wrote
mkpart userdata ext4 6359MB 30GB
mkpart vendor ext4 30GB 31.3GB
to make a vendor partiton.
Finally, i did a format data and @MeizuM6T edited the TWRP.
I did everything with @MeizuM6T .
Now i need vendor files.
The easiest way is to simply copy /system/vendor from an existing ROM tbh.
steadfasterX said:
The easiest way is to simply copy /system/vendor from an existing ROM tbh.
Click to expand...
Click to collapse
Most roms contain system-as root, obviously this is where @Emo19 and me get stuck.
Would connecting the vendor via FSTAB be enough to boot?
MeizuM6T said:
Most roms contain system-as root, obviously this is where @Emo19 and me get stuck.
Would connecting the vendor via FSTAB be enough to boot?
Click to expand...
Click to collapse
Well then i don't get the problem.
We mimic a vendor partition since (iirc) pie and to follow android standards we already moved everything needed to /system/vendor including config updates where needed pointing to /vendor. I would say 98% of this move is done already for the rest see e.g: https://github.com/LGgFour/android_device_lge_g4-common/search?q=System/vendor
Ofc currently /vendor is just a symlink to /system/vendor but for the system it feels like it has a separate vendor partition already.
So my guess was you just copy everything from /system/vendor and put that in your /vendor partition and if we made everything right and you fix the rest of the few /system/vendor paths it should just boot. Ofc you would need to update fstab to point to the dedicated vendor partition then. Does that help?
steadfasterX said:
Well then i don't get the problem.
Click to expand...
Click to collapse
The vendor has successfully connected but the treble support is still not visible.
Vendor is connected to the system and is working now, how should we arrange for treble?
MeizuM6T said:
The vendor has successfully connected but the treble support is still not visible.
Vendor is connected to the system and is working now, how should we arrange for treble?
Click to expand...
Click to collapse
no idea really. I have never ported anything to treble. just the other way around
steadfasterX said:
no idea really. I have never ported anything to treble. just the other way around
Click to expand...
Click to collapse
Thanks, I think we need to write "ro.treble.enabled = true" via build.prop. then we will try to install some GSI Roms.
MeizuM6T said:
Thanks, I think we need to write "ro.treble.enabled = true" via build.prop. then we will try to install some GSI Roms.
Click to expand...
Click to collapse
well I dont think its THAT easy. I was serious about the other way around so take a look at what I did for another device:
https://code.binbash.rocks:8443/MVA-VoLTE/android_device_samsung_j5y17lte/commits/branch/eos-q/search?q=treble&all=true
https://code.binbash.rocks:8443/MVA-VoLTE/android_device_samsung_exynos7870-common/commit/ab2567dc82fbdb2a21aa3ea28572dd18e5b7fb79
https://code.binbash.rocks:8443/MVA-VoLTE/android_kernel_samsung_exynos7870/commit/b8e2cf570dfd383fb3a4497d6b53d51c9226ca7b
Ofc you would do the opposite then what the commits showing and ofc I dunno if thats enough and haven't checked what needs to be adapted etc but it should give you an idea
steadfasterX said:
well I dont think its THAT easy. I was serious about the other way around so take a look at what I did for another device:
Click to expand...
Click to collapse
I doubt it will open either, it shouldn't be that simple. I will look at what you have thrown