[HOW TO] reverse engineer kernel - Android Software/Hacking General [Developers Only]

Hi,
So although companies of course are bound by law to release kernel sources, and most of them do, there are sometimes circumstances where you still would like to see the disassembly of the kernel code. For example sometimes an ASM deadlisting can be easier to understand than complicated C++ code. Or maybe you suspect that your kernel code is slightly different than the source code your manufacturer supplied, maybe due to a slightly different configuration. It happens.
Anyway, whatever reason you might have, this is a small tutorial on how to obtain that kernel code in a deadlisting.
1) First of all you need of course to dump the boot image. I normally do this via: cat /dev/block/mmcblk0p17 > /sdcard/boot.img. But it depends on which partition the boot image resides. Use a partition tool to find out.
2) Seperate the kernel image from the boot image. I use Android Image kitchen myself.
3) The kernel image is self extracting. This means that it is just the compressed kernel + the decompression code to decompress it. We want to use a regular decompression utility so we want to strip that decompression code off in order for a normal decompression utility to handle it. Now, on older kernels (up to 2013 I think) you could use a tool like this to decompress the kernel: http://forum.xda-developers.com/showthread.php?t=901152 It's based on the fact that the kernel is Gzip compressed. However newer kernels use LZO compression. Luckily it's quite easy to do it manually. First of all you need to cut off the part upto where the kernel image starts (the decompression code). You need to search for 0x89 0x4c 0x5A 0x4F. That's 0x89 followed by "LZO", which is the start of the compressed file header. Now in my case I needed the 2nd hit (in my case the 1st hit is followed by some text and then like 0x50 bytes later follows the second hit, I needed that one). So cut off the part upto that, rename the file as a .LZO file and then you can just decompress it with any LZO decompresser, for example "Universal Extractor".
4) So now we have a decompressed kernel image. You could load this up into IDA pro already but reverse engineering will be hard since all symbols are missing. So how to get the symbols ? We can dump them from your phones memory too ! However the linux kernel is since quite some versions already protected against doing that, for obvious reasons. If you're root though, you can disable that protection via issueing:
Code:
echo 0 > /proc/sys/kernel/kptr_restrict
Next you can simply dump the symbols like:
Code:
cat /proc/kallsyms >/sdcard/symbols.txt
5) You now have a file containing all the symbols. But how to convert this into an IDA pro script ? You could write a simple tool or script that does it. Luckily I already did that for you, see the attached file However the symbol file you just dumped from memory wont contain the windows carriage returns after each line, which my tool needs (sorry too lazy to fix it up, lol), so you need to add them first. I use 'edit pad lite'. In that you simply copy en paste the file and save it. Once you open it in notepad you will now see it's perfectly carriage return formatted. Now use my tool to open it and it will create an IDC script
6) ready to load it all up in IDA pro now ! Open the kernel in IDA pro, select ARM as processor (that is if you're on such a phone of course) and load the kernel to the right address. Usually it will be the first address of your IDC script. But also a tool like Android Image Kitchen will show you the correct address. Then if the kernel is opened and loaded at the correct address, simply open the IDC script and it will add all symbols.
And there you have it ! A perfect deadlisting of your android kernel, containing all symbols ! Happy reverse engineering !

very nice one. good job bro.
Sent from my GT-I8190 using XDA Forums Pro

Subscribed, amazing thread and amazing tool, thank you for the insight, any more reversing knowledge with olly or ida is greatly appreciated.

Decent introduction, but this is just the beginning... Good for comparison purposes as you mentioned, but what else? *shrug*
Sent via Tapatalk on my Xperia Z

core7x said:
very nice one. good job bro.
Click to expand...
Click to collapse
berryman13 said:
Subscribed, amazing thread and amazing tool, thank you for the insight, any more reversing knowledge with olly or ida is greatly appreciated.
Click to expand...
Click to collapse
Glad you liked it guys.
CosmicDan said:
Decent introduction, but this is just the beginning... Good for comparison purposes as you mentioned, but what else? *shrug*
Click to expand...
Click to collapse
Not sure what you mean, you want me to teach you how to read ASM and/or use IDA pro ? That's a bit beyond the purpose of this thread I'm afraid.

@gekkehenkie11 Does the kernel decompressing end eventually ???
{
"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"
}
Im trying to follow your guide and im ok so far, i got the symbols from my phone, im decompresing the kernel right now.. we will see about using your script and IDA pro later.
THANK YOU!
Edit: i have the decompressed kernel now, i used the symbols to create the ida script using your script, now... i have to learn how to use it in ida

pirej said:
Edit: i have the decompressed kernel now, i used the symbols to create the ida script using your script, now... i have to learn how to use it in ida
Click to expand...
Click to collapse
Select ARM as processor and 0Xc0008000 as the kernel loading address (verify with your symbols, should be the same address as your first symbol) ! Good luck.

When i load the symbol-script made with your tool in to ida.. i get this type of error messages, a lot of them
C0103568: can't rename byte as 'vfp_propagate_nan' because the name is already used in the program.
C0F96E58: can't rename byte as 'byte_mux_ops' because the name has a reserved prefix.
C0F242FC: can't rename byte as 'ten_thousand' because this byte can't have a name (it is a tail byte).
Click to expand...
Click to collapse
There really is "vfp_propagate_nan" twice in my symbols dumped from my phone, is this normal or i did something wrong?

And I assume this would allow us to, like, recreate a particular kernel's source code when the original sources to it are unavailable, using extant code from a similar repo, right?

blakegriplingph said:
And I assume this would allow us to, like, recreate a particular kernel's source code when the original sources to it are unavailable, using extant code from a similar repo, right?
Click to expand...
Click to collapse
Hai I am new one n forum make any sample video understand

Post any video tutorials

After achieving deadlist how do we do to get kernel source in conventional format (like they have on github)..
I'm not asking u to write a guide. I'm asking "where i can find tutorial"
I find in 4pda forum to use "snowman decompiler" plugin in ida to convert deadlist to c++
Should i use it??

Hi I m looking for Lenovo K5 Note A7020 kernel.
Can anyone guide me to right direction.

Hi,
I m looking for Lenovo K5 Note A7020a48 kernel source can anyone guide me to right direction.

Hello, first thank you for this precious guide !
I'm currently facing problems reverse engineering kernel-ranchu kernel provided to modern AVD. Tried both of your methods and I can't get a valid kernel img. Any idea why ?

flaccidattempts said:
There is no certified way to reverse source code from binary. The process in which it has been compiled has to be reversed.
Now if you want to analyze binary and cross-examine it with android from source files, then you can derive using basic lamba functions to infer missing pieces.
But..... binaries can be engineered in a way that the code becomes obvious ESPECIALLY if you have Android from Source.
Essentially, you can download android from source using google repo tool, repo the release edition, compare side by side, file for file, what is different.
I Use these linux command s
From there i use a custom python file that 'line for line' searches for the strings, if they match, it logs the match.
once done with that, it sends it over to sublime text, which for some reason, on rare occasions resolves the binaries immediately, especially when paired with the matching strings file.
For files that are obviously encrypted, i wait till the end and brute force popular hashes, map out links, use lambda functions and use general deduction to solve to source.
If you want to learn how to analyze binaries with linux watch "malware analysis" videos on youtube
Click to expand...
Click to collapse
OEM/Manufukturer has an open source policy but some of them don't publish the kernel source code. I found the helpful answer to reverse kernel and I'll put it in the right suitable place.

lol im sorry. this is what im working with
unless you are trying to get from img to bin? or trying to get bin to text? or bin to c?

blu will not post there source or email me back, so im going to reverse engineer it to piss them off. Decompilers for llvm and clang and such exist. blueline hasnt put to much effort into hiding the source. I found a json @ link file that simplified the process

flaccidattempts said:
lol im sorry. this is what im working withView attachment 5622895
unless you are trying to get from img to bin? or trying to get bin to text? or bin to c?
Click to expand...
Click to collapse
IMG_Extractor_3.0.0.zip
drive.google.com
I extracted boot.img with img extractor v3.0.0 and get a compressed kernel image. I'm not sure what format it is but I want to reverse it

download ghidra from github. start importing files to assembly code

Related

Simple ROM Patcher (Replaced format with recursive delete) Faster ROM Flashing

Hey Guys, Here is a small application i created as i was fed up with the slow rom installs due to the format line of the updater-script
{
"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"
}
Code:
Requires NET Framework 4.5
Put simply this small application will patch the .zip
Replacing the line below
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
With the following line
delete_recursive("/system");
It supports manually browsing to the zip file
It supports dragging the zip file on to the exe
It supports right clicking the zip file and selecting "Patch ROM Zip File"
Note: Make sure to run the exe directly once to enable right click context menu. No installation required.
1.1
Fixed small issue with .zip detection
1.0
Initial Release
Released by Cyanlabs for XDA-Developers.
http://cyanlabs.co.uk
Download Here - http://kitchen.cyanlabs.co.uk/LG_G2/index.php?dir=G2+Tools+By+Cyanlabs/
It knocks off around 5-10minutes of flashing time and only takes about 10 seconds to patch
Use this file to remove the context menu entry RemoveContextMenu.reg (it will be re-added upon launching the application again)
Source:
Code:
Imports System.IO.Compression
Imports System.IO
Imports Microsoft.Win32
Public Class Form1
Dim FileToModify As String = ""
Private Sub NsButton1_Click(sender As Object, e As EventArgs) Handles NsButton1.Click
Using dialog As New OpenFileDialog
dialog.Title = "Select ROM Zip File"
dialog.Filter = "Zip Files (*.zip)|*.zip"
dialog.RestoreDirectory = True
If dialog.ShowDialog() <> DialogResult.OK Then Return
ModifyFiles(dialog.FileName)
End Using
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WriteRegistryHandler()
Try
FileToModify = My.Application.CommandLineArgs(0)
If FileToModify.Contains(".zip") Then
ModifyFiles(FileToModify, True)
Else
MsgBox("Invalid file selected!")
End If
Catch ex As Exception
End Try
End Sub
Sub ModifyFiles(update As String, Optional close As Boolean = False)
Try
Using archive As ZipArchive = ZipFile.OpenRead(update)
Dim File As ZipArchiveEntry = archive.GetEntry("META-INF/com/google/android/updater-script")
If System.IO.File.Exists(Application.StartupPath & "\" & File.Name) Then System.IO.File.Delete(Application.StartupPath & "\" & File.Name)
File.ExtractToFile(Application.StartupPath & "\" & File.Name)
archive.Dispose()
End Using
Catch ex As NullReferenceException
MsgBox("no updater-script found")
Application.Exit()
End Try
Try
Dim reader As New StreamReader(Application.StartupPath & "\updater-script")
Dim s = reader.ReadToEnd().Replace("format(""ext4"", ""EMMC"", ""/dev/block/platform/msm_sdcc.1/by-name/system"", ""0"", ""/system"");", "delete_recursive(""/system"");")
reader.Close()
If System.IO.File.Exists(Application.StartupPath & "\updater-script") Then System.IO.File.Delete(Application.StartupPath & "\updater-script")
Dim writer As New StreamWriter(Application.StartupPath & "\updater-script")
writer.Write(s)
writer.Close()
Using archive As ZipArchive = ZipFile.Open(update, ZipArchiveMode.Update)
archive.GetEntry("META-INF/com/google/android/updater-script").Delete()
archive.CreateEntryFromFile(Application.StartupPath & "\updater-script", "META-INF/com/google/android/updater-script")
End Using
If close Then MsgBox("Patched Successfully!", MsgBoxStyle.Information, "Success")
Application.Exit()
Catch ex As Exception
MsgBox(ex.Message)
Application.Exit()
End Try
End Sub
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click, Label1.Click
Process.Start("http://cyanlabs.co.uk")
End Sub
Sub WriteRegistryHandler()
Registry.CurrentUser.CreateSubKey("Software\Classes\CompressedFolder\shell\Patch ROM Zip File\command")
Registry.CurrentUser.OpenSubKey("Software\Classes\CompressedFolder\shell\Patch ROM Zip File\", True).SetValue("Icon", """" & Application.ExecutablePath & """")
Registry.CurrentUser.OpenSubKey("Software\Classes\CompressedFolder\shell\Patch ROM Zip File\command", True).SetValue("", """" & Application.ExecutablePath & """ ""%1""")
End Sub
End Class
Linux version
mattmannlt said:
I threw these together for Linux. Any other Linux users out there here you go.
LG-G2-RomFormatFix.sh
Nautilus script for right click menu.
LG-G2-RomFormatFix.sh
Thanks fma965. Good find.
Click to expand...
Click to collapse
sub'd. interested in this. possible to make it work via mac? and also on android itself?
Looks interesting, will take a look
Sent from my LG-VS980 using Tapatalk
I could make it work on Mac and Android but I don't have the skills for the coding languages used on those platforms
Sent from my LG-D802 using Tapatalk
I hear ya! So slow formating on this device.
This will come in handy for the real flash addicts.
Yep. Added this to my soon to be released EnergyROM for the LG G2. Thanks for the tip
Would be great if this could be done on Android. Download ROM with the phone, patch it, flash it
Thanks!
MaluNoPeleke said:
Would be great if this could be done on Android. Download ROM with the phone, patch it, flash it
Thanks!
Click to expand...
Click to collapse
Read up!
fma965 said:
Hey Guys, Here is a small application i created as i was fed up with the slow rom installs due to the format line of the updater-script
Code:
Put simply this small application will patch the .zip
Requires NET Framework 4.5
Replacing the line below
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
With the following line
delete_recursive("/system");
It supports manually browsing to the zip file
It supports dragging the zip file on to the exe
It supports right clicking the zip file and selecting "Patch ROM Zip File"
Note: Make sure to run the exe directly once to enable right click context menu. No installation required.
Version 1.0 - Released by Cyanlabs for XDA-Developers. http://cyanlabs.co.uk
Download Here - http://kitchen.cyanlabs.co.uk/LG_G2/index.php?dir=G2+Tools+By+Cyanlabs/
It knocks off around 5-10minutes of flashing time and only takes about 10 seconds to patch
Use this file to remove the context menu entry RemoveContextMenu.reg (it will be re-added upon launching the application again)
UPDATE: And yes this is a simple application it has only around 70 lines of code, this is one of my most basic applications and it was designed to be quick and basic, i can code programs that are much more advanced than this... check my github for proof, (http://github.com/cyanlabs)
Click to expand...
Click to collapse
Thank you good sir, I was doing this manually for a long time, now I no longer need to do this with your script!
djkinetic said:
Thank you good sir, I was doing this manually for a long time, now I no longer need to do this with your script!
Click to expand...
Click to collapse
My first and hopefully not last contribution to the LG G2 community, I have made many contributions while i was in the xperia play community as can be seen in my signature
offtopic: dont forget XDA has a thanks button
------------------------
v1.1 Uploaded - Read OP For Info
If any one with android/java programming skills is here then this post may help
http://pastebin.com/KiqLaTLT or http://pastie.org/8499361 (detailed information on what my application does so that some one can recreate it in java using the java class java.util.zip and inputstreams
Linux Versions
I threw these together for Linux. Any other Linux users out there here you go.
LG-G2-RomFormatFix.sh
Nautilus script for right click menu.
LG-G2-RomFormatFix.sh
Thanks fma965. Good find.
mattmannlt said:
I threw these together for Linux. Any other Linux users out there here you go.
LG-G2-RomFormatFix.sh
Nautilus script for right click menu.
LG-G2-RomFormatFix.sh
Thanks fma965. Good find.
Click to expand...
Click to collapse
Nice work, Uh could these run under terminal emulator on Android?
Sent from my LG-D802 using Tapatalk
fma965 said:
Nice work, Uh could these run under terminal emulator on Android?
Sent from my LG-D802 using Tapatalk
Click to expand...
Click to collapse
Is this patcher thing only for linux? cause I can't run it since its on win-32 bit.....
HeXaLox said:
Is this patcher thing only for linux? cause I can't run it since its on win-32 bit.....
Click to expand...
Click to collapse
mine is for Windows
the other one is for Linux
Sent from my LG-D802 using Tapatalk
FMA Saves the day again ^_^ +thnx bud
great idea but I easy question: why dev don't change script in rom? In my rom I use this form first ver
acer73 said:
great idea but I easy question: why dev don't change script in rom? In my rom I use this form first ver
Click to expand...
Click to collapse
well yes of course that is the ideal outcome but I can't control the devs so I make my own method
Sent from my LG-D802 using Tapatalk
I used this in my last round of ROM updates, but there is an issue with it. I had experienced this once and thought it was my recovery. One of my port testers experienced the same problem, so I decided to confirm the issue.
When I go back to my restore of my original stock ROM, do a Factory Reset, and then flash my ROM (with your included code), the ROM install fails. However, if I flash the same ROM (without your included code), the ROM installs fine. If I am also on a custom ROM and then flash and then flash my ROM (with your included code), the ROM installs fine.
Something about the original stock ROM creates this issue. I can't confirm a custom stock ROM, but I thought you may want to include this information in the OP in case anyone else runs into this issue. I'll include my exact steps in case you want to see it in action.
STEPS
ITEMS USED: I had my HeatshiverSX v1.5 (your code included) and a HeatshiverSX v1.5 copy (without your code). I had a backup of my original stock ROM, and used TWRP as my recovery.
Restored the backup.
Booted into OS.
Booted into recovery.
Factory Reset.
Flashed HeatshiverSX v1.5 (with code).
Install failed.
Factory Reset again.
Flashed HeatshiverSX v1.5 copy (without code).
Install worked.
Heatshiver said:
I used this in my last round of ROM updates, but there is an issue with it. I had experienced this once and thought it was my recovery. One of my port testers experienced the same problem, so I decided to confirm the issue.
When I go back to my restore of my original stock ROM, do a Factory Reset, and then flash my ROM (with your included code), the ROM install fails. However, if I flash the same ROM (without your included code), the ROM installs fine. If I am also on a custom ROM and then flash and then flash my ROM (with your included code), the ROM installs fine.
Something about the original stock ROM creates this issue. I can't confirm a custom stock ROM, but I thought you may want to include this information in the OP in case anyone else runs into this issue. I'll include my exact steps in case you want to see it in action.
STEPS
ITEMS USED: I had my HeatshiverSX v1.5 (your code included) and a HeatshiverSX v1.5 copy (without your code). I had a backup of my original stock ROM, and used TWRP as my recovery.
Restored the backup.
Booted into OS.
Booted into recovery.
Factory Reset.
Flashed HeatshiverSX v1.5 (with code).
Install failed.
Factory Reset again.
Flashed HeatshiverSX v1.5 copy (without code).
Install worked.
Click to expand...
Click to collapse
THanks for the information, Wouldn't this be due to something relating to the partition being formatted and not rm -rf'd ?

AIO Unpack Utility [ROMS][Windows]

***Abandoned*** Similar Stuff here
Hey Guys This is KP and After a Long Time, I am Releasing my another tool. This tool is specially compiled for Rom developers, as I have seen they need to do so much tidious work to successfully port a stable rom.
// All Downloads in Fourth Post
Since I can't make an auto-script for that, but still can make them happy in some other way.
So I am Presenting a Tool that can Easily Unpack ROMS, System.img or .dat, recovery, boot, APK, logo, Splash, TWRP backups and vice versa with some good editing tools for stuffs.
{
"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"
}
Requirements :
25 Mb space
.NET Framework 4.5.xx
Java JDK (here)
Windows PC (For Linux Use Wine Mono to use it)
Python (usually not needed, but still why to take risk )
Main Credits:
to osm0sis for his outstanding work
to Brut.all for his APKTool (Baksmali,Smali tool)
to ImgExtractor
to All Python or Linux Libraries I used
to Logo Builder Tool
to XDA Community
to benzyniarz for his Tool
to FFMEG a Great Tool
to Cygwin & Bluefirebird for his cecho
Sorry If i left Someone, tell me i will add here (all links in the original post)
Features​
~A Small Affordable Size Packaged
~Nice and Smooth GUI Interface
~PowerFull Logging System
~Perfect Output Capture on TextBox
~An Auto Skipable Processes (ASP)
~Unpack & Repack System.img and System.Dat Files
~Get Block Details of Raw System.img
~Convert Sparse to Ext4 System.img and vice-versa
~Convert System.Dat to System.img
~Unpack & Repack Recovery, Boot Img
~Display Img Info (kernel address, offset, pagesize,etc)
~Edit Logo.bin (Unpack & Repack , Replacing Tool, Get Image info like size, depth, dimensions,etc)
~Make a Flashable Logo.bin file
~Edit Splash.img (Unpack & Repack , Replacing Tool, Get Image info like size, depth, dimensions,etc)
~Convert Image (png,jpeg,bmp) to Splash.img
~Decompile & Recompile Apk Files
~Baksmali & Smali Classes.dex
~Unpack and Repack Android Backup Files, Make Them (.ab files gets from adb backup -all)
~Unpack Other Supportable Image Format (userdata, data, etc)
~Unpack TWRP Backups
~Unpack a Rom (with scc i.e if found some img or .dat file, then automatically decode them too)
~Sign a Rom or a Flashable Zip
~Create a Update.zip with auto META-INF Filling
~Rfs, EXT4 Unpacker Tool
~Build Prop Editor Tool
~Make a Flashable Build.prop File​
If you want some request feature to be added, contact me from the main tool thread. It will be my pleasure to do that
Beginners Guide to Use​
Its Basically very easy to do that, just click on any tab you want i.e suppose i want to unpack system.img just click on the browse button to do that then browse for outpath then Do Job. Also You can drag files onto the boxes and do stuff, inshort Tool has drag and drop feature supported. Also in between the process you can stop it by clicking on Stop button in bottom right (will be enabled automatically during processes).
System.img And System.Dat File​
Its Very Easy Just Drag and Drop or Browse for System.img File and Then Browse for their outpath by Double clicking second textbox and Click on Do JOB. Also you Can Convert Any System.img to Raw format or EXT4 Format by Clicking on Convert Button or You can get Blocks Details by Clicking Details Option. Same for System.Dat File. The Alert box checkbox is a function that will beep a sound whenever job is over and -i switch is for getting whole output from imgextractor.
Recovery and Boot.img​
To unpack or repack it is very easy same as we do for Above function, browse for recovery or boot img then for output path and then DO JOB. Also you can get Details of the img i.e Page size, Address, etc. You can also use drag and drop feature too.
Logo.bin and Splash IMG​
To unpack Logo.bin or do stuff on splash on image check on the respective radio button then right click on it and select a proper option. For logo.bin output images can be displayed on that page only, also you can double click on the image to see proper mods. Then you can replace the image, get details of it and do a lot of stuff. For Splash.img Output will be displayed on a new windows from where you can do stuff, also you can convert any png,jpeg,bmp images to Splash.img
Apk Manager (Apktool,baksmali,smali,ABE)​
Now if you have read above info then you can do it too.. Its very simple same thing drag and drop or browse then DO JOB. You can also baksmali any apk. Note the method used for baksmali is basic .locals only.If you want some more request a feature. ABE Tool below ApkTool is utility which will unpack android backup files i.e (.ab or .bak) Done from "adb backup -all"
and all.
Stuffs And Settings​
Here nothing to be tell read from buttons and you will get everything. ALso you can drag and drop some stuff on respective buttons, a tool tip will be displayed saying that drag and drop is supported on this button. From below settings you can change some Java Path and All Set java heap size i.e -Xm in java -jar. Howevery Python is not usable but JDK is must for APK Manager
So now I think you got the basic functionallity also there are many which I can not discussed here coz lack of time. So try to spend time with my tool and you will get all Stuff
***Abandoned*** Similar Stuff here
version 1.0 (16-5-2017)​~ Initial Release​
All Downloads HERE
Like my Work, Do Support me by Donating :laugh:
Want to Contact me or Request a Feature Contact me from the main website
EDIT : Sometimes your antivirus may detect it as a virus, but trust me its a false report. Because my file is not signed digitally by Microsoft and of course that needs money. So Remember to exclude folder from scanning:laugh:​
Hope to add repack tool
通过我的 1505-A02 上的 Tapatalk发言
andy19801210 said:
Hope to add repack tool
通过我的 1505-A02 上的 Tapatalk发言
Click to expand...
Click to collapse
Repack Tool is already there in the tool, just how to unpack files, you can repack it too just by change combo boxes or selecting repack radio buttion and stuffs
Ok, That's good.
通过我的 1505-A02 上的 Tapatalk发言
support 7.0?
Mr Hassan said:
support 7.0?
Click to expand...
Click to collapse
Yup
[email protected] said:
Yup
Click to expand...
Click to collapse
ok , how repack ext4 img? and avast detect it virus and deleted. and 2 days ago i refresh my window
Mr Hassan said:
ok , how repack ext4 img? and avast detect it virus and deleted. and 2 days ago i refresh my window
Click to expand...
Click to collapse
Its a false detect bro..my tool does not contain virus..the reason it detected it virus is because you are not using trusted anit virus and that too not pirated.... So.. let it be happen..its a false report ..in ur antivirus disable scan on this folder..
[email protected] said:
I)
Click to expand...
Click to collapse
ok, i add in excuse list, now 2nd thing, its not extracting ext4? and not repacking again ext4?
and i extract img, file, its taking long long and very long time, and still showing process
Mr Hassan said:
ok, i add in excuse list, now 2nd thing, its not extracting ext4? and not repacking again ext4?
and i extract img, file, its taking long long and very long time, and still showing process
Click to expand...
Click to collapse
Umm... I think..update is needed to my tool.. some tools should be updated.... For a being update the IMG_unpacker.exe in tools folder to the latest version..download it from Google
[email protected] said:
Umm... I think..update is needed to my tool.. some tools should be updated.... For a being update the IMG_unpacker.exe in tools folder to the latest version..download it from Google
Click to expand...
Click to collapse
yes time to update the tool, when you updated it so kindly qoute me,
and why you not some extra fetures ?
Mr Hassan said:
yes time to update the tool, when you updated it so kindly qoute me,
and why you not some extra fetures ?
Click to expand...
Click to collapse
Okay will add some extra features and ping you
Links broken
Android Oreo ??..Also link not working
Did it support android oreo??
and plz update the link
Shubhi singhal said:
Did it support android oreo??
and plz update the link
Click to expand...
Click to collapse
It should work fine for oreo
Jashane said:
Links broken
Click to expand...
Click to collapse
All link fixed!
[email protected] said:
All link fixed!
Click to expand...
Click to collapse
Java link?

[APK,IMG,DAT,BR] One click decompile/compile - Windows Shell Integration

This tool is a part of ADK software, thread can be found here (For summary read Introduction part below). Read Instructions at the end on how to install this.
Click to expand...
Click to collapse
{
"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"
}
Snapshot
Click to expand...
Click to collapse
Introduction
This Utility adds option to right click decompile, compile options for some extensions (like apk, img, dat, br, file_context.bin, payload.bin) so that you don't have to open any kind of kitchen again and again move files there and select options to unpack. See screenshots above you will get an idea about what is it..
Also it's not a separate tool it is a part of ADK. Read Installation and download instructions from below and check 2nd post for usage instructions.
And yes the main part since ADK kitchen is not completely free it works for only 7 days as a trial after that you will have to use demo version which has certain feature disabled. Not to worry this utility will work fine but there will be a pop-up notifying to buy license.
What is ADK?
Well if I've to say, ADK (Android Development Kit) is a complete Windows based GUI application which allows you to edit Android apk files, ROM zips, boot or recovery images, Android Firmware and also to create TWRP/CWM flashable recovery zips easily. It's like a complete Android Kitchen with lots of mods, patches, scripts, templates, rich text editor, etc. like an IDE. For more info visit official thread here.
Click to expand...
Click to collapse
Features
Well here you go,,,
Unpack/Repack APK (including smali), IMG, DAT, BR files.
Generate Java Source for APK.
View APK Info like App name, Package, permissions, icon, etc.
Import App as dependency for system apk.
Support Android 9.0 ROM.
Supported lists are: System, Vendor img, dat, br and Recovery or Boot images)
Suggest me what to add more.. :laugh:
Click to expand...
Click to collapse
Changelog and Known Issues
Changelog as per release 1.1.0.0 (17th January 2019)
*Added: Option to unpack Payload.bin
*Added: Option to convert file_contexts.bin to file_context
*Added: Support for Android 9.0 images.
*Updated: APK decompiling so as to create project for ADK.
Known Bugs
* Unpack option is not showing for .IMG file (on Win8.1 and lower).
Current Fix:- Open CMD and type "contexts d path-to-img" (without quotes).
Click to expand...
Click to collapse
Downloads & Instructions
To use these feature you must have ADK to be installed. So read steps below (noob friendly) in order to get it. If you want to know what is ADK read Introduction Part above.
Step 1: Install ADK
Grab a latest release of the software from above link.
Step 2: Extract the ZIP and install setup.exe as we normally do.
Do not install the software in C:\Program Files or Program Files (x86) folder.
Step 3: Launch ADK from desktop shortcut and go to Help > Plugins & Patches.
Keep your internet connection ON to do this steps.
Step 4: Search for ADK Context [Script] and install it.
First click on Download option then after click on Install it. Installation will be like normal setup file.
Step 5: Once installed you can close ADK and use the plugin.
Click to expand...
Click to collapse
Reserved
Nice tool keep up the good work!
Sent from my Redmi 4X using Tapatalk
can we then recompile say a vendor img after using this tool to unpack?
Xdevillived666 said:
can we then recompile say a vendor img after using this tool to unpack?
Click to expand...
Click to collapse
Yes why not! Just right click on the unpack folder created by the tool and select Encode APK,IMG,DAT,BR option from there
Tool has been updated. To download it open ADK it will notify you which plug-in needs to be updated!
[email protected] said:
Yes why not! Just right click on the unpack folder created by the tool and select Encode APK,IMG,DAT,BR option from there
Click to expand...
Click to collapse
Can't repack vendor either with ADK or shell.
ADK says cant find context for system/apps probabby its cant find selinux perms in file_contexts as its vendors its should not need that
And with Shell method can't say log are not getting create
Please looks and thanks for your work
Luffy.d said:
Can't repack vendor either with ADK or shell.
ADK says cant find context for system/apps probabby its cant find selinux perms in file_contexts as its vendors its should not need that
And with Shell method can't say log are not getting create
Please looks and thanks for your work
Click to expand...
Click to collapse
Vendor needs file_context especially plat_file_context it maybe missing something. I will look into it soon as currently I'm working on new project. So this might take a little while, but for sure I'll fix this.
[email protected] said:
Vendor needs file_context especially plat_file_context it maybe missing something. I will look into it soon as currently I'm working on new project. So this might take a little while, but for sure I'll fix this.
Click to expand...
Click to collapse
Thank you and no hurry
and here the exact error
error: build_directory_structure: cannot lookup security context for /system/app
Wow nice.
This can decompile framework-res.apk ans systemui.apk without errors anf uknown folders? Means java problem?
Good work, thank you.
Wysłane z mojego SM-G930F przy użyciu Tapatalka
Luffy.d said:
Thank you and no hurry
and here the exact error
error: build_directory_structure: cannot lookup security context for /system/app
Click to expand...
Click to collapse
I'll contact you once I will look up in this issue and fix it.
nalas said:
Wow nice.
This can decompile framework-res.apk ans systemui.apk without errors anf uknown folders? Means java problem?
Good work, thank you.
Wysłane z mojego SM-G930F przy użyciu Tapatalka
Click to expand...
Click to collapse
Yes it will unpack framework-res.apk and system ui. Just make sure when you want to decompile these system apps make sure to check the option 'import as dependencies' to not get any decompiling and compiling error further.
For Java problem I still get no response to issue with the latest Java problem. I think we still have to use lower Java version.
Android pie repacked system_ext.img can't boot.
Werewolf 99 said:
Android pie repacked system_ext.img can't boot.
Click to expand...
Click to collapse
Well I need some more info on this issue a logcat or something else. From your info I deduct following things like!
1. Your ROM might but using sparse image not ext if that's the case convert the image and then flash.(since sparse image omits some empty blocks)
2. I need to know the original image size and new compiled image size (if you have not made any changes then how much difference is present in their size).
Also let me know if you are flashing the new image using sp tool (for mtk devices).
futuretricks
thanks for this
Thanks for Your Share
EnerJon said:
Nice tool keep up the good work!
Sent from my Redmi 4X using Tapatalk
Click to expand...
Click to collapse
Thanks
cant use without a license, script download function is locked.. This must be under "paid software"not here.
guap said:
cant use without a license, script download function is locked.. This must be under "paid software"not here.
Click to expand...
Click to collapse
As discussed with the moderator this is part of ADK which is free to use even after trail period https://www.google.com/amp/s/forum....adk-android-reverse-engineering-t3803044/amp/
So if this is not working try original ADK which works after expiry date
I keep trying to download the script but the file is 0 kb and wont install. Any help?
Arden said:
I keep trying to download the script but the file is 0 kb and wont install. Any help?
Click to expand...
Click to collapse
Check your PM

Development Installing GSI by repacking super.img on SM-A127F and SM-A325F (Linux)

repacksuper
===========
Copyleft uluruman 2021-2022
(for LINUX/WSL only)
This is the minimalistic set of tools + a script for Linux for the automated
ground-up repacking and flashing of the Samsung Galaxy super.img, replacing
the stock Android system with something much less intrusive and obtrusive
(e.g. LineageOS). Or just some other GSI (Generic System Image).
Additional included scripts (since v1.1) simplify flashing of stock firmware or
separate image files under Linux using Heimdall.
Theoretically should work for any Samsung A-series phones, and may be even for
some others. Tested on SM-A127F/DSN made in India and Vietnam and SM-A325F/DS
made in India, on Debian Linux 11 x64. There are reports of successful flashing
of SM-A127M, SM-A032M and SM-A226B.
Why this method?
----------------
Repacking of super.img is the only method which allows changing of the phone's
operating system without screwing up the Verified Boot (VB) protection
mechanism. Keeping the VB allows you to be sure that everything besides the
platform was indeed compiled by Samsung and wasn't tampered with, no matter from
where you downloaded your stock firmware.
The other reason is that although there are alternative methods of changing the
OS, for phones with dynamic partitioning and no working version of TWRP
available they may be even more complicated than repacking of super.img
externally by this script.
Requirements
------------
Install the following tools from the official repositories of your Linux distro:
simg2img xz-utils lz4 unzip gzip jq file
Basic instructions
------------------
repacksuper.sh: main script for changing your phone's operating system
heimdall_flash_stock.sh: script for flashing stock firmware under Linux
heimdall_flash.sh: script for flashing any custom image file under Linux
Just run a script without any arguments to see help.
Extra tools used (x64 binaries and sources included)
----------------------------------------------------
GitHub - LonelyFool/lpunpack_and_lpmake: android super.img tools
android super.img tools. Contribute to LonelyFool/lpunpack_and_lpmake development by creating an account on GitHub.
github.com
GitHub - amo13/Heimdall: Heimdall is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung Galaxy devices. This is a fork of the original repository with a few crucial pull requests merged.
Heimdall is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung Galaxy devices. This is a fork of the original repository with a few crucial pull requests merged....
github.com
Additional notes
----------------
The included binaries for the lpunpack, lpmake and Heimdall were compiled for
the x86_64 architecture. If your PC architecture is different (e.g. x86 32-bit
or ARM) you have to compile these tools yourself. The full source code is
included (or otherwise available on GitHub).
Spoiler: Changelog
0.9: Initial release
0.91: Non-sparse new system is now correctly moved into the super dir
0.91a: Bug in the new system file format checking fixed
0.91b: Better support for spaces in paths
0.92: Added checking for system requirements and an optional parameter for
setting of the final tar archive name.
0.92a: Fixed file ownership issues inside the tar distribution archive
0.93: Added support for SM-A325F. Several minor improvements.
0.94: Added support for gzip-packed GSI images. Packing into .tar is now done
without question if the command line parameter is given. Tar parameter
now can include the full path. Without the full path the default tar
location is now the same as the GSI. Several other minor changes.
1.0: Finally added working native Linux flashing using Heimdall (HUGE thanks
to amo13 and Benjamin Dobell). Two new options: using empty product.img
and silent (non-interactive) mode. Colored text. Bugfixes and minor
changes.
1.01: Option to specify the SUPER partition name manually (needed for flashing
SM-A127F with Heimdall). Now it is possible to place output .img and .tar
files in any directory and give them any name. Text terminology a bit
clarified, help text expanded. Done many internal optimizations,
additional sanity checks and minor changes.
1.02: Support for SM-A032F/M and similar firmwares with non-packed super.img.
Support for firmwares with/without additional partitions. Support for
arbitrary partition group names. Very experimental option to use empty
system_ext.img for additional privacy (applicable to some phone models/
regions). Lots of minor fixes.
1.03: Multiple .img files are now supported in GSI archive files (one of them
should be system.img in that case), e.g. Android AOSP zip files are now
supported directly. The logic of flashing with Heimdall now includes more
complex cases, such as flashing in two steps with a reboot. Unnecessary
code in GZ unpacking removed. Some other small fixes and optimizations.
1.1: New scripts heimdall_flash_stock.sh and heimdall_flash.sh added.
Lots of refactoring in repacksuper.sh (because of that there may be some
bugs left), improved and clarified UI logic, changes in where the files are
now placed (see help for details), direct work with stock Zip firmware
files, lots of minor changes.
1.11: Colored text now should be correctly displayed in almost any shell that
supports it except if it's explicitly disabled with NO_COLOR.
1.11.1: heimdall_flash.sh now can flash Super partitions unconditionally in one
step when using both the -s parameter and manually specifying parition
name (e.g. SUPER for SM-A127F).
1.12: The heimdall_flash_stock.sh script was significantly upgraded with lots of
new features. Now it theoretically allows upgrading of stock firmware
without erasing user data, keeping the GSI and custom recovery, etc.
(although it's not that straightforward, read the help for details).
A couple of fixes in the other scripts.
1.12.1: changed unlz4 to lz4 -d, as some distros don't have the needed symlink
1.13: In repacksuper.sh support added for the Vendor DLKM and ODM DLKM
partitions, as well as the experimental -v option to add or replace Vendor
DLKM with a custom image. A couple of minor fixes.
1.14: Greatly improved logic of heimdall_flash.sh, now it's possible to specify
both or either custom partition name and custom file name, and acquiring
PIT from device is done only when it's needed. Versioning scheme of the
scripts was unified: the script that was updated receives the updated
version number of the whole pack, the rest retain the old numbers.
1.15: up_param_tool.sh script was added: it allows altering of the boot
sequence images (logo, "not official" warning, etc.), as well as the
Recovery and Download internal graphics. Happy hacking, but please pay
attention to the warning displayed after extracting the JPEG files.
A couple of minor fixes in the other scripts.
1.15.1: Bug with failing LZ4 uncompression fixed in repacksuper.sh and
heimdall_flash_stock.sh.
1.15.2: Added the Ctrl+C trap in heimdall_flash_stock.sh, so now the temporarily
renamed files are correctly renamed back in case of flashing being
aborted with Ctrl+C. Upgraded Heimdall with the git pull requests, but
it seems those still do not cure the relatively rare issue when flashing
specific files gets completely stuck at some point.
1.15.3: The "file" tool used to identify PIT files was replaced with direct
reading of the file header as the first method proved to be unreliable.
1.15.4: Fixed a bug in heimdall_flash.sh (missing g flag in sed)
1.15.5: Fixed the compatibility issue with the older LZ4 compressors
1.15.6: Fixed compatibility issues with systems where /bin/sh is Bash, such as
ArchLinux
1.15.7: repacksuper.sh: fixed using the existing "repacksuper" dir as source,
also in this mode you can now specify "-" as new system image to reuse
everything inside the "super" subdir. New experimental -w parameter.
All scripts: the Ctrl+C trap now switched on and off the correct way.
Several other fixes.
1.15.8: Fixed using the heimdall_flash_stock dirs as source for repacksuper.sh.
A couple of other fixes.
1.15.9: heimdall_flash_stock.sh: fixed skipping of duplicate partitions (e.g.
vbmeta) for some shells; fixed upgrade-flashing of Galaxy A32 (default
behavior).
Spoiler: Known issues
During the script run you can see several "Invalid sparse file format at header
magic" warnings, just ignore them.
For some firmware files Heimdall may not work at all (freeze indefinitely or
exit with an error), in that case you have to resort to Odin. In many cases
Heimdall freezes when uploading files for some time, but that does not mean it
is completely frozen, just be patient.
In LineageOS, Dot OS and some other GSIs I tried on SM-127F the touch screen
remains not responsive for about 6 seconds after waking up. The problem is not
present at least with SM-127F/DSN phones made in India, but present at least in
those made in Vietnam. Another problem in the most, if not all, GSIs is that the
MTP USB file transfer does not work (at least on Linux) because of the "wrong"
(Samsung's instead of Google's) default MPT driver used by the kernel.
Both of the aforementioned problems can be solved by installing the fixed and
recompiled kernel.
For the last problem alternative solutions include using apps such as
Warpinator, Syncthing or ftpd.
Spoiler: Food for thought
When choosing a GSI to install I really don't recommend using ones which include
GApps and therefore use any of the Google services. Don't let corporations
gather your data. You bought the phone and from now on it should be all yours,
with all of its data, like a PC in the good old days. You own your device, and
nobody has the right to stick their nose into how you use your phone, gather any
statistics and push you any ads. You always have a choice to turn down
privacy-unfriendly stuff, the price of that "inconvenience" is actually
ridiculous. From my point of view, there is simply no point in using non-stock
systems if they are still littered with the privacy-unfriendly bloatware.
For the step-by-step guide (slightly outdated) read this and this post. Also be sure to read this post concerning the importance of optics.img. Concerning the up_param_tool.sh be sure to read this post.
The included binaries for the lpunpack, lpmake and Heimdall were compiled for the x86_64 architecture. If your PC architecture is different (e.g. x86 32-bit or ARM) you have to compile these tools yourself. The full source code is included (or otherwise available on GitHub).
Latest stable combinations of stock firmware and LineageOS (updated February 5, 2023):
SM-A127F: A127FXXU7BVI4 + LineageOS 20.0-td 20230115 arm64 bvS
SM-A325F: A325FXXU2CVK3+ LineageOS 20.0-td 20230115 arm64 bvS
Some recommendations (updated February 5, 2023):
If you are a newbie and don't know how to do unlock the bootloader and other such stuff, here is a good guide by LAST_krypton (follow the "Unlocking the booloader" section) or a shorter guide by cldkrs.
First flash the phone with the whole set of stock firmware using the heimdall_flash_stock.sh (Linux only) script with the -d parameter: the latter forces flashing the unsafe partitions, which are needed for complete re-flashing.
If you're on Windows use Odin instead. Although there is a "leaked" Linux version of Odin, it's still closed-source (of course), so I don't recommend using it on your main Linux PC. For using the Windows version of Odin on Linux you have to either use Windows in QEMU (tested and works) or probably Wine (untested). When using QEMU remember to add the SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="685d", MODE:="0666" line to the udev rules (e.g. /etc/udev/rules.d/30-qemu.rules) to enable the write access to the phone.
Sometimes Heimdall cannot flash the stock firmware and gets stuck at some particular file. Although you can successfully flash such a firmware using Odin, I recommend to better to find another firmware, may be one release older, because that may indicate some sort of incompatibility with your particular version of the phone.
The stock firmware comes in different revision numbers (also known as the baseband version), which are upgraded about once a year. Generally it should be beneficial to use the latest revision, but note that once you have upgraded it to a later revision there is no way back (at least known to me). In case you want to experiment with flashing of special kernels and other flavors provided by the XDA developers, if possible, you should probably stick to the very first revision.
If you already have the bootloader unlocked (OEM unlock) then after flashing the stock firmware there is no need to set up the Android, just go straight into the download mode again and flash the repacked super.img.
When downloading LineageOS or any other GSI select the normal arm64 bvS version, not vndklite version.
After flashing the OS go into the Recovery mode (hold volume up and power when rebooting) straight away and do the Factory reset. If you cannot get into the Recovery mode be sure to connect the USB cable before trying to.
If flashing with Heimdall completely freezes at some point make sure you've downloaded and repacked the correct arm64 b or a/b GSI and not arm and not a or a-only variant. If "sw rev check fail" message appears on the screen at some point just ignore it.
You can forcefully reboot your phone at any time, even if it seems bricked, by holding the volume down and power buttons for several seconds.
To upgrade your system to the recent version of the same OS just repackage it again using the same script and flash it normally. If the phone does not boot, get into the Recovery mode and try wiping the Cache partition (all your apps and settings should remain intact).
Most probably you don't need TWRP or any other 3rd party recovery tool at all, as the stock recovery tool works fine for just the factory reset after flashing the super file.
Try to avoid using Magisk if you just want to install another OS and nothing else. It is also not needed for LineageOS bvS version as it already has the su utility integrated, you just need to install the additional Superuser app by Pierre-Hugues HUSSON from the F-Droid store (although it's very old it works just fine).
It's possible that SM-127F/DSN internally is not A12 but actually M12, at least most of the tools and kernels made for M12 work on SM-127F/DSN while those made specifically for SM-125 and even other SM-127 versions do not. Therefore you can find more relevant info and tools in the corresponding XDA thread (my script is still remains relevant though).
I should test this for a127f
Bugs fixed: v0.91 & v0.91a
Bug fixed: v0.91b
Added the "file" utility to the list of requirements, updated readme.txt.
Thanks A LOT, this works! I am finally able to run LineageOS on my phone!
For Windows 10+ users: WSL runs this script just fine with a few additional steps.
1. Install WSL 2 and any Linux distribution from Microsoft Store
2. Run the distribution to finish setup
3. Install the required packages from the post (sudo apt install for Ubuntu/Debian)
4. Shift + Right Click in the folder where you have the script, the AP and the GSI packages
5. Open Linux shell there
6. Unpack & run script as stated in its help
Voila!
Wow ! Great job! I want to try it, but i'm getting many "Invalid sparse file format at header magic" while running the script, is it OK to flah the super.tar anyway?
jadfa said:
Wow ! Great job! I want to try it, but i'm getting many "Invalid sparse file format at header magic" while running the script, is it OK to flah the super.tar anyway?
Click to expand...
Click to collapse
It is totally OK
jadfa said:
Wow ! Great job! I want to try it, but i'm getting many "Invalid sparse file format at header magic" while running the script, is it OK to flah the super.tar anyway?
Click to expand...
Click to collapse
Yes, it is fine. These are just warnings produced by lpmake, they can not be suppressed. I could only suppress all the stdout/stderr from lpmake but it's no good in case of more serious warnings.
Updated to v0.92 with a couple of minor improvements.
{
"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"
}
What should I do next with the raw file?
"Unknown super file format" is this how it should be?
ANDARXapi said:
View attachment 5490897What should I do next with the raw file?
"Unknown super file format" is this how it should be?
Click to expand...
Click to collapse
Of course not. The format of each file is checked using the "file" utility, it should return the string "Android super image". Try to run file /home/toor/APfilles/super.stock.raw . What is the response? And try doing it all without sudo. There is no need in root privileges.
uluruman said:
Of course not. The format of each file is checked using the "file" utility, it should return the string "Android super image". Try to run file /home/toor/APfilles/super.stock.raw . What is the response? And try doing it all without sudo. There is no need in root privileges.
Click to expand...
Click to collapse
The raw file opens as a picture
uluruman said:
Of course not. The format of each file is checked using the "file" utility, it should return the string "Android super image". Try to run file /home/toor/APfilles/super.stock.raw . What is the response? And try doing it all without sudo. There is no need in root privileges.
Click to expand...
Click to collapse
run without sudo: 168: ./lpunpack_and_lpmake/lpunpack: Permission denied Cannot correctly unpack the super file. Exiting ...
I managed to fix the script, you just need to give chmod +x rights to the files in the folder "lpunpack_and_lpmake": lpunpack, lpmake, lpflash, lpdump, lpadd
ANDARXapi said:
I managed to fix the script, you just need to give chmod +x rights to the files in the folder "lpunpack_and_lpmake": lpunpack, lpmake, lpflash, lpdump, lpadd
Click to expand...
Click to collapse
Hmmm. I have updated it, may be it'll help. Could you please test the latest version (v0.92a)? I want to work it out of the box for everyone, without sudo or any tweaks.
uluruman said:
Hmmm. I have updated it, may be it'll help. Could you please test the latest version (v0.92a)? I want to work it out of the box for everyone, without sudo or any tweaks.
Click to expand...
Click to collapse
Okay, I'll test it tomorrow, today I want to relax at the computer all day
uluruman said:
Hmmm. I have updated it, may be it'll help. Could you please test the latest version (v0.92a)? I want to work it out of the box for everyone, without sudo or any tweaks.
Click to expand...
Click to collapse
Checked, it works right away
Is there a way to install magisk and root?

[Firefly] [ROCKCHIP] 3.5-Month UPDATE: Firefly ITX-3588J (Rockchip RK3588) "Deskphone" WORKS! Almost.

After 3.5 months of trial and error, unresponsive communities, ups and down, spending $75 on a video card that may be proving unnecessary ... I finally present to you - an almost fully-working Firefly ITX-3588J Dual-Boot Android/Linux ARM Machine.
WHAT IS IT?
The Firefly ITX-3588J is a Mini-ITX - small PC form-factor - "single-board computer" that was released earlier this year by the Chinese manufacturer Firefly, aka. T-Chip Intelligent Technology Co. Ltd.. It features the Rockchip RK3588 (hence the name) ARM system-on-chip (SoC) in a package that adduces many different kinds of ports including a PCI Express x4 slot, multiple HDMI video outs that go to the on-chip Mali GPU, and an M.2 that can be used in theory to add a telephone network card, making it a mini-desktop and smartphone all in one.
I got one because I saw it as an opportunity to for once have an easily-transportable low-energy consumption system that would be both an alternative to x86 and also not the Mac while still offering reasonable performance even if far from top-of-the-line - and ideally, it'd be great if more such boards come later because other ARM SBC boards tend to be both more limited and also very awkward with their cables. This is the only one I'm aware of, besides certain Raspberry Pi breakout boards like the Turing Pi, that can use a standard PC case.
But getting it to work, on the other hand, proved to be MUCH more diifficult because while the vendors offered a choice between Android 12 and Ubuntu 20.04 operating systems, I realized I needed both: I wanted access to both software ecosystems on the same machine, and was determined to get that to happen. And I want to say that within the last few days I have finally come quite close to achieving this dream in full.
WHAT DOES IT DO NOW?
Right now, the machine dual-boots Android 12 and Ubuntu 20.04 using the vendor-provided patched 5.10.66 Linux kernel source tree, with the user-space data of both OSes stored on a SATA SSD hard disk instead of the embedded eMMC. Boot selection is possible on startup simply by hitting "Ctrl+C" and typing the appropriate command to select the Ubuntu OS; otherwise, Android 12 boots by default. All this happens by video console on U-Boot with no serial port requirement, making it function as a proper stand-alone dual-boot ARM PC.
WHAT IS STILL TO BE DONE?
Graphics support on Ubuntu 20.04. No idea why this isn't working even with the provided kernel and driver packages. Text console over monitor works fine, though.
WHAT DID IT TAKE TO MAKE IT GO?
In retrospect, it's not really all that difficult. The most difficult part was just figuring everything out because there was very little comprehensive documentation given beyond how to simply load the images, and I had before this point zero real experience actually piecing together an Android system on a mobile/embedded-style board and machine. One thing that's a casualty is the stock Ubuntu image; it turned out to be much more fruitful to simply install the system to the hard drive via a procedure analogous to, albeit having to be arranged manually, what a typical installer would do, i.e. setting up and using APT to load the whole Ubuntu system from the Internet over wi-fi with the only vendor-adulterated component being the kernel and Mali graphics drivers because Valhall, nor even the whole RK3588, is currently mainlined in the Linux kernel system.
WHAT DOES IT LOOK LIKE?
The machine:
{
"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"
}
Running Android:
Ubuntu (no graphics yet!):
@Shimmy99 Would you please offer the procedure you used to make the board boot from SATA SSD?
That would be greatly apprecaited. I have a similar board and I have been interested in installing Android on a SATA SSD but the vendors don't respond to messages and there is very little information on their forum.
Thank you
qwestmogul2012 said:
@Shimmy99 Would you please offer the procedure you used to make the board boot from SATA SSD?
That would be greatly apprecaited. I have a similar board and I have been interested in installing Android on a SATA SSD but the vendors don't respond to messages and there is very little information on their forum.
Thank you
Click to expand...
Click to collapse
Mmm. I don't have a direct boot from SSD possible yet. Getting it to this stage has required coding work on the provided U-Boot and I would share a source pack to my github but it will take more to get direct SATA boot because it crashes when the U-Boot is compiled with those config options enabled for some reason. My focus mostly was on getting graphical console on the U-Boot so that there is not need to use the serial debug simply to switch OSes ). The way it works currently is that the kernels for both Android and Ubuntu are loaded to the eMMC, then the userdata / rootfs are loaded to the SSD. That said, I could try to play with that for sure.
It would really be nice if there was an easy way to install OS on SSD drive,that would be a massive upgrade from the measly 128GB EMMC.
By the way I don't know if you have already figured this out but there is an easy way to install GAPPS without using the tedious method you used.
You simply patch boot.img with Magisk then use ADB to install it back to the unit. From there you can use Magisk to install Magisk GAPPS.
For the life of me I can't seem to figure out how to install GPS/GNSS drivers for Android. The stock firmwares provided by the vendor have GPS drivers but those stock firmware have 1920x1080 resolution whereas I want to use 3840x2160 screen.
One way of dealing with that is editing build.prop file in vendor folder which works but then the unit won't boot past boot screen when a patched boot.img is installed. so it is sort of catch 22.
qwestmogul2012 said:
It would really be nice if there was an easy way to install OS on SSD drive,that would be a massive upgrade from the measly 128GB EMMC.
By the way I don't know if you have already figured this out but there is an easy way to install GAPPS without using the tedious method you used.
You simply patch boot.img with Magisk then use ADB to install it back to the unit. From there you can use Magisk to install Magisk GAPPS.
For the life of me I can't seem to figure out how to install GPS/GNSS drivers for Android. The stock firmwares provided by the vendor have GPS drivers but those stock firmware have 1920x1080 resolution whereas I want to use 3840x2160 screen.
One way of dealing with that is editing build.prop file in vendor folder which works but then the unit won't boot past boot screen when a patched boot.img is installed. so it is sort of catch 22.
Click to expand...
Click to collapse
Thanks. Yes. I am currently working on trying to build up a software system that will enable proper booting from SSD "due to popular demand" from here (basically trying to modify the provided "RK U-Boot" and/or combine it with GRUB), however my progress has been set back after having lost the FIQ serial debug converter for my board and needing to get a new one. Also, I didn't know about that trick with Magisk, thanks! And when you say "won't boot past boot screen", what do you mean? Do you have any logs from the USB or from the FIQ serial stream for when that happens?
After the patched boot file is loaded back into the unit using ADB,the unit simply shows Firefly logo,the screen goes black then it shows the same logo,it never goes past that logo.
In other words I want a unit that has a patched boot file so that I can root it with Magisk and also have 4K resolution which only attainable by editing the build.prop file.
The root that is already in the stock firmware is inadequate because they lack SU binaries and therefore most apps that require root permission don't work effectively.
I have no way of generating logs,I don't have a serial debugger.
My goal is to have a simple Android system that I can install in my car with 4K portable screens and GPS.
I have tried the Android radios being sold out there and don't meet my needs for a system that can use 4K screens.They are still stuck in 1920x1080 or below resolution,not to mention that they can't play 4K video files without stuttering or freezing. They also lack storage that can store those large files.
qwestmogul2012 said:
After the patched boot file is loaded back into the unit using ADB,the unit simply shows Firefly logo,the screen goes black then it shows the same logo,it never goes past that logo.
In other words I want a unit that has a patched boot file so that I can root it with Magisk and also have 4K resolution which only attainable by editing the build.prop file.
The root that is already in the stock firmware is inadequate because they lack SU binaries and therefore most apps that require root permission don't work effectively.
I have no way of generating logs,I don't have a serial debugger.
My goal is to have a simple Android system that I can install in my car with 4K portable screens and GPS.
I have tried the Android radios being sold out there and don't meet my needs for a system that can use 4K screens.They are still stuck in 1920x1080 or below resolution,not to mention that they can't play 4K video files without stuttering or freezing. They also lack storage that can store those large files.
Click to expand...
Click to collapse
Wow, that is some really interesting use of this device. Are you able to capture anything via the debug serial interface? (TTL serial, port is called "DEBUG" on the board, it appears to be the preferred serial interface for this processor.) If you don't have a suitable TTL->USB converter, you might want to get one. It must be able to support 1500000 baud, though, so be careful to check. Firefly offers one, though I lost mine as I mentioned and I had to get another, though a different one so I can mount it permanently in the case and break out a back-of-the-case port.
If you can capture anything via the TTL serial line, that would be great. That should give you some idea of what it's choking on. Send me that just so I can think about it while I'm waiting on this.
I will definitely order one.I never thought I would hit such a roadblock.I have edited various kind of Android roms successfully.This one from Firefly though is something else.I suppose that is what happens when they make their work not open source.
By the way do you know how to unpack super.img? the unpack script provide does not recognize super.img even if I change the name to update.img
qwestmogul2012 said:
I will definitely order one.I never thought I would hit such a roadblock.I have edited various kind of Android roms successfully.This one from Firefly though is something else.I suppose that is what happens when they make their work not open source.
By the way do you know how to unpack super.img? the unpack script provide does not recognize super.img even if I change the name to update.img
Click to expand...
Click to collapse
Sorry for not responding sooner but I was diligently cracking away at this thing VERY much actually ... !!!
Ah yes, I think though I'm pretty close to getting it to work; most of the work so far has been in trying just to figure out how everything works given documentation is scant and I had never, ever worked with Android or anything else at this level before!
Very little of the material is not opensource - some of the tools required to generate the rockchip images does not appear to be and there are some binary-blob kernel drivers, but a LOT more than one thinks is; you just have to ask Firefly for the "board SDK" and they will provide on request. Other than what I mentioned, the code in there is pretty much all licensed under GPL (hence why they have to give you that code, given they've made kernel modifications to support the RK3588 - apparently mainstream support is coming along but is still not primetime yet).
Nonetheless, I see you've unpacked the Android image ROM, so perhaps you already have that - if so, great. Hence let's get to it (note maybe you know some of this already but I also want to make this post useful for as many people as possible): super.img - which I'm actually playing with right now - is not Firefly magic, but is generic Android and has been mentioned before on this forum if you search for "super.img" here. It's a "super partition" that contains partitions.
Editing system.img inside super.img and flashing our modifications
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then...
forum.xda-developers.com
To unpack it you need to grab OTA Tools:
[GUIDE] OTA Tools LPUnpack
Please see this URL https://android.googlesource.com/platform/build.git/+/eec4a7cba4face3370acb6293ab357879920b467 and this for more information. Hi everyone. I'm surprised I havent seen a thread about ota tools yet and lpunpack. This zip file...
forum.xda-developers.com
and the way to do this is you should first use the program simg2img, which actually ships with Ubuntu as a package of the same name I believe. Suppose you're in the Linux terminal and working in the directory containing super.img. Create (if you haven't already) a directory to unpack it, e.g.
Code:
mkdir super_unpack
Then use simg2img to get a "raw" version:
Code:
simg2img super.img super.img.raw
then finally use the OTATools (replace the string "/path/to/otatools" with whatever, or put them on your PATH, or ...)
Code:
/path/to/otatools/lpunpack super.img.raw super_unpack/
and now you should have it fully unrolled into smaller .img files which will ACTUALLY mount. In particular, I needed this because product.img specifically seems to be the best place to load GApps into - they will both come up on first Android boot and they will be retained if you do an Android system reset ("reset to factory defaults").
Now REPACKING super.img ... that's the fun part!
I had actually managed to find the instructions to unpack the super.img and also managed to mount vendor.img which is where I wanted to make changes in modifying the build.prop file.
After repacking the super.img and flashing it using fastboot the Android did not boot.
I also managed to incorporate the super.img to a ROM but the Android did not boot as well.
My thinking is that Android 12 being a Dynamic partitioned rom does not allow any modification in the root system and that is why I have not had success making the Android boot.
It used to be so easy to do that on Android 10 but Android 11 and 12 are not.
Well,if someone manages to do it,I hope to understand how they did it.
As of now I am pretty much stuck with a vanilla rom which is very disconcerting considering how expensive the ITX-3588J is.
By the way I already have SDK which I have been using to make roms.
Please let me know if you manage to boot the Android using a repacked super.img
As always I am very grateful for your assistance. Happy Ney Year!
qwestmogul2012 said:
I had actually managed to find the instructions to unpack the super.img and also managed to mount vendor.img which is where I wanted to make changes in modifying the build.prop file.
After repacking the super.img and flashing it using fastboot the Android did not boot.
I also managed to incorporate the super.img to a ROM but the Android did not boot as well.
My thinking is that Android 12 being a Dynamic partitioned rom does not allow any modification in the root system and that is why I have not had success making the Android boot.
It used to be so easy to do that on Android 10 but Android 11 and 12 are not.
Well,if someone manages to do it,I hope to understand how they did it.
As of now I am pretty much stuck with a vanilla rom which is very disconcerting considering how expensive the ITX-3588J is.
By the way I already have SDK which I have been using to make roms.
Please let me know if you manage to boot the Android using a repacked super.img
As always I am very grateful for your assistance. Happy Ney Year!
Click to expand...
Click to collapse
Thanks. I did not see any mention about build.prop, though maybe you dropped that on another thread that wasn't in my notifications anymore.
You say the "Android did not boot". Do you have a adb dump? Do you have a serial (UART) debug dump (i.e. through the FIQ port)? Also, how are you repacking super.img? It is a tricky process as I mentioned at the end.
I did mention build.prop editing on my second comment of this thread.I initially tried to use root explorer file manager,that did not work.Then attempted to pull file from the system using ADB,edited it on my computer then pushed the edited file back to the system.That did not work either.
That is when I resorted to trying to edit it by unpacking the super.img.
I am still waiting to receive USB SERIAL debugger.
As for how I unpacked and repacked the super.img I used the instructions on the thread on this link
Editing system.img inside super.img and flashing our modifications
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then...
forum.xda-developers.com
Maybe this helps: https://forum.xda-developers.com/t/linux-porting-native-linux-to-galaxy-note9.3936077/
Somebody ported Linux to the Galaxy Note 9.

Categories

Resources