Yes, I know XDA is filled with such guides.
But you can only port a TWRP if you implement parts of all the guides.
This guide is a summation of all those guides.
NOTE:
I would be using AIK-Linux in this tutorial, since I don't recommend Windows for all this, who knows what problems you will get into.
REQUIREMENTS:
1.Download these TWRP recoveries in accordance with your screen resolution.
A. If your screen resolution is 480x850, 480x854; download
https://twrp.me/lg/lgnexus4.html
B. If your screen resolution is 720x1280, 800x1280 or 720xsomething; download
https://twrp.me/asus/asusnexus720123g.html
C. If your screen resolution is 1080x1920, download
https://twrp.me/motorola/motorolanexus6.html
2. Download Android Image Kitchen-Linux from this thread:
https://forum.xda-developers.com/showthread.php?t=2073775
LET'S BEGIN:
1. Unzip Android Image Kitchen zip file.
3. Now, navigate to the unzipped folder of AIK (Android Image Kitchen).
4. Just Right Click and select "Open Terminal here".
5. Copy and paste your stock recovery.img and paste it in AIK folder.
6. In the terminal, type the command
Code:
su
Enter your root password, then type
Code:
./unpackimg.sh
7. This will unpack your stock recovery.img. Do not close the terminal.
8. Cut the new folders, ramdisk and split_img, and paste them somewhere outside of AIK folder.
9. Remove the stock recovery.img in AIK folder.
10. Now, copy and paste the twrp_recovery.img according to your screen resolution in the AIK folder.
11. Now, revert back to the terminal and type
Code:
./unpackimg.sh
12. This will unpack your twrp_recovery.img
13. Delete all the files in the new split_img folder we got by unpackimg twrp_recovery.img
14. Copy and paste all the files in stock split_img folder to the new split_img folder.
15. Delete following files from new ramdisk folder.
A. default.prop
B. fstab.devicename_or_chipsetname
C. ueventd.rc
D. Any other file like ueventd.devicename.rc
16. Copy and paste these files from stock ramdisk folder to new ramdisk folder.
Code:
default.prop
fstab.devicename
ueventd.rc
17. Now go into stock ramdisk/etc folder and copy recovery.fstab
18. Paste the recovery.fstab file in new ramdisk/etc folder.
19. Edit the twrp.fstab file according to the newly pasted recovery.fstab
20. You will have to replace"/sdcard" with "/external_sd" and "/usb" with "/usb-otg".
21. If the partitions stated above are not available in your fstab files then add these lines. Order may change on the format in which the files are written.
Code:
/external_sd vfat /dev/block/mmcblk1p1 flags=removable;storage;display="SDCARD"
/usb-otg auto /dev/block/sda1 flags=removable;storage;display="USB-OTG"
22. Edit the following lines as shown in default.prop
Code:
ro.secure=0
ro.adb.secure=0
security.perf_harden=0
ro.debuggable=1
persist.sys.usb.config=adb,mtp
23. Now, come out of the ramdisk folder and open the terminal.
24. Type
Code:
./repackimg.sh
25. Your new TWRP img would be generated and named as image-new.img by default. You may change the name later.
When you have successfully built the TWRP, or if you want to request one instead of creating yourself, contact me on this thread:
https://forum.xda-developers.com/android/general/unofficial-twrps-devices-source-code-t3833338
SPECIAL INSTRUCTIONS FOR MEDIATEK DEVICES:
1. The recovery.fstab you will get after unpacking your stock recovery.img would be flawed in most cases. I believe OEMs do this deliberately.
2. In order to know which partition is mounted at which location and at which device, you'll need DiskInfo (Install it from Play Store) and a root explorer.
3. Enable the following Diskinfo settings:
Code:
Show mount path
Show partition name
Show file system
Expert mode
Unmounted partitions
Device Mapper partitions
Temporary filesystems
4. Use the root explorer to find the path of your partitions. They would be located under /dev (mtk devices have bootimg and recovery here generally) and some other partitions like /system, /cache would be deeper inside.
5. You can trace their exact locations by navigating within the /dev directory for partition names like mmcblk0p5.
SPECIAL INSTRUCTIONS FOR DEVICES THAT DON'T HAVE RECOVERY.FSTAB WITHIN STOCK RECOVERY.IMG
1. In the ramdisk/etc folder, there might be a dummy recovery.fstab file with the symbol of link on it.
2. Right click on the file and select "Show Target". You'll get to know the path of original recovery.fstab file. It might be within the unpacked recovery or inside some other partition on your phone.
For example: Honor 7C devices have their recovery.fstab in /vendor/etc folder.
TROUBLESHOOTING INSTRUCTIONS:
1. If you get a dm-verity error or facing an encryption problem, go to this thread and flash the "dm-verity and forceencrypt disabler zip".
https://forum.xda-developers.com/android/software/universal-dm-verity-forceencrypt-t3817389
2. If you encounter a bootloop while booting into your new TWRP, please consult post #20 of this thread.
3. At times, the path of partitions during recovery boot is not the same as those during normal boot. That's why you may get errors like
Code:
Updating partitions details...
Failed to mount '/cache' (Invalid argument)
Failed to mount '/system' (Invalid argument)
Failed to mount '/data' (Invalid argument)
Failed to mount '/metadata' (Invalid argument)
...done
Unable to mount storage
Failed to mount '/data' (Invalid argument)
To resolve this, in your TWRP terminal type the following command
Code:
find /dev/block -name by-name
Replace the paths of the partitions in your fstab files with the ones you get as output using the command above (only the partitions which failed to mount).
If there are some bugs or you need some assistance in porting TWRP, contact me by mentioning in your post, for example @Augustoandro, we'll work on it to make it bug-free.
Special thanks to @aIecxs for his troubleshooting instructions of bootloop, "Failed to mount /partition_name (invalid argument)" error and also @inguna for guiding me on how to fix the "SDCARD not detected by the TWRP" problem and also fixing the MTP, ADB not working issue.
Another thanks to @seanybiker and @avirus for their troubleshooting instructions on "DM-Verity and forceencrypt" errors.
CREDITS:
@HostZero for his porting guide.
@osm0sis for his awesome Android Image Kitchen
@Zackptg5 for his "DM-Verity and Forceencrypt disabler zip".
Augustoandro said:
Yes, I know XDA is filled with such guides.
But you can only port a TWRP if you implement parts of all the guides.
This guide is a summation of all those guides.
NOTE:
I would be using AIK-Linux in this tutorial, since I don't recommend Windows for all this, who knows what problems you will get into.
REQUIREMENTS:
1.Download these TWRP recoveries in accordance with your screen resolution.
A. If your screen resolution is 480x850, 480x854; download
https://twrp.me/devices/lgnexus4.html
B. If your screen resolution is 720x1280, 800x1280 or 720xsomething; download
https://twrp.me/devices/asusnexus720123g.html
C. If your screen resolution is 1080x1920, download
https://twrp.me/devices/motorolanexus6.html
2. Download Android Image Kitchen-Linux from this thread:
https://forum.xda-developers.com/showthread.php?t=2073775
LET'S BEGIN:
1. Unzip Android Image Kitchen zip file.
3. Now, navigate to the unzipped folder of AIK (Android Image Kitchen).
4. Just Right Click and select "Open Terminal here".
5. Copy and paste your stock recovery.img and paste it in AIK folder.
6. In the terminal, type
Code:
./unpackimg.sh
7. This will unpack your stock recovery.img. Do not close the terminal.
8. Cut the new folders, ramdisk and split_img, and paste them somewhere outside of AIK folder.
9. Remove the stock recovery.img in AIK folder.
10. Now, copy and paste the twrp_recovery.img according to your screen resolution in the AIK folder.
11. Now, revert back to the terminal and type
Code:
./unpackimg.sh
12. This will unpack your twrp_recovery.img
13. Delete all the files in the new split_img folder we got by unpackimg twrp_recovery.img
14. Copy and paste all the files in stock split_img folder to the new split_img folder.
15. Delete following files from new ramdisk folder.
A. default.prop
B. fstab.devicename_or_chipsetname
C. ueventd.rc
D. Any other file like ueventd.devicename.rc
16. Copy and paste these files from stock ramdisk folder to new ramdisk folder.
A. default.prop
B. fstab.devicename
C. ueventd.rc
17. Now go into stock ramdisk/etc folder and copy recovery.fstab
18. Paste the recovery.fstab file in new ramdisk/etc folder.
19. Edit the twrp.fstab file according to the newly pasted recovery.fstab
20. You will have to replace"/sdcard" with "/external_sd" and "/usb" with "/usb-otg".
21. If the partitions stated above are not available in your fstab files then add these lines. Order may change on the format in which the files are written.
Code:
/external_sd vfat /dev/block/mmcblk1p1 flags=removable;storage;display="SDCARD"
/usb-otg auto /dev/block/sda1 flags=removable;storage;display="USB-OTG"
22. Edit the following lines as shown in default.prop
Code:
ro.secure=0
ro.adb.secure=0
security.perf_harden=0
ro.debuggable=1
persist.sys.usb.config=adb,mtp
23. Now, come out of the ramdisk folder and open the terminal.
24. Type
Code:
./repackimg.sh
25. Your new TWRP img would be generated and named as image-new.img by default. You may change the name later.
When you have successfully built the TWRP, contact me on this thread:
https://forum.xda-developers.com/android/general/unofficial-twrps-devices-source-code-t3833338
SPECIAL INSTRUCTIONS FOR MEDIATEK DEVICES:
1. The recovery.fstab you will get after unpacking your stock recovery.img would be flawed in most cases. I believe OEMs do this deliberately.
2. In order to know which partition is mounted at which location and at which device, you'll need DiskInfo (Install it from Play Store) and a root explorer.
3. Change the Diskinfo settings like this
https://mega.nz/#!fbIR0AoD!ykRMTAitymE4bQMVc6S0qbCYztTkVZDZSgIKcVTxEHg
https://mega.nz/#!yXQzwKJK!rWO_LiKZwFjzw4ZyM0qzzKw6uopxrxAkSkKNRYXVuIY
4. Use the root explorer to find the path of your partitions. They would be located under /dev (mtk devices have bootimg and recovery here generally) and some other partitions like /system, /cache would be deeper inside.
5. You can trace their exact locations by navigating within the /dev directory for partition names like mmcblk0p5.
SPECIAL INSTRUCTIONS FOR DEVICES THAT DON'T HAVE RECOVERY.FSTAB WITHIN STOCK RECOVERY.IMG
1. In the ramdisk/etc folder, there might be a dummy recovery.fstab file with the symbol of link on it.
2. Right click on the file and select "Show Target". You'll get to know the path of original recovery.fstab file. It might be within the unpacked recovery or inside some other partition on your phone.
For example: Honor 7C devices have their recovery.fstab in /vendor/etc folder.
If it works perfectly, I will make it available to others through my thread.
If there are some bugs or you need some assistance in porting TWRP, contact me all the same, we'll work on it to make it bug-free.
CREDITS:
HostZero for his porting guide.
Osm0sis for his awesome Android Image Kitchen
Click to expand...
Click to collapse
I tried all these type op method but didnt work on my android.
Please help.
It alway on bootloop and restart normaly
Sent from my Titanium Vista 4G using Tapatalk
SachinBorkar said:
I tried all these type op method but didnt work on my android.
Please help.
It alway on bootloop and restart normaly
Click to expand...
Click to collapse
Tell me what happened in detail.
Which files you transferred?
Did terminal show you any errors upon running the commands?
It would be better if you did everything using root account.
Btw, you should give executing permissions to all files inside AIK-Linux/bin
No error occurs during packing and unpacking but.
After flash recovery.img phones stuck on bootloop.
Sent from my Titanium Vista 4G using Tapatalk
---------- Post added at 02:59 PM ---------- Previous post was at 02:44 PM ----------
Augustoandro said:
Tell me what happened in detail.
Which files you transferred?
Did terminal show you any errors upon running the commands?
It would be better if you did everything using root account.
Btw, you should give executing permissions to all files inside AIK-Linux/bin
Click to expand...
Click to collapse
No error occurs but after flash recovery.img
Phone stuck on boot.
Here is my stock recovery and important files please port
My recovery
https://drive.google.com/file/d/1SkLx_th8esVi1URWs8-16xv6A9dOF-Bi/view?usp=drivesdk
Sent from my Titanium Vista 4G using Tapatalk
SachinBorkar said:
No error occurs during packing and unpacking but.
After flash recovery.img phones stuck on bootloop.
Sent from my Titanium Vista 4G using Tapatalk
---------- Post added at 02:59 PM ---------- Previous post was at 02:44 PM ----------
No error occurs but after flash recovery.img
Phone stuck on boot.
Here is my stock recovery and important files please port
My recovery
https://drive.google.com/file/d/1SkLx_th8esVi1URWs8-16xv6A9dOF-Bi/view?usp=drivesdk
Click to expand...
Click to collapse
You already requested on my another thread.
Augustoandro said:
You already requested on my another thread.
Click to expand...
Click to collapse
Thanks for replay I am working to create it.
But i also request that you have experience so you may help.
I am not going to request again sorry.
I will wait.
And also i try my best.
Thanks.
Sent from my Titanium Vista 4G using Tapatalk
Another great thread from op...
Thanks a lot @Augustoandro! IMHO this is by far the easiest guide for porting TWRP to unsupported devices. Keep it up!
Augustoandro said:
Yes, I know XDA is filled with such guides.
But you can only port a TWRP if you implement parts of all the guides.
This guide is a summation of all those guides.
NOTE:
I would be using AIK-Linux in this tutorial, since I don't recommend Windows for all this, who knows what problems you will get into.
REQUIREMENTS:
1.Download these TWRP recoveries in accordance with your screen resolution.
A. If your screen resolution is 480x850, 480x854; download
https://twrp.me/devices/lgnexus4.html
B. If your screen resolution is 720x1280, 800x1280 or 720xsomething; download
https://twrp.me/devices/asusnexus720123g.html
C. If your screen resolution is 1080x1920, download
https://twrp.me/devices/motorolanexus6.html
2. Download Android Image Kitchen-Linux from this thread:
https://forum.xda-developers.com/showthread.php?t=2073775
LET'S BEGIN:
1. Unzip Android Image Kitchen zip file.
3. Now, navigate to the unzipped folder of AIK (Android Image Kitchen).
4. Just Right Click and select "Open Terminal here".
5. Copy and paste your stock recovery.img and paste it in AIK folder.
6. In the terminal, type the command
Code:
su
Enter your root password, then type
Code:
./unpackimg.sh
7. This will unpack your stock recovery.img. Do not close the terminal.
8. Cut the new folders, ramdisk and split_img, and paste them somewhere outside of AIK folder.
9. Remove the stock recovery.img in AIK folder.
10. Now, copy and paste the twrp_recovery.img according to your screen resolution in the AIK folder.
11. Now, revert back to the terminal and type
Code:
./unpackimg.sh
12. This will unpack your twrp_recovery.img
13. Delete all the files in the new split_img folder we got by unpackimg twrp_recovery.img
14. Copy and paste all the files in stock split_img folder to the new split_img folder.
15. Delete following files from new ramdisk folder.
A. default.prop
B. fstab.devicename_or_chipsetname
C. ueventd.rc
D. Any other file like ueventd.devicename.rc
16. Copy and paste these files from stock ramdisk folder to new ramdisk folder.
A. default.prop
B. fstab.devicename
C. ueventd.rc
17. Now go into stock ramdisk/etc folder and copy recovery.fstab
18. Paste the recovery.fstab file in new ramdisk/etc folder.
19. Edit the twrp.fstab file according to the newly pasted recovery.fstab
20. You will have to replace"/sdcard" with "/external_sd" and "/usb" with "/usb-otg".
21. If the partitions stated above are not available in your fstab files then add these lines. Order may change on the format in which the files are written.
Code:
/external_sd vfat /dev/block/mmcblk1p1 flags=removable;storage;display="SDCARD"
/usb-otg auto /dev/block/sda1 flags=removable;storage;display="USB-OTG"
22. Edit the following lines as shown in default.prop
Code:
ro.secure=0
ro.adb.secure=0
security.perf_harden=0
ro.debuggable=1
persist.sys.usb.config=adb,mtp
23. Now, come out of the ramdisk folder and open the terminal.
24. Type
Code:
./repackimg.sh
25. Your new TWRP img would be generated and named as image-new.img by default. You may change the name later.
When you have successfully built the TWRP, or if you want to request one instead of creating yourself, contact me on this thread:
https://forum.xda-developers.com/android/general/unofficial-twrps-devices-source-code-t3833338
SPECIAL INSTRUCTIONS FOR MEDIATEK DEVICES:
1. The recovery.fstab you will get after unpacking your stock recovery.img would be flawed in most cases. I believe OEMs do this deliberately.
2. In order to know which partition is mounted at which location and at which device, you'll need DiskInfo (Install it from Play Store) and a root explorer.
3. Change the Diskinfo settings like this
https://mega.nz/#!fbIR0AoD!ykRMTAitymE4bQMVc6S0qbCYztTkVZDZSgIKcVTxEHg
https://mega.nz/#!yXQzwKJK!rWO_LiKZwFjzw4ZyM0qzzKw6uopxrxAkSkKNRYXVuIY
4. Use the root explorer to find the path of your partitions. They would be located under /dev (mtk devices have bootimg and recovery here generally) and some other partitions like /system, /cache would be deeper inside.
5. You can trace their exact locations by navigating within the /dev directory for partition names like mmcblk0p5.
SPECIAL INSTRUCTIONS FOR DEVICES THAT DON'T HAVE RECOVERY.FSTAB WITHIN STOCK RECOVERY.IMG
1. In the ramdisk/etc folder, there might be a dummy recovery.fstab file with the symbol of link on it.
2. Right click on the file and select "Show Target". You'll get to know the path of original recovery.fstab file. It might be within the unpacked recovery or inside some other partition on your phone.
For example: Honor 7C devices have their recovery.fstab in /vendor/etc folder.
If it works perfectly, I will make it available to others through my thread.
If there are some bugs or you need some assistance in porting TWRP, contact me all the same, we'll work on it to make it bug-free.
CREDITS:
HostZero for his porting guide.
Osm0sis for his awesome Android Image Kitchen
Click to expand...
Click to collapse
Pls brother help me port twrp for my device. Here is my stock recovery image link : https://drive.google.com/file/d/1dqBU4f0ZXK8Ot0V9t-4Tw6f_60UHg7ca/view?usp=drivesdk.
My phone's resolution : 720 x 1280 pixel.
Deeni131 said:
Pls brother help me port twrp for my device. Here is my stock recovery image link : https://drive.google.com/file/d/1dqBU4f0ZXK8Ot0V9t-4Tw6f_60UHg7ca/view?usp=drivesdk.
My phone's resolution : 720 x 1280 pixel.
Click to expand...
Click to collapse
This is not a TWRP request thread. I have included a link in the guide which takes you to a TWRP request thread. Post your request over there.
HIT THANKS IF FOUND USEFUL
Hi I tried to Port a Recovery for my H96 Max RK3399 TV Box .
I used TWRP From My RK3328 TVBox.
I can Boot in Recovery, but its not Mounting any Partition (everywhere 0MB)
I Think the problem is in .Fstab File but I am Not sure.
I would appreciate help
Sorry for my poor English
Leone_1 said:
Hi I tried to Port a Recovery for my H96 Max RK3399 TV Box .
I used TWRP From My RK3328 TVBox.
I can Boot in Recovery, but its not Mounting any Partition (everywhere 0MB)
I Think the problem is in .Fstab File but I am Not sure.
I would appreciate help
Sorry for my poor English
Click to expand...
Click to collapse
Partitions not being recognized means the problem is in fstab files. Both recovery.fstab and twrp.fstab need to be edited.
I am sure of it.
HIT THANKS IF FOUND USEFUL
Hi,
I have an unofficial TWRP For my phone (Moto G5s+) but it's broken (It mounts system partitions even in read-only mode breaking things, and the current TWRP devs for the devices won't fix it). If I follow your guide and unpack one of these TWRP, I should be able to edit it to leave certain partitions Read Only, right?
pizzaboy192 said:
Hi,
I have an unofficial TWRP For my phone (Moto G5s+) but it's broken (It mounts system partitions even in read-only mode breaking things, and the current TWRP devs for the devices won't fix it). If I follow your guide and unpack one of these TWRP, I should be able to edit it to leave certain partitions Read Only, right?
Click to expand...
Click to collapse
You have to edit the fstab files for that, look for them in ramdisk/etc folder when you unpack the recovery.
HIT THANKS IF FOUND USEFUL
Augustoandro said:
Partitions not being recognized means the problem is in fstab files. Both recovery.fstab and twrp.fstab need to be edited.
I am sure of it.
HIT THANKS IF FOUND USEFUL
Click to expand...
Click to collapse
thanks for reply.
must be in the fstab TWRP/Stock the identical partitions?
or this only in TWRP.fstab?
Leone_1 said:
thanks for reply.
must be in the fstab TWRP/Stock the identical partitions?
or this only in TWRP.fstab?
Click to expand...
Click to collapse
What are you trying to ask?
HIT THANKS IF FOUND USEFUL
Augustoandro said:
Partitions not being recognized means the problem is in fstab files. Both recovery.fstab and twrp.fstab need to be edited.
I am sure of it.
HIT THANKS IF FOUND USEFUL
Click to expand...
Click to collapse
Augustoandro said:
What are you trying to ask?
HIT THANKS IF FOUND USEFUL
Click to expand...
Click to collapse
must be in the fstab TWRP/Stock the identical partitions?
or this
"/external_sd vfat /dev/block/mmcblk1p1 flags=removable;storage;display="SDCARD"
/usb-otg auto /dev/block/sda1 flags=removable;storage;display="USB-OTG"
only in TWRP.fstab?
Augustoandro said:
You have to edit the fstab files for that, look for them in ramdisk/etc folder when you unpack the recovery.
HIT THANKS IF FOUND USEFUL
Click to expand...
Click to collapse
Found exactly what I needed. Thanks! I've passed this info up to the other devs too since they didn't feel like digging into it.
Leone_1 said:
must be in the fstab TWRP/Stock the identical partitions?
or this
"/external_sd vfat /dev/block/mmcblk1p1 flags=removable;storage;display="SDCARD"
/usb-otg auto /dev/block/sda1 flags=removable;storage;display="USB-OTG"
only in TWRP.fstab?
Click to expand...
Click to collapse
twrp.fstab and recovery.fstab should be identical, so all you have to do is copy and paste the contents of one into the other after rectifying whatever is wrong with them.
HIT THANKS IF FOUND USEFUL
to all people who experience boot loop on TWRP splash screen:
Code:
adb shell
df
you will figure out which mount point is crashing. fix it in fstab. you may have a look in /cache/recovery/last_log too
for me the reason was vold mounts, i simply deleted two lines (yes, its /devices instead of /sys/devices i don't know if it is a bug, its from stock boot.img)
Code:
/devices/mtk-msdc.0/11120000.msdc0* auto vfat defaults voldmanaged=sdcard0:auto
/devices/mtk-msdc.0/11130000.msdc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
if touch screen is not working, you can still use touch screen when booted from fastboot (unfortunately no fix, yet):
Code:
fastboot boot <twrp.img>
Related
There may be alot of guides out there how to make flashable zip of your ftf released by Sony ! But extracting ext4 files can be a headache !
I tried searching alot ! learned alot ! there were so many information that a Noob(like me) can be so much confused !
You can extract .ext4 file on windows also but that may cause BOOTLOOP also ! [PERSONAL EXPERIENCE]
So here are the simple steps to extract .ext4 files easily in linux !
1) open terminal
2) type
sudo nautilus
Click to expand...
Click to collapse
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
sudo mount -o loop /root/desktop/system.ext4 /home/USERNAME/Desktop/mounted
Click to expand...
Click to collapse
(Basic Structure of that command is: sudo mount flag loop ext4 directory mounted directory !)
HERE;
/root/desktop/system.ext4 is the directory of .ext4 file
/home/USERNAME/Desktop/mounted is the directory of destination folder !
AND DONE ! You can grab those files and put in system folder of your zip file !
NOTE THAT: THIS EXTRACTED DATA WILL BE ODEXED !
ShivangDave said:
...
Click to expand...
Click to collapse
Hi, This was the guide which i was really looking for but unfortunately the code is not working for me in can you please check it again ?
Edit: Thanks it worked ! Great. The explanation for the code given by you helped me solving it ! Thanks a lot bro
M4ST3R-V said:
Hi, This was the guide which i was really looking for but unfortunately the code is not working for me in can you please check it again ?
Edit: Thanks it worked ! Great. The explanation for the code given by you helped me solving it ! Thanks a lot bro
Click to expand...
Click to collapse
Glad to hear that
ShivangDave said:
Glad to hear that
Click to expand...
Click to collapse
desktop is spelled with a capital D
thank you! using today this noob guide, very helpfull!!!
Buddy..I wanna try making a zip from ftf.
So I have extracted the system.sin into a folder system...
Now I need meta-inf to be kept along with system into a zip right....
So if I go wrong somewhere will I brick my phone..
Also can I simply delete all the unwanted apps from apps folder?
Please..I know you are a guy who knows all these stuff..I saw many guides,yet I am afraid if somethin bad will happen to my device..
Plz help me... I need you badly.
Hit the thanks button..it does not cost you anything.
it's worth something for me...
sent from my Sony Xperia e dual
mathewsj114 said:
Buddy..I wanna try making a zip from ftf.
So I have extracted the system.sin into a folder system...
Now I need meta-inf to be kept along with system into a zip right....
So if I go wrong somewhere will I brick my phone..
Also can I simply delete all the unwanted apps from apps folder?
Please..I know you are a guy who knows all these stuff..I saw many guides,yet I am afraid if somethin bad will happen to my device..
Plz help me... I need you badly.
Hit the thanks button..it does not cost you anything.
it's worth something for me...
sent from my Sony Xperia e dual
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=2183077
ShivangDave said:
There may be alot of guides out there how to make flashable zip of your ftf released by Sony ! But extracting ext4 files can be a headache !
I tried searching alot ! learned alot ! there were so many information that a Noob(like me) can be so much confused !
You can extract .ext4 file on windows also but that may cause BOOTLOOP also ! [PERSONAL EXPERIENCE]
So here are the simple steps to extract .ext4 files easily in linux !
1) open terminal
2) type
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
(Basic Structure of that command is: sudo mount flag loop ext4 directory mounted directory !)
HERE;
/root/desktop/system.ext4 is the directory of .ext4 file
/home/USERNAME/Desktop/mounted is the directory of destination folder !
AND DONE ! You can grab those files and put in system folder of your zip file !
NOTE THAT: THIS EXTRACTED DATA WILL BE ODEXED !
Click to expand...
Click to collapse
nautilus is just for ubuntu, mention that you need to swap nautilus with your file manager if you're using a different distro other than ubuntu(e.g lubuntu= pcmanfm )
Also when using GUI and sudo, it's best to use gksudo instead of sudo.
Hi,
It works fine, so thanks for that, but I end up with a ''volume of 682 MB''. Unmounting and ejecting doesn't work and simply deleting it, also won't work. Does anyone have any idea how to remove this ''device'' from my system? It's quite annoying and takes in space.
Thanks!
Never mind , a reboot fixed it...
Sent from my C1505 using XDA Premium 4 mobile app
ShivangDave said:
1) open terminal
2) type
Code:
sudo nautilus
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
Code:
sudo mount -o loop /root/desktop/system.ext4 /home/USERNAME/Desktop/mounted
Click to expand...
Click to collapse
First off let me say that I am in no way a Linux user, but I tend to be quite resourceful when it comes to researching. This one is beginning to stump me. Second, I am using crunchbang {a Debian (Wheezy)} build and therefore I had to modify the coding a little bit.
This is what I did just to even get it to accept my query without issues
Code:
sudo nautilus
This pulled up my Desktop in File Manager with root privileges. I created the mounted folder and put the system.img.ext4 in the Desktop location. Debian, or crunchbang, does not have a physical Desktop for placing files, as far as I have learned, just this folder located in the root folder. Anyways, after doing those two things I did this
Code:
sudo mount -t ext4 /root/Desktop/system.img.ext4 /root/Desktop/mounted
This was the first code I tried that didn't return any error about the location, fs, or anything. Feeling hopeful that I had finally figured out and was going to be able to access my system.img I look at my Desktop folder and open up the mounted folder, what do I see? Lost+Found folder with nothing in it, and a hidden folder called .Trash-0 which contains two folders "files" and "info". "files" contains a folder just like the non-hidden lost+found with nothing in it and the "info" folder which contains an 0byte file titled lost+foundinfo. My system file is over 2GB in size, so I am at a standstill because I do not know how to proceed.
jacodaburr said:
First off let me say that I am in no way a Linux user, but I tend to be quite resourceful when it comes to researching. This one is beginning to stump me. Second, I am using crunchbang {a Debian (Wheezy)} build and therefore I had to modify the coding a little bit.
This is what I did just to even get it to accept my query without issues
Code:
sudo nautilus
This pulled up my Desktop in File Manager with root privileges. I created the mounted folder and put the system.img.ext4 in the Desktop location. Debian, or crunchbang, does not have a physical Desktop for placing files, as far as I have learned, just this folder located in the root folder. Anyways, after doing those two things I did this
Code:
sudo mount -t ext4 /root/Desktop/system.img.ext4 /root/Desktop/mounted
This was the first code I tried that didn't return any error about the location, fs, or anything. Feeling hopeful that I had finally figured out and was going to be able to access my system.img I look at my Desktop folder and open up the mounted folder, what do I see? Lost+Found folder with nothing in it, and a hidden folder called .Trash-0 which contains two folders "files" and "info". "files" contains a folder just like the non-hidden lost+found with nothing in it and the "info" folder which contains an 0byte file titled lost+foundinfo. My system file is over 2GB in size, so I am at a standstill because I do not know how to proceed.
Click to expand...
Click to collapse
change the directory if possible, and change the command according to it.. Because I'm in no way a crunchbang user let me know if i can help in any other way though...
sudo mount flag loop ext4directory mounteddirectory
ShivangDave said:
change the directory if possible, and change the command according to it.. Because I'm in no way a crunchbang user let me know if i can help in any other way though...
sudo mount flag loop ext4directory mounteddirectory
Click to expand...
Click to collapse
trying to use that code with flag and/or loop returns this
Code:
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems
mount -l : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
mount -a [-t|-O] ... : mount all stuff from /etc/fstab
mount device : mount device at the known place
mount directory : mount known device here
mount -t type dev dir : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir
or move a subtree:
mount --move olddir newdir
One can change the type of mount containing the directory dir:
mount --make-shared dir
mount --make-slave dir
mount --make-private dir
mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
mount --make-rshared dir
mount --make-rslave dir
mount --make-rprivate dir
mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using -L label or by uuid, using -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say man 8 mount .
From now on, Android rom can be easy to pack. You don't need to worry about the permissions of the files or the symlinks anymore.
What does this package do:
1. Automatically find and recognize the img with patterned name in the same folder of this package.
2. Automatically wipe and flash the system partition when system.img is found.
3. Automatically flash the addon pack without wiping the system partition when addon.*.img is found.
4. Automatically backup efs and efs_gsm partition, on Samsung Duo sim card phones.
5. Be able to flash the unmountable partitions like boot, recovery, modem, etc.
How to pack:
1. Make you rom on on the Phone or Linux. On the Phone? Yes, you can test your patches on your phone.
2. No matter on the Phone or on Linux, cd /system/ or cd <your system folder>, check the permissions and symlinks. Usually I don't check cause I modify directly on a system I dumped from my phone. Yes a dump of system partition is a good idea.
3. You have two optitions: 1. Use the modified dumped system partition dump as system.img. This usually generate a big img to flash, but will flash faster. 2. If you use extracted folder or want to use small files, cd to the system folder in shell and make the folder to a tarball with the command: 'tar --lzma -cf <your tar file> * .[!.]*'. Why use * .[!.]*? This will put the .* files and folders in the tarball.
4. Then rename the dumped image or the tarball to system.img and put it in the same folder of the FLASHER.
5. Want to make an addon? Just make the name like addon.<your name>.img. Don't for get the permissions and ownership of the files and folders.
Future plan:
1. Make a packer/dumper for the system partition.
Github:
https://github.com/maxfu/universal_android_flasher
I will edit this post and post some pictures later.
Okay so I decided I'd make a thread on this, so that everyone would know. (why else? )
Pretty Noob friendly...
needed libs:
https://drive.google.com/file/d/0B9uqk9InEzCYMUtaZGI0ekJRNUU/view?usp=sharing
EDIT: FRAMEWORK.jar IS TRASH
READ HERE
https://github.com/testwhat/SmaliEx/issues/3
If you just want nexus 5 andorid preview 1 (first) apps to add to your rom, https://drive.google.com/folder/d/0...3WVBuaHNMeVQwZ3lzbkZIM0ZLRGJIZTUxMWpFd00/edit
Put apps, some priv-apps, and even less frameworks
Requirements:
Java 8 JRE or JDK
git
Device targeted
Okay so first you need to
1. take your system.img (If you don't have that check the bottom of this post) and unexact it (if you don't know how, bottom of post).
2. "git clone --recursive https://github.com/Aaahh/deodex-app" to your home folder or folder of choosing
3. "cd ~/deodex-app" or to where you cloned it
4. Now copy that unextracted system.img (/system folder) to deodex-app's folder
5. Now open terminal and run "./all"
6. that will deodex everything, but bootclass frameworks are different.
7. Take your device, plug it in, run "./oat2dex devfw"
8. take the boot-jar-result and copy it to deodex-app/out/framework
9. Now copy the contents of deodex-app/out to /system
10. repack system (bottom of post)
11. fastboot flash system system_new.img and your done.
Dump system image from device:
If you don't have system.img than follow this: http://forum.xda-developers.com/showthread.php?t=2450045
Decompile system.img
Depending on how you got your system image,
if you took it from a flashable zip, http://forum.xda-developers.com/and.../how-to-conver-lollipop-dat-files-to-t2978952 (Post two, after mounting, make a copy of the mounted folder, thats /system)
if you took it from google preview, (or sparse)
1. git clone https://android.googlesource.com/platform/system/extras -b android-m-preview
2. cd extras/ext4_utils
3. cd ../../
4. ./extras/ext4_utils/simg2img system.img system.raw.img
5. then mount that and make a copy of the mouted folder, that's your /system folder
How to repack /system
Download this, https://mega.co.nz/#!8cxUALSK!tNFals1oIxqKzd51Czf7vORlc8NA_WKeHPxbDNfOYsg
then use it like this
./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img output/
file_contexts is from your zip, if you can't find it check your boot.img, if you can't do that and you have selinux permissive, then just find any device's file and use it.
awesome
Nice
Sent from my LG-P705 using Tapatalk
Aaahh said:
Okay so I decided I'd make a thread on this, so that everyone would know. (why else? )
Pretty Noob friendly...
If you just want nexus 5 andorid preview 1 (first) apps to add to your rom, https://drive.google.com/folder/d/0...3WVBuaHNMeVQwZ3lzbkZIM0ZLRGJIZTUxMWpFd00/edit
Put apps, some priv-apps, and even less frameworks
Requirements:
Java 8 JRE or JDK
git
Device targeted
Okay so first you need to
1. take your system.img (If you don't have that check the bottom of this post) and unexact it (if you don't know how, bottom of post).
2. "git clone --recursive https://github.com/Aaahh/deodex-app" to your home folder or folder of choosing
3. "cd ~/deodex-app" or to where you cloned it
4. Now copy that unextracted system.img (/system folder) to deodex-app's folder
5. Now open terminal and run "./all"
6. that will deodex everything, but bootclass frameworks are different.
7. Take your device, plug it in, run "./oat2dex devfw"
8. take the boot-jar-result and copy it to deodex-app/out/framework
9. Now copy the contents of deodex-app/out to /system
10. repack system (bottom of post)
11. fastboot flash system system_new.img and your done.
Dump system image from device:
If you don't have system.img than follow this: http://forum.xda-developers.com/showthread.php?t=2450045
Decompile system.img
Depending on how you got your system image,
if you took it from a flashable zip, http://forum.xda-developers.com/and.../how-to-conver-lollipop-dat-files-to-t2978952 (Post two, after mounting, make a copy of the mounted folder, thats /system)
if you took it from google preview, (or sparse)
1. git clone https://android.googlesource.com/platform/system/extras -b android-m-preview
2. cd extras/ext4_utils
3. cd ../../
4. ./extras/ext4_utils/simg2img system.img system.raw.img
5. then mount that and make a copy of the mouted folder, that's your /system folder
How to repack /system
Download this, https://mega.co.nz/#!8cxUALSK!tNFals1oIxqKzd51Czf7vORlc8NA_WKeHPxbDNfOYsg
then use it like this
./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img output/
file_contexts is from your zip, if you can't find it check your boot.img, if you can't do that and you have selinux permissive, then just find any device's file and use it.
Click to expand...
Click to collapse
Sorry for the question but ^^ you did upload the N5 apps and framework but what about libs for Google apps?
manups4e said:
Sorry for the question but ^^ you did upload the N5 apps and framework but what about libs for Google apps?
Click to expand...
Click to collapse
Ay you got me there
Forgot about that
Framework.jar is trash
https://github.com/testwhat/SmaliEx/issues/3
So here you come. To read and perform this tutorial, you obviously need a first hand experience on flashing a ROM and/or kernels. Otherwise this tutorial and my efforts to get you a device with two OSes running might end up giving you a bricked device. So, if you're hearing the terms "flashing" or 'kernels' for the first time and thinking it's kinda good food, then bro, just go and taste those first.
Something's to remind before we gonna dig deep into this tutorial->
1> Noone but you will be responsible for what you end up with.
2> The warranty of your device will be voided after this if it isn't already after rooting. For MI users, the good news is that you can reclaim it by just flashing the fastboot ROM for your device.
Enough lectures. Bro let's get to work.
This you'll be needing =>
1> One working Windows PC(because I doesn't know any replacement of bootimg.exe on any other OS. If you know, then let me).
2> A class 10 memory card ( I recommend 32GB for the spaces)
3> A custom ROM and kernel for your phone(the second os)
4> Any custom CWM based recovery installed.(since TWRP is most popular, I will demonstrate using it. You can use any other you want overall process will be the same)
5> ADB, fastboot and the device drivers (easily found in XDA)
PART 1: MODIFYING THE BOOT
At first, how does your device boots up? What are the partitions called /data and /system? The answer is quite simple. It's your kernel that points out the location from where the OS should be picked up. So for booting into the second OS we need some modifications to it at first.
Search and download bootimg.exe on XDA, I'll post a link later. Create two folders. Name them "Internal OS" and "External OS" respectively. Put the zip file of the OS you're currently using to the first one and the OS you're gonna use on the external storage to the second one. Rename the second OS to originalExternalOS.zip. Extract originalExternalOS.zip. Pick the boot.img file from the root of the extracted folder and move it to a new folder named "boot2". Extract the IMG using bootimg.exe. Navigate to the initrd folder and you will get a file named 'fstab".
Basically it's the file that tells the kernel which partition does the OS resides in.
Open the file in your favourite text editor.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
/dev/block/bootdevice/by-name/cache => /dev/block/mmcblk1p4
Save the file without giving any extension to it. Repack it using the same tool. You'll have boot-new.img and boot-old.img. Rename boot-new.img to boot.img and replace the one in the root folder with this. Basically what we're doing here is replacing the old boot.img with the modified one.
For your knowledge, blocks are the partitions of any storage you have on your device. For example, your internal storage is partitioned to near about 30 different blocks each starting with prefix "mmcblk0p". We here just told the kernel to load the OS from the blocks mentioned. We'll be creating these blocks in the external SD card next.
PART 2: PARTITIONING THE SD CARD
Connect your device with the memory card inserted to your PC. If you haven't installed fastboot, ADB, and the drivers, do it now.
READ THE FOLLOWING CAREFULLY
Reboot the device to recovery mode. Type the commands in cmd:
Code:
adb shell
parted
unit MB
print
quit
umount external_sd
Read and store the minimum and maximum capacity of your card. Since different cards will have different capacities I will point it as variable MIN_SIZE and MAX_SIZE. You'll need to calculate and put the values in the commands. Now type the following commands on cmd:
Code:
parted /dev/block/mmcblk1
rm 1
//START_BLOCK = MAX_SIZE - 5000
mkpartfs primary fat32 MIN_SIZE START_BLOCK
//SYS_START = START_BLOCK+1
//SYS_END = SYS_START + 1200
mkpartfs primary ext2 SYS_START SYS_END
//DATA_START = SYS_END+1
//DATA_END = DATA_START + 3500
mkpartfs primary ext2 DATA_START DATA_END
//CACHE_START = DATA_END + 1
mkpartfs primary ext2 CACHE_START MAX_SIZE
//We have partitioned the memory card. Let's format them. Ignore all "Do you wish to continue" question in the next commands as we're already mentioning yes.
mkfs yes 1 fat32
mkfs yes 2 ext2
mkfs yes 3 ext2
mkfs yes 4 ext2
quit
//Now they are almost ready. Just make the newly created blocks readable by the OS.
make_ext4fs /dev/block/mmcblk1p2
make_ext4fs /dev/block/mmcblk1p3
make_ext4fs /dev/block/mmcblk1p4
//Now you get where does the blocks come in the kernel right?
exit
//You've covered up the hardest part. Let's get some coffee and cheeerssss.
PART 3: MODIFYING THE NEW OS
You've left the OS extracted in the "External OS" folder right? It's time to do some magic in it. We're gonna tell the OS to be installed in the blocks we created just like the kernel. But wait, where does the OS know before installing where it should get installed? Well, the answer hides in the updater-script in the folder META-INF > com > google > android. Navigate yourself in it. Open the updater-script file in your favourite editor ( I use notepad++ ) and modify it in the same way as the kernel.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
Leave the /dev/block/bootdevice/by-name/boot as it's the fundamental block and we can't replicate it. Don't think for the /cache partition as we've already done that in the boot.img file. Now navigate to the root of the folder where you extracted the External OS. Select all files, add them to a zip file using WinRAR. Name the file to newOS.zip. Open newOs.zip and originalExternalOS.zip with WinRAR and compare them if you find any change in the folder tree. They must and they should be exactly the same. You're 80% done.
PART 4: MODIFYING THE RECOVERY
We often flash many zips including very popular Xposed and other mods to our OS right? They also look for the /system partition. So what are we gonna do? Modifying each of them? Nah. Let's modify where they get which one the /system is. The recovery. Extract the img of the recovery you're using with the same bootimg.exe. Modify exactly the same things. I.e.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
/dev/block/bootdevice/by-name/cache => /dev/block/mmcblk1p4
in the following files : initrd/fstab.qcom
initrd/etc/recovery.fstab
initrd/etc/twrp.fstab(For TWRP only)
Save them. Repack. And you got your recovery-new.img and recovery-old.img. Put recovery-new.img and newOS.zip in the same folder. Now wake up, it's time for some action.
PART 5 : INSTALLING THE OS
Open cmd in the folder where newOS.zip resides. Reboot the devixe in fastboot mode. Type the following commands:
Code:
adb push newOS.zip external_sd
fastboot flash recovery recovery-new.img
fastboot boot recovery
Now your device should boot up in recovery mode. To check if everything has gone fine mount system using TWRP. Use twrp's built in file manager and navigate to system folder. It's empty? Yup. You've done a great job. Now flash the newOS.zip using TWRP and your device should boot up in the new OS. To cross check again remove the SD card and try to boot. If you're headed towards recovery or bootloop after that then it's a win. Put the SD card back again and watch the new OS to boot.
PART 6: SWITCHING BETWEEN THE TWO
Extract the boot.img from the "Internal OS" zip file and put it together with recovery-old.img. To check if your old system is untouched type the following commands in fastboot mode:
Code:
fastboot flash recovery recovery-old.img
fastboot flash boot boot.img
fastboot boot system
Your device should take you back to the old one. Surprised? Now let's make a switch between the two. There are two methods.
METHOD 1: USING FLASHIFY
Create two folders in your SD card. Put boot.img and recovery-old.img to one and boot-new.img and recovery-new.img to the other. To switch to the external OS, just flash boot-new.img as boot and recovery-new.img using flashify. Ignore reboot now dialog and reboot directly to the system. To go back, first install flashify in the new OS and flash boot.img and recovery-old.img. Easy right?
METHOD 2: USING ZIPS
I'm gonna tell you that tomorrow as I can write no more today.
More to come....
CREDITS:
justzzshadz from MIUI forum for this revolutionary concept. @iamsubhranil for adding TWRP, Flashify support and completely rewriting the tutorial.
I am a Windows user, and I was having quite the trouble unpacking and repacking system.new.dat files. I tried all sorts of Windows Chinese tools for the job, but no matter what I did, when I put the system.new.dat file and system.transfer.list file back into the flashable zip (even if I made no changes to the system.new.dat file... just unpacked and repacked), I would get an error flashing the file.
I finally got around this by installing Ubuntu 16.04 Xenial Xerus on VirtualBox. You can find a lot of tutorials online about how to do that. I am basing my instructions off of xpirt's tutorial on unpacking and repacking with the tools he provides. But it took me about 2 days to figure it out because I kept running into problems since some of the instructions made assumptions that the user knows how to use Linux. I am very new to Linux. I am not completely sure how to do *everything* from the command line, so if someone wants to add to my instructions to make it easier, please do so. But these are the things I did to figure it out.
So here are the noob-friendly Linux Ubuntu instructions on how to unpack and repack:
Section 1: Getting everything Ready
1. Download your flashable .zip rom. In my case, I downloaded cm-12.1-20150619-UNOFFICIAL-afyonltetmo.zip to my Ubuntu Desktop. You can download it to your Home Directory as well. Doesn't matter.
2. Download sdat2img. I downloaded mine to my Home Directory.
3. Download img2sdat. I also downloaded this to my Home Directory.
4. Extract all 3 zips, by right clicking on them and choosing 'Extract Here.' It will extract them into their own directories. The main directories that you need to pay attention to are /sdat2img-master/ and /img2sdat-master/
5. Download ext4fs either right into the sdat2img-master folder, or anywhere you want and then drag and drop it into the sdat2img-master folder.
6. Open Terminal, and install Python 2.7, if it's not already installed. Put
Code:
sudo apt-get install python-2.7 python-pip
Section 2: Beginning the Unpacking Process
*Note, you can copy and paste the codes; however, you can't use keyboard shortcuts in terminal. You have to right click and choose your option.
*Another note: Where you see "user" in the terminal commands, substitute it with your Linux username.
1. In your extracted folder from your flashable zip, right click on system.new.dat and system.transfer.list and choose 'cut.' Then paste them in the sdat2img-master folder.
2. Back in Terminal put
Code:
cd sdat2img-master
. That will get you into the right directory.
3. Now put
Code:
./sdat2img.py system.transfer.list system.new.dat system.img
. That will create your raw ext4 .img file.
4. You want to create an output directory for all the files that are in system.img. Put
Code:
mkdir output
5. Now you can mount system.img, and it will mount it into that output folder. Put
Code:
sudo mount -t ext4 -o loop system.img output/
6. You might have the problem that you don't have ownership of all the files (they have little "locks" on them). To gain ownership, put
Code:
sudo chown -R user:user /home/user/sdat2img-master/output
. If you still can't get read and write access, just try rebooting your Ubuntu virtual computer. That was the only thing that finally worked for me. You can start modifying stuff as you wish.
Section 3: Compress files back to a raw ext4 image
1. You are now going to need your file_contexts file from your original extract rom zip. COPY (not cut) and paste it into the sdat2img-master folder.
2. You are also going to need your 'make_ext4fs' file. Make sure it is in the sdat2img-master folder. You might have trouble with permissions, so just in case, put
Code:
chmod 777 /home/user/sdat2img-master/make_ext4fs
into terminal.
3. In Files (Ubuntu's "File Manager"), in the sdat2img-master folder, right click on your system.img file and go to 'Properties'. Notice the information in "Size." Ignore the GB, but look at the bytes. Mine is 2,411,724,800. Copy that number, but remove the commas. So mine is 2411724800.
4. Next is the actual compressing part. Put
Code:
./make_ext4fs -T 0 -S file_contexts -l 2411724800 -a system system_new.img output/
into terminal, but substitute '2411724800' with whatever size you got from the Properties in system.img. You will now how a new file called system_new.img.
Section 4: Converting ext4 (raw image) to img (sparse image)
1. Now you will need to install img2simg. In Terminal, put
Code:
sudo apt-get install android-tools-fsutils
2. Now you can put
Code:
img2simg system_new.img system_new_sparse.img
You will now have a file called system_new_sparse.img that is ready to be packed in a new dat file.
Section 5: Converting img (sparse image) to dat (sparse data)
1. Cut and paste your system_new_sparse.img into img2sdat-master folder that you made earlier.
2. Now you need to navigate to that folder in terminal. Put
Code:
cd /home/user/img2sdat-master
3. Now you can put
Code:
./img2sdat.py system_new_sparse.img
to create your new dat file. It will first ask you which Android version it's for. Enter the number corresponding and hit enter.
4. You're now pretty much done. As you'll see, it created 3 files: system.new.dat, system.patch.dat, and system.transfer.list. Just paste these files into your folder where your flashable zip files are, replacing any original ones in there. Make sure you also have your file_contexts file in there as well. Highlight all the files in there, right click, and zip them up. Then name your flashable zip whatever you want and try flashing!