How To Guide Fast Method to Patch AP File. - Samsung Galaxy Tab S8

This method might be known. But just wanted to share it with you since it saves a lot of time.
Patched an AP file and updated my tablet in less than 5 minutes.
Requirements:
1.CPU with virtualization support.
1.Download ldplayer from ldplayer.net
2.Run Emulator and drag and drop the AP file into the file manager. # AP file will be located in pictures folder on Emulator device.
3. Run the browser on emulator and download and install latest Magisk apk.
4.Patch AP file with magisk. # Patched AP file will be located in Downloads folder on emulated device.
5.Copy or move magisk patched AP file back to pictures folder on emulator device.
6.On your pc go to 'C:\Users\PCNAME\Documents\XuanZhi9\Pictures' The patched AP file will be there.
7.Run Odin and update firmware.

Thx.
I do it with NoxPlayer emulator.

I mean, you could just download and patch the AP file on the device you're planning on flashing in Odin. Just move the patched file on the sd card, put that into the computer, and flash (if you have an sd card in your tablet, that is), or just connect the device to your pc, copy the patched file over, and flash. That cuts out the steps involving making an android vm, downloading and patching something in that instead of on the actual android device, and needing to move things to and search for directories to import things in and out of a vm.

SavXL said:
I mean, you could just download and patch the AP file on the device you're planning on flashing in Odin. Just move the patched file on the sd card, put that into the computer, and flash (if you have an sd card in your tablet, that is), or just connect the device to your pc, copy the patched file over, and flash. That cuts out the steps involving making an android vm, downloading and patching something in that instead of on the actual android device, and needing to move things to and search for directories to import things in and out of a vm.
Click to expand...
Click to collapse
What's weird is that Copying the AP file which is 8GB+ in size for the Tab S8 Ultra to a generic sd card or directly to the device via usb is actually slower than doing it over wifi6 via a file manager.
And then you will have to copy again the patched magisk ap file to your pc this takes time.

vangry2020 said:
What's weird is that Copying the AP file which is 8GB+ in size for the Tab S8 Ultra to a generic sd card or directly to the device via usb is actually slower than doing it over wifi6 via a file manager.
And then you will have to copy again the patched magisk ap file to your pc this takes time.
Click to expand...
Click to collapse
Agreed, it's slow as molasses, and it shouldn't be - and one time I accidentally wound up with a corrupted AP file which I flashed and had to flash all stock and factory reset to get working again. Now I check MD5 hashes on source and destination in both directions. I'm undecided if I'll go the emulator route at sometime in the future, but I'm considering it.

roirraW edor ehT said:
Agreed, it's slow as molasses, and it shouldn't be - and one time I accidentally wound up with a corrupted AP file which I flashed and had to flash all stock and factory reset to get working again. Now I check MD5 hashes on source and destination in both directions. I'm undecided if I'll go the emulator route at sometime in the future, but I'm considering it.
Click to expand...
Click to collapse
Tbh even emulator route sometimes end up not applying root maybe due to differences in architecture. But what i found reliable is transfering ap files over wifi using a file manager using smb.
I wish Samsung would add a/b partitions in future devices so we can update ota and apply root directly.

Related

[GUIDE] Unpack system.new.dat

I've been struggling with these system.new.dat block images since lollipop came out. I searched high and low for a way to mount that image outside of twrp with no luck. So I just used twrp instead... These are the steps I take:
Clean flash a lollipop rom that has a system.new.dat image in twrp.
Reboot system.
When device finishes booting use hardware power button to power down without messing with the rom itself yet so it stays fresh. (It's ok to confirm power down on touch screen.)
In twrp make a backup of only the system partition.
Boot back to system and use the method you prefer to move the file system.ext4.win from:
/TWRP/BACKUPS/-ur-device-serial/-ur-backup-date
to your pc and rename it system.tar so you can unpack it. (Of course make sure you have the proper decompression tools, which every OS usually does now.)
Now you have the complete fresh contents of /system as you would in a traditional rom zip. You can do with that as you please, or just throw it into a rom kitchen. :silly:
There is also another solution to allow you to unpack and repack the system.new.dat file. See the link below.
http://forum.xda-developers.com/and.../how-to-conver-lollipop-dat-files-to-t2978952
adomol said:
[*]Boot back to system and use the method you prefer to move the file system.ext4.win from:
/TWRP/BACKUPS/-ur-device-serial/-ur-backup-date
to your pc and rename it system.tar so you can unpack it.
Click to expand...
Click to collapse
Quite tricky but still The way.
Thanx!
Or there's the easy way if your PC is running Windows:
Use @Alexey71's SystemExtractor

twrp s10

Hi, I rooted my s10 with magisk but cannot flash twrp parched with odin because the file is .img and odin accepts file tar.
What do I Havel to do?
Guide to Extract Boot image file and flash via Odin Tool
First, download the preferred Samsung Stock ROM for your device model.
Extract the firmware zip file on your computer within a folder.
Now, the boot image file named as AP_xxx (similar kind of) file.
Recently, Samsung firmware files use a new compression type called .lz4 extension. You may see something like boot.img.lz4 file name.
Extract the boot.img.lz4 file via 7Zip to .tar extension and now you will see the boot.img.tar file. Download 7Zip - github (dot) com (slash) mcmilk (slash) 7-Zip-zstd (slash) releases
Now, open the Odin tool and connect your device to the PC via a USB cable.
Click on the ‘AP’ button and select the boot.img.tar file from your computer.
Click on the ‘Start’ button.
That’s it. Wait for flashing to complete and reboot your handset.
Hope this guide will be helpful to you. If you’re facing any issue, you can ask your queries in the comments below.

REQ: Unshrink data partition

Hello!
Not sure if this has happened, but I think my data partition has shrunk. My device (s10e) used to show 107 GB, now it shows ~ 15.7 GB. Is there a way to un-shrink data partition and restore it? I have TWRP at the moment. Was about to install LOS17.1 but stopped.
Reason: I did the stupid thing even though you (topjohn)asked not to, "Never flash only an AP file, as Odin can shrink your /data file-system if you do." Someone in the forums had a thorough, detailed post, saying to flash tarred files to AP slot (did not mention by themselves or with other files as well).
Thanks!
goodflood said:
Hello!
Not sure if this has happened, but I think my data partition has shrunk. My device (s10e) used to show 107 GB, now it shows ~ 15.7 GB. Is there a way to un-shrink data partition and restore it? I have TWRP at the moment. Was about to install LOS17.1 but stopped.
Reason: I did the stupid thing even though you (topjohn)asked not to, "Never flash only an AP file, as Odin can shrink your /data file-system if you do." Someone in the forums had a thorough, detailed post, saying to flash tarred files to AP slot (did not mention by themselves or with other files as well).
Thanks!
Click to expand...
Click to collapse
Flashing Stock rom should fix it...
Sent from my moto g(7) play using Tapatalk
@PoochyX That did it; thank you so much!
I have a Samsung SM-T290, running Android 9. Whatever I do, Magisk seems to shrink my data partition from 32G to 8G. I think I scrupulously followed topjohnwu's directions (except that I put the stock AR module on the SD card and moved it between the device and my laptop via sneakernet rather than adb pull). I used Odin to flash BL, the patched AP, CP and CSC (not Home-CSC). Magisk was installed alright, and I achieved root, but my storage was reduced to 8GB.
The only way I've found so far to bring my storage up to 32GB was to factory reset, which removes Magisk and root. I tried extracting the PIT file from CSC in the stock ROM and doing a NAND erase and reformat, but as long as I'm using the patched AR with Magisk, I end up with 8GB.
What am I doing wrong?
Further to the above: Just to dot all the i's and cross all the t's, I repeated the process, using adb pull to transfer the patched AP file, as topjohnwu recommended. The same thing happened: my data partition was reduced to 8GB.
Also, I've noticed, that whenever I insert the patched AP into Odin, it accepts it almost immediately, while it takes quite a while reading the original AP tar. Could this indicate that Magisk is corrupting the AP tar file when it patches it?
pgurwitz said:
Further to the above: Just to dot all the i's and cross all the t's, I repeated the process, using adb pull to transfer the patched AP file, as topjohnwu recommended. The same thing happened: my data partition was reduced to 8GB.
Also, I've noticed, that whenever I insert the patched AP into Odin, it accepts it almost immediately, while it takes quite a while reading the original AP tar. Could this indicate that Magisk is corrupting the AP tar file when it patches it?
Click to expand...
Click to collapse
I think the speed difference is due to whether it's ending with n.n.tar.md5 or just n.n.tar. The time probably has to do with the unpacking of md5.
By the way: My capacity also shrunk from 32 to 16 GB on my Xcover 4s

how to update my rooted phone to android 11?

that's the question, it says I can't update because I have a modified system
it's stock rom manually flashed with unlocked bootloader
If you rooted your phone using magisk download the latest firmware from samfw or any other site transfer the AP file to your phone patch it using magisk and then use ADB to pull it because if you just drag and drop the file from your phone to your pc it will probably lose some things on the way so download ADB and use the command adb pull "location of the patched file" don't use " after that when you flash the new firmware with odin in the AP slot select the patched file it would be named magisk_patched and some random letters, in the rest of the slots use the normal files from the firmware you downloaded and thats it. If this helped you make sure to like my response ! Thank you

Samsung Galaxy Tab A 10.1" - SM-T515 / SM-T510 - Root + TWRP - Android 11 - September 8th 2021 Security Update

/*** BEGIN DISCLAIMER ***/
If you follow this procedure and lose every bit of content on your device / end up with a fancy paperweight, I, nor anyone involved with the referenced open source or otherwise licensed projects is responsible. It's all on you, and this will void your warranty. Do not proceed if you don't understand something. Chances are you will have a bad time.
/*** END DISCLAIMER ***/
Hey everyone - my Samsung Galaxy Tab A 10.1" (2019) - SM-T515 - recently applied a security update without my consent (The Samsung Android 11R September 8th 2021 Security update - side note, make sure that you turn off Samsung's push service ), which canned my previous root access. I use server software and internal port forwarding to do... Things on my device, so I needed my root access back.
Here's how I retrieved it, and how I put TWRP in place as my recovery partition in the process.
The Tools
Make sure you have these before you start. Because this is a Samsung device, you'll have to do some things under Windows, like using Frija and Odin (unfortunately).
1.) Frija - Available here - https://forum.xda-developers.com/t/tool-frija-samsung-firmware-downloader-checker.3910594/
2.) The latest SM-T515 / SM-T510 firmware from Samsung for your device's CSC (if you use the firmware for the wrong CSC code the most common problem that I have seen as a result is typically incorrect partition sizes after flashing, which can be corrected with TWRP). Frija is listed first, because you'll use Frija to get this directly from Samsung.
3.) Some kind of generic tool that you're comfortable with for working with archives. Ideally whatever tool you choose should be able to work with .tar, .gz, and .zip archives for this process. Personally I like 7-Zip on *Nix and Windows, and ZArchiver on Android.
4.) Odin (firmware flash tool by Samsung) - attached.
5.) The latest Samsung device USB drivers for your environment (they're fine as long as they enable both ADB and MTP correctly) - available here https://developer.samsung.com/mobile/android-usb-driver.html
6.) The latest TWRP image for Samsung SM-T5xx devices - available here https://androidfilehost.com/?fid=14943124697586374577 (and attached)
7.) ADB - downloading / installing and using adb are outside the scope of this post. It is available here - https://forum.xda-developers.com/t/...vers-15-seconds-adb-installer-v1-4-3.2588979/
8.) The latest Magisk APK file - available here https://github.com/topjohnwu/Magisk/releases/download/v23.0/Magisk-v23.0.apk
The Process
0.) Back up your stuff, and remove your SD card if it makes you more comfortable - do whatever you need to do to be comfortable with "I might lose EVERYTHING on this device." If you plan on following this procedure, you should know how to do this, and I'm not going to try to explain it. If you can't get past this part, you should stop while you're ahead and still have a device that boots.
1.) Unlock your bootloader.
2.) Download the most recent firmware package for your device using Frija and extract all of the individual .md5 files which it contains.
2.) Use Odin to flash the most recent firmware to your device, and factory reset / wipe / format partitions and caches until you have a clean device that boots correctly. If your partitions aren't sized properly at this point it isn't something to be too concerned with, as you can correct them later using TWRP.
3.) Turn developer options back on, enable USB debugging, set the default USB configuration to "File Transfer", connect your device to your PC and copy the Magisk APK over to the internal storage of your device.
4.) Remove .md5 from the filename of the AP file that was included in your firmware package from Samsung and extract its contents into its own directory.
5.) Extract the contents of the latest TWRP package for these devices into the same directory where you extracted the individual partition image files contained in the AP file. Overwrite contents in the destination directory as necessary. The TWRP package should contain three files - param.bin.lz4, recovery.img.lz4, and vbmeta.img.lz4 - If there are uncompressed images (.img files) that correspond to the LZ4 compressed images from the TWRP package in the AP file of your firmware package, remove them first. Odin will (understandably) freak out if you try to flash two different images to the same partition in the same flash operation.
6.) Compress the contents of your modified AP directory which now contains the TWRP package's contents into a tar ball on your PC, and then copy it somewhere that Magisk will be able to access it on the Internal storage of your device (the Downloads directory - "/storage/emulated/0/Downloads/" is a good choice).
7.) Copy the latest Magisk APK to your device (again, the Downloads directory is a good choice), and then install it on your device.
8.) Launch Magisk on your device and choose "Install". Be sure to uncheck the "Recovery Mode" option. We don't want to use "Recovery mode" for Magisk's patching process. Even though this is a Samsung device and this would normally be how to proceed, in this case we're using our own custom TWRP recovery partition, and we don't want Magisk to mess with it. So make sure you aren't patching the bootloader or recovery images in unnecessary ways with Magisk.
9.) In Magisk on your device, choose "Select and patch a file" and then choose the AP file that you created and copied to the device which now contains TWRP as its recovery partition.
10). Let Magisk do its patching and when it has completed take note of where the patched file which it generated was written.
11.) Launch a command line / Powershell / Bash terminal where you can perform ADB commands, and issue the command "adb pull "/storage/emulated/0/Download/magisk_patched-23000_xYzXyZ.tar" (replace "XyZxYz" with whatever random sequence of characters that Magisk generated during its patching operations) to use ADB to download the patched AP file from your device.
12.) Power off your device.
13.) Reboot your device into FANCY download mode by holding the volume up and volume down keys simultaneously while inserting a USB cable that is connected to your PC into your device's USB C charger port. Your device should boot as you insert the USB cable and your bootloader should already be unlocked, so when prompted press the volume up button to continue.
14.) Launch Odin on your PC, and choose the BL, CP, CSC, and UserData images from the firmware package that you retrieved from Samsung to flash the corresponding slots in Odin. In the AP file slot, choose the Magisk patched AP file which contains TWRP as its recovery partition which you retrieved previously using ADB.
15.) Start the flash operation in Odin, and wait patiently for it to complete. Stay alert, because if you left "Auto reboot" checked in the Odin options, your device will reboot immediately upon completion, and there are actions that you need to take while the device is in its "off" state before it re-launches itself.
16.) Once the Odin flash operation has completed, boot to recovery mode. If you left "Auto reboot" checked in Odin, immediately as the flash operation completes, press and hold the power key and the volume up key and remove the USB cable from the device. Otherwise press and hold the power button and the volume down button until the device restarts, and while the device is in its "off" state remove the USB cable and press and hold the power button and the volume up button during device restart to enter recovery mode.
17.) Immediately upon entering recovery mode you should see TWRP do a couple of things that ensure that Samsung's device protection solutions don't remove it. Once those operations have completed, reboot into the system partition.
18.) Your device should be BASICALLY ready to go. Go through the steps to "complete" setup as you see fit. If you have not already done so, connect your device to a WiFi or to an LTE network and then launch the Magisk application.
19.) Magisk may want to download updates, if it does, let it do so.
20.) Once any necessary updates / downloads have completed, re-launch Magisk and it should present you with a prompt to the effect of "Magisk is installed, but additional configuration needs to be done on your device for it to work the right way. Do you want to reboot now?" If you've made it this far, the answer is "Yes, please do."
21.) After rebooting, your device will now be configured, and be running TWRP in its recovery partition, along with a properly Magisk rooted system partition.
22.) ????
23.) PROFIT!
I hope this helps some people out!
- The Scarecrow - 2021/09/22
Has anyone besides been successful?
mydjtl said:
Has anyone besides been successful?
Click to expand...
Click to collapse
I can provide screenshots from the device that I did this to if you would like.
It's pretty cool to see the TWRP logo on a Samsung Tab series device that's running Android 11.
I don't even get the little Samsung warning prompt during device bootup that says "This device's software can't be verified" or whatever Samsung's custom ROM message is. All I get is the "This device's bootloader is unlocked" message, no warning about the integrity of the software.
mydjtl said:
Has anyone besides been successful?
Click to expand...
Click to collapse
Follow this simple as he'll no need to read all these things
pankspoo said:
Follow this simple as he'll no need to read all these things
Click to expand...
Click to collapse
Yeah - pretty much exactly that, except I Magisk patched the system image, and then copied the TWRP package's vbmeta and recovery image into the AP file for the Odin flash, and then flashed every slot rather than just the AP.
is it systemless root?
Will this work on Galaxy Tab A sm-t595? on android 10?
or know of a root guide that will work with said device?
If you dont untick auto reboot, how do you fix any issues that happen because of it?
I rooted my t500 but I think it auto rebooted, which then caused a vbmeta error that stopped it booting. It worked again after flashing the stock rom, but now it gives a vbmeta error if I try to flash a modded rom to root it and I cant get oem unlock to appear in the stock os (download mode says its already unlocked tho)
Hello,
Code:
9.) In Magisk on your device, choose "Select and patch a file" and then choose the AP file that you created and copied to the device which now contains TWRP as its recovery partition
Step 9 yields an error on T515 : Unsupported/Unknown image format
I also tried to install AP patched file with Odin, same result.
Any idea ?
Damn this works so nicely, thanks mate! Cheers!

Categories

Resources