[Q] creating fastboot flashable system.img - Xperia Z4/Z3+ Q&A, Help & Troubleshooting

I wish to modify the system image on my Xperia Z3+. I seem to be having trouble creating a fastboot flashable .img file that allows the phone to boot.
To test, I extracted the .ext4 file from the stock firmware system.sin that is currently installed on my Z3+ using FlashTool's SIN extractor. I mounted the resulting ext4 image using the loopback filesystem, following which I executed the command
Code:
make_ext4fs -s -l 5513412608 -a /system system.img system
The partition size is taken directly from the AOSP BoardConfig.mk for this device. I made no modifications to the filesystem - it's stock. It flashes successfully with fastboot using the same command that successfully flashes a AOSP built system.img
Code:
fastboot flash -s 256M system system.img
The system won't boot when fastboot flashing the converted SIN to IMG. There's something wrong with the way I'm creating the system.img file. It makes no difference if I add the SELinux file_contexts with the -T option and the file_contexts located in the system image.
Anyone have any pointers?

give some extra blocks
I modified the system image of 28.0.A.27 to include the newer stagefright libs from .251 and a su executable (unsucsessful: RIC and maybe SELinux).
I checked the image and added some - rounded up - extra blocks for my modifications (ls -l).
The device (Tablet Z4) booted but the media server did not come up and the booting did not finish. I could adb shell but had no touch GUI.
Maybe yours is another problem. If you can adb shell I would check the log.
And I did it this way (no /):
Code:
make_ext4fs -s -l 5big_number8 -a system system.img system

DHGE said:
I modified the system image of 28.0.A.27 to include the newer stagefright libs from .251 and a su executable (unsucsessful: RIC and maybe SELinux).
I checked the image and added some - rounded up - extra blocks for my modifications (ls -l).
The device (Tablet Z4) booted but the media server did not come up and the booting did not finish. I could adb shell but had no touch GUI.
Maybe yours is another problem. If you can adb shell I would check the log.
And I did it this way (no /):
Code:
make_ext4fs -s -l 5big_number8 -a system system.img system
Click to expand...
Click to collapse
I tried with and without the / but same problem. I can't get an adb shell as the device doesn't even start booting - it sticks on the Sony logo.

Related

[GUIDE] Making Dump Files Out of Android Device Partitions

Use:
The main purpose is to make a file that contains all data in android specific partition. This is really handy in case of dumping leak firmwares.
Pr-requirement:
- Rooted device.
- Knowledge of how to use adb or Terminal Emulator.
The first step of making dump files out of device partitions is to locate its mounting points..!!
So in our tutorial, we will make it in 2 sections. Section 1 for how to get mounting points, and section 2 for how to get partition dumped..
Keep in mind that this is xda-university; so my target is to show beginners how to do that manually, without the aid of any tool, so they can get the concept behind it.. OK let's begin..!!
Section 1:
Getting mounting points​There are several methods to achieve this, but we will discuss the easiest methods that give efficient information about the partition that you want to know its mounting point.
All these methods will be described using adb shell.
Way #1
Code:
adb shell
cat /proc/partitions
This one needs from you to figure out which block belong to which partition name.!!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Way #2
Code:
adb shell
ls -al /dev/block/platform/[B][COLOR="Blue"]dw_mmc[/COLOR][/B]/by-name
This one will give you info about the dev block names WITH their familiar names (i.e, boot, recovery, system... etc)
This command is not universal between devices, and you will need to gather its pieces (/dev/block/platform/dw_mmc/by-name).
How?
- In your device, use any explorer that can get you to the device root (personally I use ES Explorer, by pressing on "/" on navigation bar).
- Go to "/dev/block/platform/" folder
- Here you will see some files and folders, we need to open folders and search for the folder called "by-name" inside one of them; in my situation it was "dw_mmc" folder which has the folder "by-name" inside it.
- At the end, my targeted piece info will be (/dev/block/platform/dw_mmc/by-name)
- Now open adb shell and put that command..
Way #3
By pushing parted binary to /system/bin folder and run it (you can find it in attachment).
Code:
adb remount
adb shell "su" "" "mount -o remount,rw /system"
adb push parted /system/bin/parted
adb shell
chmod 0755 /system/bin/parted
parted /dev/block/[B][COLOR="Blue"]mmcblk0[/COLOR][/B]
print
Here, your mounting points will start with /dev/block/mmcblk0p* where (*) is the number shown in the table above for each partition.
example:
The hidden partition mounting point will be mmcblk0p10
The radio partition mounting point will be mmcblk0p7
The system partition mounting point will be mmcblk0p9
The recovery partition mounting point will be mmcblk0p6
and so on
Don't forget to "quit" the parted action after grasping your device mounting points.
N.B:
- You may need to run first:
Code:
adb shell
cat /proc/partitions
to know what is the initial name for your device partition.. In the example above, it was mmcblk0.
- Also to be able to do adb push to /system partition for parted binary, you will need insecure boot.img used in your ROM or adbd insecure installed in your device (Check this thread for that app), or just push parted binary manually by any root explorer and then fix permissions to rwxr-xr-x (755).
***​
Section 2:
Dumping ROM partition​After locating the mounting point of the partition you want to dump, open adb shell command prompt and type:
Code:
adb shell
su
dd if=[B][COLOR="Blue"]/yourMountingPoint[/COLOR][/B] of=[B][COLOR="Green"]/yourDestination[/COLOR][COLOR="Red"]/partitionType[/COLOR][/B]
Let's say I want to take a dump out of system partition from above example. So the adb commands will be:
Code:
adb shell
su
dd if=[B][COLOR="Blue"]/dev/block/mmcblk0p9[/COLOR][/B] of=[B][COLOR="Green"]/sdcard[/COLOR][COLOR="Red"]/system.img[/COLOR][/B]
This may take a while to complete the dumping process, depending on the size of your dumped partition; so be patient..
Note:
If the partition is formatted as ext3/4 then the dumped partition will have .img as an extension.
Other partition dumps have different extensions; examples:
radio.bin
param.lfs
Sbl.bin
zImage (without extension)
***​
Optional:
Read Partition Image​After dumping an image from android partition, you can mount it to extract a particular file for sharing, or the whole dump content in case the ROM chief wants to make a ROM out of dump files..
For Linux Users:
- Open terminal and type:
Code:
su -
mkdir -p /mnt/disk
mount -o loop [B][COLOR="Red"]yourImage.img[/COLOR][/B] /mnt/disk
cd /mnt/disk
ls -l
For Windows Users:
- Download LinuxReader from this site here.
- Open it -> Drives -> Mount Image -> Then choose your dumped image and hit Mount. A new driver will appear that contains all files inside the dumped image called "Linux native Volume 1". Just double click it to get inside the dumped image.
I hope you will find this tutorial beneficial,,,
Yours;
Actions Explanation
★ Tutorial Legends ★​
In this post, I will try to explain the use of each binary used in the tutorial, so you can make sense of each action taken.
#1
Code:
adb shell
Run remote shell interactively, as if you are in linux terminal.
Click to expand...
Click to collapse
#2
Code:
cat /proc/partitions
cat binary is used to concatenate file(s) and print them to standard output display. In our example, it prints the content of partitions file which is found in proc folder to screen display.
Click to expand...
Click to collapse
#3
Code:
ls -al /dev/block/platform/dw_mmc/by-name
ls binary is used to list directory contents.
-al is the used option for ls which means to include entries that started with "." in long listing format. There are a lot of options for ls binary. You can always print ls --h to display help menu for other options available.
Click to expand...
Click to collapse
#4
Code:
adb remount
Remounts the /system partition on the device read / write. This has been disabled in some devices (those with secure boot image); so you need to make sure that you have patched adbd that can run this command effectively.
Click to expand...
Click to collapse
#5
Code:
su
Used to get super-user privilege.
Click to expand...
Click to collapse
#6
Code:
mount -o remount,[B][COLOR="Red"]rw[/COLOR][/B] /system
Specific command to mount the /system partition on the device read / write (rw).
If you change rw to ro, you will get /system partition mounted as read only.
Click to expand...
Click to collapse
#7
Code:
adb push parted /system/bin/parted
adb push is used to copy file/dir from your local computer to android device. The usual format is adb push <local> <remote>
Click to expand...
Click to collapse
#8
Code:
chmod 0755 /system/bin/parted
chmod binary is used to set permissions for the specified file/dir.
The number after chmod is the permission used. See the next box for better understanding of chmod formatting:
Code:
[CENTER][B][COLOR="Red"]----------------
| CHMOD SCHEME |
----------------[/COLOR][/B][/CENTER]
[B] r w x[/B]
[B]4 2 1 [COLOR="Green"]= 7 (Full Permissions)[/COLOR][/B]
User ( ) ( ) ( ) [B][COLOR="Green"]--> 2nd digit[/COLOR][/B]
Group ( ) ( ) ( ) [B][COLOR="Green"]--> 3rd digit[/COLOR][/B]
Other ( ) ( ) ( ) [B][COLOR="Green"]--> 4th digit[/COLOR][/B]
Special UID GID STK
( ) ( ) ( ) [B][COLOR="Green"]--> 1st digit, ignored on most cases or put 0[/COLOR][/B]
In the above example, it is set to 0755 which means the following scheme:
Code:
[B] r w x[/B]
[B]4 2 1[/B]
User ([B][COLOR="Red"]*[/COLOR][/B]) ([B][COLOR="Red"]*[/COLOR][/B]) ([B][COLOR="Red"]*[/COLOR][/B]) [B][COLOR="Green"]--> This equals to 7 (rwx)[/COLOR][/B]
Group ([B][COLOR="Red"]*[/COLOR][/B]) ( ) ([B][COLOR="Red"]*[/COLOR][/B]) [B][COLOR="Green"]--> This equals to 5 (r-x)[/COLOR][/B]
Other ([B][COLOR="Red"]*[/COLOR][/B]) ( ) ([B][COLOR="Red"]*[/COLOR][/B]) [B][COLOR="Green"]--> This equals to 5 (r-x)[/COLOR][/B]
Special UID GID STK
( ) ( ) ( ) [B][COLOR="Green"]--> This equals to 0 (---)[/COLOR][/B]
As you can see, if you said 0755, it will be as same as saying ---rwxr-xr-x
Click to expand...
Click to collapse
#9
Code:
dd if=/dev/block/mmcblk0p9 of=/sdcard/system.img
dd binary is used to copy a file with converting and formatting.
if means input file; here we pointed to the whole partition, not specific file.
of means outputting file to specific destination path; here it is to sdcard with system.img name.
Click to expand...
Click to collapse
#10
Code:
mkdir -p /mnt/disk
mkdir binary is used to make folder dir.
-p is mkdir option which means to create folder with sub-folder at the same time. Here we want to create mnt folder that contains disk sub-folder in it. If the folder and or sub-folder(s) are already exists, it will not give error but nothing will be created.
Click to expand...
Click to collapse
#11
Code:
mount -o loop yourImage.img /mnt/disk
This is linux way to mount images into specific directory (/mnt/disk in this example).
Click to expand...
Click to collapse
#12
Code:
cd /mnt/disk
cd used to get inside specific dir path.
Click to expand...
Click to collapse
#13
Code:
ls -l
ls binary is used to list directory contents as described above.
-l is the used option for ls which means to list contents in long listing format.
Click to expand...
Click to collapse
Cheers
another way to get common names
on way #2, I've often used:
Code:
cat /proc/emmc
on a few devices to reveal similar info.
Rob
can i able to mount boot.img in android itself...actually i wanted to extract boot.img frm mobile without any tools or without the help of PC...if there be any possibilities..??
hasan4791 said:
can i able to mount boot.img in android itself...actually i wanted to extract boot.img frm mobile without any tools or without the help of PC...if there be any possibilities..??
Click to expand...
Click to collapse
if you mean extract to modify boot.img, then I don't think there is away to do that from device itself in the moment..
if you mean dumping boot.img then yes you can, just install terminal emulator from Google play and you can run adb shell commands directly from the device
Great guide hopefully makes it easier for us to get dumps! if you add logcats etc, i find they have trouble executing "adb logcat >> log.txt" -.-
also you should teach them the easy tar method, so while booted "tar -c /system/* >> /sdcard/system.tar" or via adb shell
ricky310711 said:
Great guide hopefully makes it easier for us to get dumps! if you add logcats etc, i find they have trouble executing "adb logcat >> log.txt" -.-
also you should teach them the easy tar method, so while booted "tar -c /system/* >> /sdcard/system.tar" or via adb shell
Click to expand...
Click to collapse
Yup that is possible and easy to extract but it is only for partitions that is shown in android os,,, you can't use it for boot.img, sbl.bin, modem.bin...etc right
majdinj said:
Yup that is possible and easy to extract but it is only for partitions that is shown in android os,,, you can't use it for boot.img, sbl.bin, modem.bin...etc right
Click to expand...
Click to collapse
ofcoarse, i actually had a project going where it detects all partitions(modems, boot.img, system etc..) that archives itself into a .zip
it was going well until i did something in the script, now it only works on the s3 it shall be continued one day!
Such great tutorial, this is definitely going to come in handy for me. I have a question, how can you dump (extract) a bootloader? Can i use the same method as dumping the ROM?
Could you explain how to extract stock recovery image please?
Sent from my HTC One using xda app-developers app
Where did the parted binary come from?
For Gods Sake
http://forum.xda-developers.com/sho...IDE] Unpack/repack ext4 Android system images
http://forum.xda-developers.com/sho... Creator (deployable over all kernel sources)
http://forum.xda-developers.com/sho...ipt]Backup all paritions on i9505 to odin rom
http://forum.xda-developers.com/sho...al 4.3 TW Custom Rom/ The ORIGINAL WIFI TRICK
... use Forum Search Engine first, then start asking all your 'important' questions
¤ GT-I9505 - powered by KitKat ¤
insink71 said:
on way #2, I've often used:
Code:
cat /proc/emmc
on a few devices to reveal similar info.
Rob
Click to expand...
Click to collapse
Thx for this. On my HTC One there is no "by-name" folder. It only has "by-num". cat /proc/emmc works fine though.
Cheers.
I also wrote a guide, It just using the "by-name"
and needs root
[HOWTO] dump your rom
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/storage/extSdCard/system.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=/storage/extSdCard/recovery.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/param of=/storage/extSdCard/param.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/storage/extSdCard/boot.img
Hi,
I tried this on my I-9505G. It is NOT rooted, so I thought I could enter the system through Clockworkmod Recovery.
I did it, but at first I didn't mount the DATA partition (later on I did through CWM Recovery); I still ran the command:
dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/data/media/TEST/system.img
Thought I hadn't mounted anything, the media folder was still there, I only created the TEST folder.
After the image was created I typed the "ls" command and the system.img file was in /data/media/TEST/.
I then rebooted once again in CWM and ran the "adb shell" command once again, I entered /data/media/ e neither the img file nor the TEST folder I had created were there.
My question is: where have they gone?? Are they still occupying some of my space or they just got deleted automatically when I rebooted??
Please let me know as I'd like to free that extra unuseful 1.2 Gb system.img file.
Anyway, just as side information, I later on mounted the /data through CWM interface and was able to see the folders ("/data/media/0/") I can see by plugging the phone normally to the computer. I then dumped the image.
I have some other questions:
I can I mount the /data folder (or the external SD) via command?
What extention should I give to the other partitions? (All of them)
Why did you say that it's MANDATORY that the phone be rooted if it can be done this way?
Are the images I'm dumping flashable through fastboot?
Thank you all for your time!
Anybody? Please.
•I can I mount the /data folder (or the external SD) via command?
I have not been able to find the SD card in clockwork on the I9505G, hence one of my rooting procedures send the root file vi "adb sideload".
I might be able to pull the data from the phone but the clockwork recovery is still not working 100% when fastbooting it.
•What extention should I give to the other partitions? (All of them)
.img are fine.
•Why did you say that it's MANDATORY that the phone be rooted if it can be done this way?
currently it is required that the phone be unlocked. Something need to be fixed in clockwork to make it work any other way.
•Are the images I'm dumping flashable through fastboot?
They should be, but I have not been able to flash anything on the I9505G vi fastboot because of the secure boot.
without a full official image this make my playing around a little concerning (slowing me down).
I will look into this at my leisure. I would love to be able to pull a rom off a phone with only unlocking it.
I will test some stuff using my old galaxy nexus.
I actually dumped everything WITHOUT being rooted. I only unlocked the bootloader... So it works.
Further, I tried to run "fastboot boot recovery.img" with recovery.img being the image file I dumped. The phone froze and I had to pull the battery... So I assume they're not flashable as well, though I'd like other feedbacks.
I've not clearly understood what "secure boot" means. Any guide or wiki?
Thanks!
---------- Post added at 06:56 PM ---------- Previous post was at 06:55 PM ----------
I actually dumped everything WITHOUT being rooted. I only unlocked the bootloader... So it works.
Further, I tried to run "fastboot boot recovery.img" with recovery.img being the image file I dumped. The phone froze and I had to pull the battery... So I assume they're not flashable as well, though I'd like other feedbacks.
I've not clearly understood what "secure boot" means. Any guide or wiki?
Thanks!
Hey, great guide! I need some help but. I can't retrieve the common names / labels of my devices partitions. It's a GT-i8150 and there is no 'by-name' sub directory. Furthermore, parted does not work on mmcblk0 for some reason (unable to satisfy partition restraints or something). I also have no emmc file in proc.
Does anyone know how some other methods for getting the names of the partitions?
EDIT:
Another question - using ADB shell, is it possible to dump a partition straight from the phone onto the computers hard drive? My little 2GB sd card isn't coping! Thanks
a very basic but good guide
Sent from my GT-P1000 using xda app-developers app

How to backup a partition

How to backup - let's say boot - partition to a fastboot flashable file (*.img) format?
For example:
Code:
dd if=/dev/block/platform/hi_mci.0/by-name/boot of=/sdcard/boot.img
and so on.
Kostyan_nsk said:
For example:
Code:
dd if=/dev/block/platform/hi_mci.0/by-name/boot of=/sdcard/boot.img
and so on.
Click to expand...
Click to collapse
Thanks. So fastboot is using dd images. Please do confirm.
Regards.
You can use only boot and recovery images extracted by dd for flashing via fastboot.
Kostyan_nsk said:
You can use only boot and recovery images extracted by dd for flashing via fastboot.
Click to expand...
Click to collapse
Thanks
Kostyan_nsk said:
For example:
Code:
dd if=/dev/block/platform/hi_mci.0/by-name/boot of=/sdcard/boot.img
and so on.
Click to expand...
Click to collapse
I have done the backup to the image file as you have suggested.
I have copied image file to the linux computer, but when I try to mount the image file I get:
mount -o loop boot_orig_B830.img /mnt/boot/
mount: /dev/loop0 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
What is the file system for this image?
Length of the image file is:
ls -l boot_orig_B830.img
-rw-rw-r-- 1 test test 16777216 Lis 13 22:04 boot_orig_B830.img
For Linux: google "unpackbootimg", "gunzip" and "cpio".
For Windows: google "AndImgTool".

[MOD] Increase your SYSTEM partition to 2.5GB , Boot to 30MB , Recovery to 30MB for Y

Do you want to increase partitions using tool.....? Then here is the link
Finally your and MY wait is over Hear @I Putu Tirta Agung S & @Annabathina are introducing that HOW TO INCREASE YUREKA / PLUS PARTITIONS ........
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I & @I Putu Tirta Agung S are not responsible for anything that may happen to your phone as a result of following this guide / installing custom roms and/or kernels. you do so at your own risk and take the responsibility upon yourself. ​​
NOTE : Please read hole thread before starting........
Preface
This guide has been tested to work on Lollipop and Marshmallow. By following this guide, you will resize your boot, system, cache, and recovery partition to the new partition size as can be seen below:
This guide is quite safe as it doesn't change the emmc GUID and its unique partitions GUID, which is hard coded into our Yureka's non-HLOS (High Level Operating System).
The Guides
Backing up important partitions ( Very very important )
Go to TWRP (please use the newest, or at minimal Abhishek's 3.0.1-0), and when you are in it run "adb shell" from your computer using " ADB+&+Fastboot of yureka " by " Hold shift key and right click on mouse and select Open command window here " then type below lines ONE BY ONE (remember to do it line by line)
Code:
[SIZE="4"]dd if=/dev/block/mmcblk0 of=/sdcard/gpt.bin bs=512 count=34
adb shell dd if=/dev/block/mmcblk0p1 of=/sdcard/modem
adb shell dd if=/dev/block/mmcblk0p2 of=/sdcard/sbl1
adb shell dd if=/dev/block/mmcblk0p3 of=/sdcard/sbl1bak
adb shell dd if=/dev/block/mmcblk0p4 of=/sdcard/aboot
adb shell dd if=/dev/block/mmcblk0p5 of=/sdcard/abootbak
adb shell dd if=/dev/block/mmcblk0p6 of=/sdcard/rpm
adb shell dd if=/dev/block/mmcblk0p7 of=/sdcard/rpmbak
adb shell dd if=/dev/block/mmcblk0p8 of=/sdcard/tz
adb shell dd if=/dev/block/mmcblk0p9 of=/sdcard/tzbak
adb shell dd if=/dev/block/mmcblk0p10 of=/sdcard/hyp
adb shell dd if=/dev/block/mmcblk0p11 of=/sdcard/hypbak
adb shell dd if=/dev/block/mmcblk0p12 of=/sdcard/pad
adb shell dd if=/dev/block/mmcblk0p13 of=/sdcard/modemst1
adb shell dd if=/dev/block/mmcblk0p14 of=/sdcard/modemst2
adb shell dd if=/dev/block/mmcblk0p15 of=/sdcard/misc
adb shell dd if=/dev/block/mmcblk0p16 of=/sdcard/fsc
adb shell dd if=/dev/block/mmcblk0p17 of=/sdcard/ssd
adb shell dd if=/dev/block/mmcblk0p18 of=/sdcard/DDR
adb shell dd if=/dev/block/mmcblk0p19 of=/sdcard/fsg
adb shell dd if=/dev/block/mmcblk0p20 of=/sdcard/sec
adb shell dd if=/dev/block/mmcblk0p22 of=/sdcard/params
adb shell dd if=/dev/block/mmcblk0p23 of=/sdcard/panic
adb shell dd if=/dev/block/mmcblk0p24 of=/sdcard/autobak
adb shell dd if=/dev/block/mmcblk0p26 of=/sdcard/persist[/SIZE]
Copy all files from internal storage (sdcard) to your computer, keep them safe as they are very important if something bad happens.
Doing the magic
Download and extract "gpt.zip" attached in this post, and copy the "gpt.bin" file to the root of your internal storage (internal sdcard).
1. Go back to TWRP and run "adb shell" again from your computer, then type:
2. Go back to TWRP and run "adb shell" again from your computer, then type:
dd if=/sdcard/gpt.bin of=/dev/block/mmcblk0 bs=512 count=34
Click to expand...
Click to collapse
3. After all done, reboot to your bootloader and flash your recovery (TWRP) by typing:
fastboot -i 0x1ebf erase recovery
fastboot -i 0x1ebf flash recovery TheNameofYourRecovery.img
Click to expand...
Click to collapse
4. After that, type below commands (remember to do it line by line):
fastboot -i 0x1ebf oem unlock
fastboot -i 0x1ebf erase boot
fastboot -i 0x1ebf format cache
fastboot -i 0x1ebf format userdata
fastboot -i 0x1ebf format system
fastboot -i 0x1ebf reboot-bootloader
fastboot -i 0x1ebf boot recovery
Click to expand...
Click to collapse
5. After booting to TWRP, wipe everything again (system, data, cache, dalvik, internal storage)
6. Reboot the phone to TWRP again.
7. Copy your original "params", "panic", "autobak", and "persist" files you backed up earlier to the root of your internal storage (internal sdcard) and run "adb shell" again from your computer, then type:
adb shell dd if=/sdcard/params of=/dev/block/mmcblk0p22
adb shell dd if=/sdcard/panic of=/dev/block/mmcblk0p23
adb shell dd if=/sdcard/autobak of=/dev/block/mmcblk0p24
adb shell dd if=/sdcard/persist of=/dev/block/mmcblk0p26
Click to expand...
Click to collapse
This step is very important, so don't miss it or you will hard bricked your god damn phone.
8. After all done, reboot to your bootloader and type again below codes (remember to do it line by line):
fastboot -i 0x1ebf oem unlock
fastboot -i 0x1ebf erase boot
fastboot -i 0x1ebf format cache
fastboot -i 0x1ebf format userdata
fastboot -i 0x1ebf format system
fastboot -i 0x1ebf reboot-bootloader
fastboot -i 0x1ebf boot recovery
Click to expand...
Click to collapse
After booting to TWRP, wipe everything again (system, data, cache, dalvik, internal storage)
9. Reboot the phone to TWRP again.
Troubleshooting
Wallah, now you have 2.5 GB of system partition, 150 MB (it will be usefull if you use f2fs file system) cache partition, 30 MB of recovery partition, 30 MB of boot partition, and around 11.77 GB of data partition.
Oh btw, if you flash "userdata.img" from COS or CM roms, you will get something similar to this:
target reported max download size of 268435456 bytes
erasing 'userdata'...
OKAY [ 8.440s]
sending 'userdata' (137434 KB)...
OKAY [ 5.164s]
writing 'userdata'...
FAILED (remote: image size too large)
finished. total time: 13.634s
Click to expand...
Click to collapse
Why? Because now your data partition is approximately 1.5 GB smaller. So just relax, if you got that kind of warning.
Furthermore, because a lot of devs use that ****in ".dat" files ****ty thing ("system.new.dat", "system.patch.dat" and "system.transfer.list"), if you flash their roms (such as CM, AICP, Exodus, bla bla bla), you will see that your partition will go back to its original value. But not to worry, it is not the real value of what is really use. It is because of the nature on how sparse ext4 image is compiled, they need to set the partition size before compiling, and of course they use the old one, not the one we have changed.
So to overcome this problem, you need to do it the hard way, explained in the second post below. However, if you don't want the hazzle then just flash AOSParadox or YuOS (the TWRP version, not the fastboot one) or Mokee or any rom that doen't have "system.new.dat", "system.patch.dat" and "system.transfer.list" in its zip file, as they will read the new partition size just fine.
ADB+&+Fastboot : link
Partition changer : link
Back up code PNG : link
Device Driver installation links
ADB for pc : link
YU usb drivers : link
PdaNet drivers : link
@I Putu Tirta Agung S MY friend for every thing ( NOTE : YOUR the best HACKER that I ever met )
@Annabathina
If you want the hard way in changing ROMs with ****in ".dat" files ****ty thing ("system.new.dat", "system.patch.dat" and "system.transfer.list") to read the new partition size, then you need Ubuntu with the latest kernel (that has the latest patch on "Transparent Compression", see this post), and follow these steps (thanks to xpirt for his guide):
Step 1 - Decompressing = DAT (sparse data) -> EXT4 (raw image)
We're now using sdat2img binary, the usage is very simple (make sure you have python 3.x installed):
Code:
./sdat2img.py <transfer_list> <system_new_file> <system_ext4>- <transfer_list> = input, system.transfer.list from rom zip
<system_new_file> = input, system.new.dat from rom zip
<system_ext4> = output ext4 raw image file
and a quick example of usage:
Code:
./sdat2img.py system.transfer.list system.new.dat system.img
by running this command you will get as output the file my_new_system.img which is the raw ext4 image.
Step 2 - Decompress EXT4 (raw image) -> OUTPUT folder -> Compress EXT4 (raw image)
Now we need to mount or ext4 raw image into an output folder so we can see apks/jars etc. To do this we need to type this command:
Code:
sudo mount -t ext4 -o loop system.img output/
As you can see there is a new folder called output which we can edit/modify/delete your files (not able to? see here)
Now we need to compress it back to a raw ext4 image, to do this we need the make_ext4fs binary. Make sure you have the file_contexts file (taken from the Rom zip) inside the make_ext4fs path. Then type this (got issues? see here).
Code:
/make_ext4fs -T 0 -S file_contexts -l 2684354560 -a system system_new.img output/
The value of 2684354560 in above code is the new size of system partition in Bytes. Upon doing the above processes, you will get the new raw ext4 image called 'system_new.img' ready for the next step.
Step 3 - Converting = EXT4 (raw image) -> DAT (sparse data)
Now we need the rimg2sdat binary, the usage is very simple:
Code:
./rimg2sdat <system_img>
<system_img> = name of input ext4 raw image file
and a quick example of usage:
Code:
./rimg2sdat my_new_system.img
As you can see the output is composed by system.transfer.list, (system.patch.dat) & system.new.dat, ready to be replaced inside your Rom zip.
Just to make it really simple
1. Fire up your beloved ubuntu, make sure you have python 3.x installed.
2. Download "sdat2img.py", "make_ext4fs", and "rimg2sdat" binaries, and put it inside a folder (use a file manager for god sake). We can name the folder "****inGreat".
3. Now make an empty folder inside "****inGreat" folder, and name it "output".
4. Extract "system.new.dat", "system.patch.dat", "system.transfer.list", and "file_contexts" from your beloved rom's zip file, and put it inside "****inGreat" folder.
5. Now open "****inGreat" folder with root privilege, then open terminal (we call it cmd in windows) from there.
6. type below code on the terminal (one line at a time):
Code:
./sdat2img.py system.transfer.list system.new.dat system.img (press enter)
sudo mount -t ext4 -o loop system.img output/ (press enter)
/make_ext4fs -T 0 -S file_contexts -l 2684354560 -a system system_new.img output/ (press enter)
./rimg2sdat my_new_system.img (press enter)
7. Now copy the new "system.new.dat", "system.patch.dat", "system.transfer.list", and "file_contexts" inside "****inGreat" folder back to your beloved rom's zip file.
8. Flash the rom via TWRP
9. And you are good to go.
10. Ain't that simple!!!!!!!!!!!!!
sdat2img.py
- github.com
make_ext4fs
- mega.co.nz
rimg2sdat
- mega.co.nz
reserved for SS
@I Putu Tirta Agung S MY friend for every thing ( NOTE : YOUR the best HACKER that I ever met )
 @Annabathina
reserved
where is
gpt.zip
i cannot found
@ Annabathina I want to use yureka full default partitions on yureka plus version p3 which is pure locked bootloader andoroid 5.1 version. i need your help.
For all adb shell commands I am getting not found
should i proceed further?
Device Yu Yureka (Lineage os 14.1) @Annabathina
luck_y said:
For all adb shell commands I am getting not found
should i proceed further?
Device Yu Yureka (Lineage os 14.1) @Annabathina
Click to expand...
Click to collapse
This is due to your ADB drivers check weather your PC has successfully installed ADB or not
Successfully increased system partition. But as prescribed this mod is supported to LP and MM ROMs only. Is there any way to support this to OREO. And also prescribe a method for restoring stock partitions.
how to go to default partition
please help i am installing nitrogen os and you hard way is not easily understandable
please provide gpt for default partition
please sir atleast provide default gpt so that i can manage myself
yashgogia007 said:
please help i am installing nitrogen os and you hard way is not easily understandable
Click to expand...
Click to collapse
Follow this
http://forums.yuplaygod.com/index.php?threads/50913/
Sent from my AO5510 using Tapatalk
original gpt.bin
Can anyone post the original gpt.bin, which you back up in 1st step...?
Wolverine00796 said:
Can anyone post the original gpt.bin, which you back up in 1st step...?
Click to expand...
Click to collapse
Here you go.
hi kindly request you that after increase partation my phone stuck at boot logo showing some chinese language boot i tried every thing just manage to get stock rom but still my phone stuck in cyanogen mood please help me my phone no is this +91-9829009627 i have no other phone.
E:Unable to mount '/persist' please help me to get back my yureka AO5510 working

Odin: FAIL! (Auth)

I have a `system.img.ext4.lz4` file that is compatible with my Samsung S10 5G(Qualcomm) device. I have extracted `system.img.ext4` file from the `system.img.ext4.lz4` using `unlz4 system.img.ext4.lz4` command.
I want to play with its content. So I have decided it in two steps:
1. Flash `system.img.ext4` without modification:
- Using `tar -cvf AP.tar system.img.ext4` command, I have created a AP.tar file.
- Flashed `AP.tar` file using Odin3 v3.13.
- It flashed successfully.
2. Flash `system.img.ext4` with modification:
a) Modifying
- With `simg2img system.img.ext4 system.img`, you will get a raw image file named `system.img`
- With `mkdir system`, create directory to mount system.img
- With `sudo mount -t ext4 -o loop system.img system/` you will get all files of `system.img` in `system` folder
- With `ls -l system/init.rc` note permissions: 750
- With `sudo chmod 777 system/init.rc` give write permissions
- With `sudo echo "#MODIFICATION " >> system/init.rc` done some modification in `init.rc`
- With `sudo chmod 750 init.rc` reset `init.rc` to the noted permissions
b) Calculate system sector size
- With `tune2fs -l system.img | grep "Block size\|Block count"` you will get block size and count
- With `echo $((1553064 * 4096))` multiply both results. I got 6361350144
c) Packing
- With `sudo make_ext4fs -s -l 6361350144 -a system system_new.img sys/` you will get `system_new.img` “Android Sparse Image” that has all changes
- With `sudo umount system` unmount the system directory
- With `rm -fr system` delete the system directory
d) Tar Compression
- With `rm system.img.ext4` remove original system.img.ext4, Don’t worry you should have a backup of it in lz4 file
- With `mv system_new.img system.img.ext4` rename system_new.img to system.img.ext4 for flashing with Odin3 v3.13
- With `tar -cvf AP.tar system.img.ext4` you will get AP.tar that you can flash with Odin3 v3.13.
- It failed to flash with FAIL! (Auth) error.
Please suggest how can I resolve this issue?
I will be very thankful to you for any little to big suggestion.:angel:
Vats12 said:
I have a `system.img.ext4.lz4` file that is compatible with my Samsung S10 5G(Qualcomm) device. I have extracted `system.img.ext4` file from the `system.img.ext4.lz4` using `unlz4 system.img.ext4.lz4` command.
I want to play with its content. So I have decided it in two steps:
1. Flash `system.img.ext4` without modification:
- Using `tar -cvf AP.tar system.img.ext4` command, I have created a AP.tar file.
- Flashed `AP.tar` file using Odin3 v3.13.
- It flashed successfully.
2. Flash `system.img.ext4` with modification:
a) Modifying
- With `simg2img system.img.ext4 system.img`, you will get a raw image file named `system.img`
- With `mkdir system`, create directory to mount system.img
- With `sudo mount -t ext4 -o loop system.img system/` you will get all files of `system.img` in `system` folder
- With `ls -l system/init.rc` note permissions: 750
- With `sudo chmod 777 system/init.rc` give write permissions
- With `sudo echo "#MODIFICATION " >> system/init.rc` done some modification in `init.rc`
- With `sudo chmod 750 init.rc` reset `init.rc` to the noted permissions
b) Calculate system sector size
- With `tune2fs -l system.img | grep "Block size\|Block count"` you will get block size and count
- With `echo $((1553064 * 4096))` multiply both results. I got 6361350144
c) Packing
- With `sudo make_ext4fs -s -l 6361350144 -a system system_new.img sys/` you will get `system_new.img` “Android Sparse Image” that has all changes
- With `sudo umount system` unmount the system directory
- With `rm -fr system` delete the system directory
d) Tar Compression
- With `rm system.img.ext4` remove original system.img.ext4, Don’t worry you should have a backup of it in lz4 file
- With `mv system_new.img system.img.ext4` rename system_new.img to system.img.ext4 for flashing with Odin3 v3.13
- With `tar -cvf AP.tar system.img.ext4` you will get AP.tar that you can flash with Odin3 v3.13.
- It failed to flash with FAIL! (Auth) error.
Please suggest how can I resolve this issue?
I will be very thankful to you for any little to big suggestion.:angel:
Click to expand...
Click to collapse
you need to unlock your bl and/or flash in twrp.
if you are trying this on a locked bl it will not work since when u modify the system partition you break the sig and hashes etc etc
elliwigy said:
you need to unlock your bl and/or flash in twrp.
if you are trying this on a locked bl it will not work since when u modify the system partition you break the sig and hashes etc etc
Click to expand...
Click to collapse
The bootloader is already unlocked and after that I am getting this issue. Twrp is not available for this model of Samsung S10.
hi, what next about this problem?
i have same issue
Vats12 said:
The bootloader is already unlocked and after that I am getting this issue. Twrp is not available for this model of Samsung S10.
Click to expand...
Click to collapse

How To Guide Some hints using TWRP

This HowTo contains some hints for using TWRP in general and some tips for using CLI commands in TWRP.
I will update this post in case I find something new & useful regarding TWRP and update the history section at the end of this post.
The test environment for the instructions below was
TWRP 3.6.2.12 for the ASUS Zenfone 8
TWRP 3.7.0_12-0 for the ASUS Zenfone 8
Note:
This is NOT a general HowTo for TWRP.
How to test a TWRP image?
It's recommended to boot from the TWRP image file before installing it into the boot or recovery partition of your phone. To do this do
Bash:
# connect the phone via USB to your PC
# boot the phone into the bootloader - e.g. via
#
adb reboot bootloader
# boot the phone from the TWRP image (this will not change anything on the phone)
#
sudo fastboot boot <twrpimage_file>
If everything works you can install the TWRP image into the boot or recovery partition using the approbiate menu entry in TWRP.
How to connect via adb to an TWRP session?
TWRP supports adb session as user root, therefor an
Bash:
adb shell
on your PC is sufficient to open an adb shell as user root on the phone booted into TWRP.
In case you get a permission denied error kill the running adb daemon on the PC and restart the adb command. If that does not fix the error disconnect and reconnect the USB cable between the PC and the Phone.
Be aware that TWRP starts the adb daemon twice after booting. Therefor an adb session to the phone started to early after the boot into TWRP might be killed. In this case just open a new adb shell.
How to check if the phone is booted into TWRP ?
Check the value of the property ro.twrp.boot; this property is only set if TWRP is running
e.g:
Code:
ASUS_I006D:/ # getprop ro.twrp.boot
1
ASUS_I006D:/ #
How to check if the running TWRP was booted from an TWRP image or from a boot or recovery partition?
Check the value of the property ro.bootmode; the value of this property is "unknown" if TWRP was booted from an image file via "fastboot boot <twrp_image_file>", e.g.
Code:
ASUS_I006D:/ # getprop ro.bootmode
unknown
ASUS_I006D:/ #
-> TWRP was booted from an TWRP image file
Code:
ASUS_I006D:/ # getprop ro.bootmode
recovery
ASUS_I006D:/ #
-> TWRP was booted from the boot or recovery partition
How to get the version of the running TWRP?
Check the value of the property getprop ro.twrp.version, e.g.:
Code:
ASUS_I006D:/ # getprop ro.twrp.version
3.7.0_12-0
ASUS_I006D:/ #
Where is the log file from TWRP?
The logfile with the messages written while booting TWRP is /data/recovery/log.gz.
e.g.
Code:
130|ASUS_I006D:/ # ls -ltr /data/recovery/l*gz
-rw------- 1 system system 8022 2022-12-26 14:03 /data/recovery/log.gz
ASUS_I006D:/ #
ASUS_I006D:/ # gzip -cd /data/recovery/log.gz | head -10
Starting TWRP 3.7.0_12-0-d07fdb3c on Sat Jan 10 00:53:15 1970
(pid 403)
I:Lun file '/config/usb_gadget/g1/functions/mass_storage.0/lun.0/file'
PRODUCT_USE_DYNAMIC_PARTITIONS := true
TW_INCLUDE_CRYPTO := true
I:TW_BRIGHTNESS_PATH := /proc/lcd_brightness
I:Found brightness file at '/proc/lcd_brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 420
I:TW_EXCLUDE_ENCRYPTED_BACKUPS := true
I:LANG: en
ASUS_I006D:/ #
The current logfile of the running TWRP is /tmp/recovery.log, e.g.:
Code:
ASUS_I006D:/ # ls -l /tmp/recovery.log
-rw-rw-rw- 1 root root 43303 2023-05-19 20:11 /tmp/recovery.log
ASUS_I006D:/ #
Where are the settings from TWRP stored?
The settings from TWRP are stored in the file
/data/media/0/TWRP/.twrps
This is a binary file.
Note that on phones with active encryption that file is only accessible after /data is decrypted.
How to edit a file while booted into TWRP?
The editor nano is part of TWRP and can be used to edit files in an adb session.
How to mount a partition while inside TWRP?
Use
twrp mount <mountpoint>
to mount a partition while TWRP is running.
Note that you should use this command with caution in adb sessions because the adb session may be killed after the mount
How to decrypt an encrypted /data partition
Use
twrp decrypt <password>
to decrypt an encrypted /data partition, e.g.
Code:
ASUS_I006D:/ # ls /data/media/0
+lnodCAAAAAnYFLObBoWS5ZNb5yVMpze 8KdHMCAAAAQOgtDHq,XdSfFPW+XURA2M KlfTJCAAAAwL93jkH2ugnU4eUG3Zzm7M W9W9SCAAAAgh6lwoP0mNiEK9VIWJoH6L
0nUvhAAAAAQ9ptz+L5qPQrpzcAt4G06K DWk4KDAAAAA,B1xVDmT3dZI87g2C0IS8 M6jcmCAAAAAU,4gn9o0zoBZmkysyXy49 bE7t0CAAAAQ2YuHL9styNaf,iSf2cCO,
4nFjMBAAAAwv2oUczXEpKUDfRIOi+nR5 EcHrdAAAAAglBtbhNWl0NvyX8aW+3CHN O5ZVrDAAAAAlKd7PPpo7CaQmkFbZzKRm haPcnBAAAAw9o2lLF97zpPTaC+byP92s
5yL8gCAAAAgekBDBUi4,W78rJAkgFcMF FA1aZAAAAAg2XNF+M859lpPY,3rUC2cY Vda+LCAAAAwR+g6Tav35+h,Epc8latGR mSKc8BAAAAwm+12sMClHPf+zwtHAeW+Q
8CsF+DAAAAwI3tImfOqIS9aHCQ3S7Cdg JpuFgAAAAAwdEzuQerx4681dzGLjlK3X VvEV4DAAAAgRgoqCfrypNqryZxRACnfr rMJEjAAAAAgwTgx,vA5ewWMVizc2LAos
ASUS_I006D:/ #
ASUS_I006D:/ # twrp decrypt 12345
Attempting to decrypt data partition or user data via command line.
Attempting to decrypt FBE for user 0...
User 0 Decrypted Successfully
Data successfully decrypted
Updating partition details...
...done
ASUS_I006D:/ #
ASUS_I006D:/ # ls /data/media/0
Alarms Android Audiobooks DCIM Documents Download Movies Music Notifications Pictures Podcasts Recordings Ringtones TWRP
ASUS_I006D:/ #
see the TWRP Commandline Guide for the known parameter for this command
Note that existing adb sessions will be stopped after sucessfully executing this command.
How to check if the data partition is encrypted from within a booted TWRP
To check if the data partition is encrypted in a script executed in a running TWRP use code like this:
Spoiler: # check if the data partition is encrypted
Bash:
PASSWORD="1234"
CRYPTO_READY=$( getprop crypto.ready )
TWRP_DECRYPT_DONE=$( getprop twrp.decrypt.done )
if [ "${TWRP_DECRYPT_DONE}"x = "true"x ] ; then
echo "The data partition is not encrypted or already decrypted"
elif [ "${CRYPTO_READY}"x = "1"x ] ; then
echo "The data partition is encrypted"
# sample commands to decrypt the data partition
#
# echo "Decryptiong the data partition now ..."
# twrp decrypt "${PASSWORD}"
elif [ "${CRYPTO_READY}"x = "0"x ] ; then
echo "The data partition is not encrypted"
else
echo "ERROR: The value of the property crypto.ready \"${CRYPTO_READY}\" is not known"
fi
How to install a ZIP file via cli command from within a running TWRP?
Copy the zip file to the phone via adb push and then use
twrp install /path/to/update.zip
to install a ZIP file from within TWRP
Note that the parameter must be a fully qualified filename.
Using this method to update the OS only works in a terminal session on the phone; it does not work in a adb session (at least in my tests until now ...)
What commands are available in TWRP?
Most of the Unix commands are available in TWRP
Be aware that a lot of Unix commands in TWRP are implemented using a general binary called toybox (toybox is something like busybox) and do not support all parameter like the original Linux commands
Code:
ASUS_I006D:/ # ls -l /bin/ | wc -l
261
ASUS_I006D:/ # ls -l /bin/ | grep toybox | wc -l
175
ASUS_I006D:/ #
What other TRWP specific commands can be used while in a running TWRP?
Spoiler: The twrp command
Code:
ASUS_I006D:/ # twrp
TWRP openrecoveryscript command line tool, TWRP version 3.7.0_12-0
Allows command line usage of TWRP via openrecoveryscript commands.
Some common commands include:
install /path/to/update.zip
backup <SDCRBAEM> [backupname]
restore <SDCRBAEM> [backupname]
wipe <partition name>
format data
sideload
set <variable> [value]
decrypt <password> [USER ID]
remountrw
fixperms
mount <path>
unmount <path>
listmounts
print <value>
mkdir <directory>
reboot [recovery|poweroff|bootloader|download|edl]
See more documentation at https://twrp.me/faq/openrecoveryscript.html
ASUS_I006D:/ #
See more documentation at https://twrp.me/faq/openrecoveryscript.html
https://twrp.me/faq/openrecoveryscript.html
and a few others like bootctl (see below) or magiskboot (see below).
How to change the active slot for the next reboot while in TWRP?
Use bootctl, e.g.
Code:
ASUS_I006D:/ # bootctl get-current-slot
1
ASUS_I006D:/ # bootctl set-active-boot-slot 0
The usage for the command bootctl is
Spoiler: bootctl usage
Code:
ASUS_I006D:/ # /bin/bootctl
/bin/bootctl - command-line wrapper for the boot HAL.
Usage:
/bin/bootctl COMMAND
Commands:
hal-info - Show info about boot_control HAL used.
get-number-slots - Prints number of slots.
get-current-slot - Prints currently running SLOT.
mark-boot-successful - Mark current slot as GOOD.
get-active-boot-slot - Prints the SLOT to load on next boot.
set-active-boot-slot SLOT - On next boot, load and execute SLOT.
set-slot-as-unbootable SLOT - Mark SLOT as invalid.
is-slot-bootable SLOT - Returns 0 only if SLOT is bootable.
is-slot-marked-successful SLOT - Returns 0 only if SLOT is marked GOOD.
get-suffix SLOT - Prints suffix for SLOT.
set-snapshot-merge-status STAT - Sets whether a snapshot-merge of any dynamic
partition is in progress. Valid STAT values
are: none, unknown, snapshotted, merging,
or cancelled.
get-snapshot-merge-status - Prints the current snapshot-merge status.
SLOT parameter is the zero-based slot-number.
ASUS_I006D:/ #
see also How to switch the active slot
How to use Magisk binaries while booted into TWRP
Magisk is another great tool for Android phones -- for details about Magisk see here:
https://github.com/topjohnwu/Magisk
The Magisk binary for manipulating the boot partition, magiskboot, is already part of TWRP. This binary can be used to unpack and repack boot partition (or boot partition images), ramdisks, or compress/decompress files. The binary works without problems while booted into TWRP.
Spoiler: magiskboot usage
Code:
1|ASUS_I006D:/ # magiskboot
MagiskBoot - Boot Image Modification Tool
Usage: magiskboot <action> [args...]
Supported actions:
unpack [-n] [-h] <bootimg>
Unpack <bootimg> to, if available, kernel, kernel_dtb, ramdisk.cpio,
second, dtb, extra, and recovery_dtbo into current directory.
If '-n' is provided, it will not attempt to decompress kernel or
ramdisk.cpio from their original formats.
If '-h' is provided, it will dump header info to 'header',
which will be parsed when repacking.
Return values:
0:valid 1:error 2:chromeos
repack [-n] <origbootimg> [outbootimg]
Repack boot image components from current directory
to [outbootimg], or new-boot.img if not specified.
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
otherwise it will compress ramdisk.cpio and kernel with the same format
as in <origbootimg> if the file provided is not already compressed.
If env variable PATCHVBMETAFLAG is set to true, all disable flags will
be set in the vbmeta header.
hexpatch <file> <hexpattern1> <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
cpio <incpio> [commands...]
Do cpio commands to <incpio> (modifications are done in-place)
Each command is a single argument, add quotes for each command
Supported commands:
exists ENTRY
Return 0 if ENTRY exists, else return 1
rm [-r] ENTRY
Remove ENTRY, specify [-r] to remove recursively
mkdir MODE ENTRY
Create directory ENTRY in permissions MODE
ln TARGET ENTRY
Create a symlink to TARGET with the name ENTRY
mv SOURCE DEST
Move SOURCE to DEST
add MODE ENTRY INFILE
Add INFILE as ENTRY in permissions MODE; replaces ENTRY if exists
extract [ENTRY OUT]
Extract ENTRY to OUT, or extract all entries to current directory
test
Test the current cpio's status
Return value is 0 or bitwise or-ed of following values:
0x1:Magisk 0x2:unsupported 0x4:Sony
patch
Apply ramdisk patches
Configure with env variables: KEEPVERITY KEEPFORCEENCRYPT
backup ORIG
Create ramdisk backups from ORIG
restore
Restore ramdisk from ramdisk backup stored within incpio
sha1
Print stock boot SHA1 if previously backed up in ramdisk
dtb <input> <action> [args...]
Do dtb related actions to <input>
Supported actions:
print [-f]
Print all contents of dtb for debugging
Specify [-f] to only print fstab nodes
patch
Search for fstab and remove verity/avb
Modifications are done directly to the file in-place
Configure with env variables: KEEPVERITY
split <input>
Split image.*-dtb into kernel + kernel_dtb
sha1 <file>
Print the SHA1 checksum for <file>
cleanup
Cleanup the current working directory
compress[=format] <infile> [outfile]
Compress <infile> with [format] (default: gzip), optionally to [outfile]
<infile>/[outfile] can be '-' to be STDIN/STDOUT
Supported formats: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg
decompress <infile> [outfile]
Detect format and decompress <infile>, optionally to [outfile]
<infile>/[outfile] can be '-' to be STDIN/STDOUT
Supported formats: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg
1|ASUS_I006D:/ #
If Magisk is installed in the Android OS on the phone and the booted TWRP is able to mount the volume for /data the Magisk binary magisk can also be used in an session in TWRP.
For details see the section Using the magisk binary while the phone is booted into TWRP in the post Some hints for using Magisk on Android phones
How to install TWRP into the boot partition using CLI commands from within a booted TWRP?
Use the script
install_twrp_from_within_twrp.sh
Download from here: http://bnsmb.de/files/public/Android/install_twrp_from_within_twrp.sh
How to install TWRP after an OS Upgrade from within the running Android OS?
see How to Install TWRP into the boot partition again after the installation of an OS update
How to add additional files to an existing TWRP image?
see How to add additional files to an TWRP image
How to install TWRP into the boot partition via script?
see How to install TWRP via script
How to build a TWRP image?
seee How to compile TWRP for the ASUS Zenfone 8
How to install an OS image using the twrp command in a script
see How to install an OS image using the TWRP binary twrp?
How to use TWRP if LineageOS 20.x is installed
As of 26.06.2023 booting the phone from the TWRP recovery image using the command
sudo fastboot boot <twrp_image>
Does not work anymore if LineageOS 20.x is installed on the phone.
see How to use TWRP if LineageOS 20.x is installed for a workaroujnd
Spoiler: History / Change log of this entry
02.12.2022 /bs
initial release
17.12.2022 /bs
added infos about how to use the binary twrp to install an OS image
26.12.2022 /bs
added infos about the logile used by TWRP
23.04.2023 /bs
added info about how to decrypt the data partition
30.04.2023 /bs
added infos about the file used for the TWRP settings
19.05.2023 /bs
added infos about how to check if the data partition is encrypted
updated the infos about the log file used by TWRP
added infos about how to install TWRP from within a running Android OS
26.06.2023 /bs
added the infos about how to use TWRP with LineageOS 20.x

Categories

Resources