[GUIDE] Changing the Bootloader Graphic - Samsung Galaxy S (4G Model)

WARNING: This guide involves modifying your phone's boot loader and may brick your phone if done incorrectly. It is most likely to soft brick your phone if something goes wrong, meaning it should be recoverable.
NOTE: This guide instructs how to replace the boot graphic in the boot loader but does not modify the kernel graphic. Doing this requires compiling the kernel.
Prerequisites:
Heimdall or Odin, with appropriate drivers. (The guide is for Heimdall)
A replacement.jpg graphic that is not greater than 68,849 bytes. The file should be 480x800.
A copy of param.lfs for your phone. This file is included in the Heimdall one-click packages, and probably other places.
Running Gingerbread bootloaders.
Steps:
Open both replacement.jpg and param.lfs in a hex editor.
Go to offset 532480 in param.lfs. At this location, there should be a JPG beginning of file (BOF) marker FF D8.
Verify that offset 601327 contains the JPG end of file (EOF) marker, FF D9. There are other JPG BOF and EOF markers between these two offsets because this JPG file contains embedded thumbnails for some stupid reason.
Go back to offset 532480. Use your hex editor to paste the contents of replacement.jpg into param.lfs at offset 532480 in overwrite mode. Use of overwrite mode will ensure that the file does not change size and other offsets are not affected. Use of a replacement.jpg less than 68,849 bytes ensures that other data within param.lfs is not overwritten.
Save new file as param2.lfs. Verify it is the same size as param.lfs
Heimdall:
Ensure that Heimdall, the Heimdall front-end, and appropriate drivers are installed.
Connect your phone via USB and start the Heimdall front-end.
Under the Utilities tab, click Save As and save your PIT as device.pit.
Click Download.
Under Flash tab, in the PIT subwindow, click Browse and select device.pit.
Click Add in the Partitions (Files) subwindow, and select PARAM from the Partition Details subwindow. NOTE: if you do not select the PARAM partition, there is potential to hard brick your device when you flash.
Click Browse in the File subwindow, and select your modified param2.lfs. NOTE: If your param2.lfs is corrupted, or if the flash otherwise fails, your device will be soft bricked and your device will be in download mode (although it will not have the familiar yellow screen). Attempt to reflash the PARAM partition with param.lfs.
Verify that PARAM is selected in the Partition Details subwindow. Click Start to flash param2.lfs with Heimdall to the PARAM partition.
Credit:
hexedit method: http://forum.xda-developers.com/showthread.php?t=1315401

These are some handy utility functions I wrote in Python.
This script finds most of the JPG files in param.lfs. It will choke on JPG files with embedded images.
Code:
import re
jpg = re.compile(b'\xff\xd8.*?\xff\xd9', re.DOTALL);
data = open('param.lfs','rb').read()
jpgs = re.findall(jpg, data)
for i,image in enumerate(jpgs):
open( str(i)+'.jpg', 'wb' ).write(image)
This lists all the JPG BOF and EOF file markers. Helps for spotting images with embedded thumbnails.
Code:
import re
import binascii
jpg = re.compile(b'\xff[\xd8\xd9]', re.DOTALL);
data = open('param.lfs','rb').read()
markers = re.findall(jpg, data)
for i, m in enumerate(markers):
print "%i: %s" % (i, binascii.hexlify(m))

An update to this post. I have written a script which is run on your desktop with a Python installation that perofrms the modification of the param.lfs binary. Attached to this post is a package containing (1) logoreplace.py, (2) param.lfs [from GB bootloader], (3) Sgs4g.pit [also from GB bootloader].
Also, I have attached a param_acid.lfs with the Team Acid logo. This will go well with your team acid kernels.
(1) ./logoreplace.py logo.jpg param.lfs
(2) adb reboot download
(3) Run heimdall-frontend
(4) Click "Flash" tab.
(5) Browse to Sgs4g.pit. Add.
(6) Select PARAM partition.
(7) Browse to param_acid.lfs
(8) Click "Start" to flash.
Here is the code:
Code:
#!/usr/bin/env python
import sys,os
if __name__ == "__main__":
if len(sys.argv) != 3:
print "Usage: %s <logo.jpg> <param.lfs>" % (sys.argv[0],)
else:
image = open(sys.argv[1],'rb').read()
fw = open(sys.argv[2],'rb+')
if len(image) <= 68849:
fw.seek(532480)
fw.write(image)
else:
print "Image file is too long. Must be <= 68849 bytes."

@tablador How do I use the script that performs the modification of the param.lfs binary (logoreplace.zip)?
I tired running the logoreplace.py after inserting my replacement.jpg in the directory on my phone and got:
Code:
/sdcard/logoreplace.py
import: not found
/sdcard/logoreplace.py 5:syntax error word unexpected (expecting ")")
I used both methods listed in the OP as well with no luck (Did not find the offsets mentioned in the first method and was a little lost on what to copy from the replacement.jpg).
I did read both OPs that you linked to in the credits.
I using the alternate method, I received an error when trying to copy replacement.jpg (In both ADB and Terminal):
Code:
cp: can't create '/mnt/.lfs/logo_T759.jpg': file exists
I am using vb final, and bh's rc1.

thomas.raines said:
@tablador How do I use the script that performs the modification of the param.lfs binary (logoreplace.zip)?
Click to expand...
Click to collapse
Are you running the script on your phone? The script runs on your desktop via Python. Sorry if that wasn't clear. Once you create the file, you flash it using Heimdall.
Also, I removed the alternate method information. As I noted, that method was untried and untested on this phone, and from what I can tell after trying it, does not seem to work. My best guess is that phone's bootloader has the offset of that information stored directly (e.g. bypasses the filesystem) so renaming the file does not work. OP all revised to reflect this.

Yes, I ran it in python. But it didn't change anything. I also renamed my image (replacement.jpg) to logo.jpg.
I added a raw_input() to see if I could see an error or something to indicate any kind of activity.
This is the output I got:
Code:
Usage: C:\Users\mydirectory\desktop\logoreplace\logoreplace.py <logo.jpg> <param.lfs>
Which is what you have set to print. Otherwise, there are no errors. I have my logo.jpg in the same directory as the logoreplace.py. What can I possibly be doing wrong?

How exactly are you running the script? And what OS?

tablador said:
How exactly are you running the script? And what OS?
Click to expand...
Click to collapse
Windows 7 (32)
I have double clicked on it, and tried running it manually using python.exe terminal and no errors. Am I suppose to copy my logo.jpg to /mtn/.lfs?
Would it be easier to just send you my logo and you could hook it up? lol...

How exactly are you running the script? If you don't tell me, I can't figure out what the problem is. Are you typing something into the commandline in windows? If so, what?

tablador said:
How exactly are you running the script? If you don't tell me, I can't figure out what the problem is. Are you typing something into the commandline in windows? If so, what?
Click to expand...
Click to collapse
I have tried typing the code you wrote in a python terminal for windows.
I have tried just running it by double clicking on it.
I just tried it in portable ubuntu by double clicking on it, but cannot get it to run (only open in text editor). I also changed it to open with python and I Usage: /home/pubunto/Desktop/logoreplace/logoreplace.py <logo.jpg> <param.lfs>.
I would think I would need to add my logo.jpg to .mnt/.lfs so it knew what image to look for.
I just tried running the logoreplace.py via pubuntu terminal. Here is the output:
Code:
[email protected]:/home/pubuntu/Desktop/logoreplace# ./logoreplace.py <logo.jpg> param.lfs
bash: ./logoreplace.py: Permission denied
[email protected]:/home/pubuntu/Desktop/logoreplace#

thomas.raines said:
I have tried typing the code you wrote in a python terminal for windows.
I have tried just running it by double clicking on it.
I just tried it in portable ubuntu by double clicking on it, but cannot get it to run (only open in text editor). I also changed it to open with python and I Usage: /home/pubunto/Desktop/logoreplace/logoreplace.py <logo.jpg> <param.lfs>.
I would think I would need to add my logo.jpg to .mnt/.lfs so it knew what image to look for.
I just tried running the logoreplace.py via pubuntu terminal. Here is the output:
Code:
[email protected]:/home/pubuntu/Desktop/logoreplace# ./logoreplace.py <logo.jpg> param.lfs
bash: ./logoreplace.py: Permission denied
[email protected]:/home/pubuntu/Desktop/logoreplace#
Click to expand...
Click to collapse
This is what you need to type:
Code:
./logoreplace.py logo.jpg param.lfs

tablador said:
This is what you need to type:
Code:
./logoreplace.py logo.jpg param.lfs
Click to expand...
Click to collapse
Yep. Just figured that out right after I sent the output. But now it change the param.lfs icon from a text icon to an blank icon with "usage" on the top. I flahsed it with heimdall which said heimdall crashed and got a oddly colorful strip on the top of the screen and now the phone is soft bricked... lol... I checked the size of my jpeg and see that it is 3 bytes over the allocated size...lol... Going to shrink it and try again... Will keep you posted...
EDIT
I got it to work! YAY!
Thanks for your help man!
The only thing, it displays before the normal boot splash logo (logo_vibrantplus.jpg). Is there a way to either replace logo_vibrantplus.jpg, or make it display after the default boot splash?

thomas.raines said:
Yep. Just figured that out right after I sent the output. But now it change the param.lfs icon from a text icon to an blank icon with "usage" on the top. I flahsed it with heimdall which said heimdall crashed and got a oddly colorful strip on the top of the screen and now the phone is soft bricked... lol... I checked the size of my jpeg and see that it is 3 bytes over the allocated size...lol... Going to shrink it and try again... Will keep you posted...
EDIT
I got it to work! YAY!
Thanks for your help man!
The only thing, it displays before the normal boot splash logo (logo_vibrantplus.jpg). Is there a way to either replace logo_vibrantplus.jpg, or make it display after the default boot splash?
Click to expand...
Click to collapse
That image is in the kernel. You would have to do your own compile. I know how to do it but it involves setting up a toolchain. I will make a guide when I have time...
Also, it is interesting that the script didn't give you an error when the filesize was bigger than it should have been. I will check that out.

tablador said:
That image is in the kernel. You would have to do your own compile. I know how to do it but it involves setting up a toolchain. I will make a guide when I have time...
Also, it is interesting that the script didn't give you an error when the filesize was bigger than it should have been. I will check that out.
Click to expand...
Click to collapse
Oh... I have no idea about setting up a toolchain or doing anything related to the kernel... yet...lol

thomas.raines said:
Oh... I have no idea about setting up a toolchain or doing anything related to the kernel... yet...lol
Click to expand...
Click to collapse
http://forum.xda-developers.com/wiki/Samsung_Galaxy_S/SGH-T959V/Building_From_Source

@FBis251 Thanks man, but still a little above my knowledge/experience level...lol...

I have attached a modified param.lfs file. I gzipped it. This should match the latest teamacid logo pretty well. Also attached is the jpg I used, which hopefully is viewable.

tablador said:
I have attached a modified param.lfs file. I gzipped it. This should match the latest teamacid logo pretty well. Also attached is the jpg I used, which hopefully is viewable.
Click to expand...
Click to collapse
not bad. gotta love plugins that modify already made images. plus if you're using team acid's latest kernel, you'll notice that they're already using the logo i made them.
sent from within pure darkness

tablador said:
I have attached a modified param.lfs file. I gzipped it. This should match the latest teamacid logo pretty well. Also attached is the jpg I used, which hopefully is viewable.
Click to expand...
Click to collapse
I was meaning to ask you for this. I really liked the video you linked us to on IRC. It makes it look so sleek.

droidmyst said:
not bad. gotta love plugins that modify already made images. plus if you're using team acid's latest kernel, you'll notice that they're already using the logo i made them.
sent from within pure darkness
Click to expand...
Click to collapse
This image will display for the one second or two before the kernel image you made loads up. Yep, used a simple Photoshop plugin because I am not much artistically inclined, at least with photoshop. Still, this kinda gives a fade-in effect when combined with your image used as the kernel image.
http://www.youtube.com/watch?v=kxBpKKDmnFY
FB, I was thinking this could be put into any one clicks you guys made if you wanted to get this in somewhere.

Related

[TOOL] Blob tools (Unpack/Repack)

Hey guys
Here are the tools used for the new root by Bumble-Bee & me!
https://github.com/AndroidRoot/BlobTools
The tools can unpack and repack blobs. Since the blob header is still not fully understood, repacking requires the original header from an existing blob file!
It is able to pack any number of partitions in a single blob (given it fits in the staging partition of course..around 500MB is the limit). The tool should be selfexplanatory from the output it gives if run without parameters, but I'll be happy to elaborate if needed.
Enjoy!
-RaYmAn
I'm trying to use this tool, but i need instruction
Fab985 said:
I'm trying to use this tool, but i need instruction
Click to expand...
Click to collapse
heh. Fair enough
First compile the tool (obviously)
[TO UNPACK]
Code:
./blobunpack /path/to/blob
This creates a number of files, in particular a blobname.HEADER file which contains the header of the blob (As mentioned in previous post). The remaining files are named the same as the partitions on the device, e.g. blob.LNX (boot.img) or blob.SOS (Recovery) or even blob.APP (system.img)
[TO PACK]
You need the blobname.HEADER file from the unpack step at this point.
If you want to make a blob with e.g. just boot.img you do the following:
Code:
./blobpack blobname.HEADER outputfile LNX boot.img
The above commands places the boot.img in the LNX partition using the previously extracted HEADER and creates a blob in "outputfile" ready to flash =P
If you wanted to create a blob with boot.img and recovery, you'd do
Code:
./blobpack blobname.HEADER outputfile LNX boot.img SOS recovery.img
I hope this helps
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Nice work, thank you for the instructions
i've successfully unpacked the rom now
It kinda just makes unexplained files, can we have any sort of tutorial as to how we might go about extracting them?
kevcube said:
It kinda just makes unexplained files, can we have any sort of tutorial as to how we might go about extracting them?
Click to expand...
Click to collapse
I guess you suck at reading more than 1 post.
kevcube said:
It kinda just makes unexplained files, can we have any sort of tutorial as to how we might go about extracting them?
Click to expand...
Click to collapse
blob.HEADER - Header stuff (ignore it)
blob.APP - system.img
blob.LNX - boot.img
blob.SOS - recovery.img (e.g. regular boot.img)
blob.EBT - bootloader.bin (ignore)
The system.img is ext4 and can be mounted as a loop fs in linux.
The rest of the files..well..If you don't know how to extract them, you have no use of these blob tools (*hint* http://github.com/AndroidRoot/BootTools)
Well that was kinda embarassing. I didn't feel like booting into ubuntu so I compiled and ran those tools in cygwin, and I didn't read the entirety of your explanation post.
To think I'm one of those people who gets really angry when I see others make that mistake..
Edit - just so you know I wasn't asking what to do with the source code, or how to get a blob. I just needed to know that whole ext4 image thing, and how it related to the blob.APP stuff.
Great thanks for the utility! I've just moved from TW SKU to US flashing LNX and APP from clockworkmod/adb.
So it seems the header (at least by terms of mdsum, not hex) changed for the 3.1 update.. Also 'unblobs' and has a blob.PT file, as in.. partition table..
LNX, EBT, SOS, APP, GP1, USP, MSC, CAC, PER, YTU, UDA, GPT, PT, BAK,
they also have some HSPA+ additions for their 3G/GSM model
Blades said:
So it seems the header (at least by terms of mdsum, not hex) changed for the 3.1 update.. Also 'unblobs' and has a blob.PT file, as in.. partition table..
LNX, EBT, SOS, APP, GP1, USP, MSC, CAC, PER, YTU, UDA, GPT, PT, BAK,
they also have some HSPA+ additions for their 3G/GSM model
Click to expand...
Click to collapse
So when you say the header has changed, you simply mean it's md5sum has changed? That's expected as the header is not neccessarily static. As long as the *format* of the header is the same, everything is good =P
The previous (full) updates also had a blob.PT containing all those partitions. Most of them are generated/maintained automatically by the bootloader however...
Thank you rayman84 your tools are as useful as their code is beautiful
Looks like an update is needed for the tf201 'blob'.
How do you get the boot.img and other .img files out of blob ?
use the unpack blob script as described on the first page.
SoCmodder said:
use the unpack blob script as described on the first page.
Click to expand...
Click to collapse
I get the LNX files, how do I get it out of them ?
StDevious said:
I get the LNX files, how do I get it out of them ?
Click to expand...
Click to collapse
the blob.LNX file is your boot.img. You can just rename it if that will make you feel better.
If you need to extract its contents, look for bootunpack.
daoist said:
the blob.LNX file is your boot.img. You can just rename it if that will make you feel better.
If you need to extract its contents, look for bootunpack.
Click to expand...
Click to collapse
I see, Thank you. I also have an .EBT file, what's that supposed to be ?
StDevious said:
I see, Thank you. I also have an .EBT file, what's that supposed to be ?
Click to expand...
Click to collapse
The .EBT file is a bootloader file. You can ignore that. You shouldn't need to do anything with it.
daoist said:
the blob.LNX file is your boot.img. You can just rename it if that will make you feel better.
If you need to extract its contents, look for bootunpack.
Click to expand...
Click to collapse
If using Linux, you can search for "unyaffs" it seems to work great for me.
Or just clone the git for BootUnpack. It works as well.

[Tutorial] How to port cf-root to other i9003 Firmwares [23/02/2012]

Tutorial for Porting Cf-root To Newer Firmware's
There were quite a few requests for a tutorial to create ginger bread cf-root. So here it is folks.
Big Thanks to skin1980 for helping me out.
Credits:
Chainfire for the cf-root.
Skin1980 for porting it to Samsung Galaxy SLCD.
Prerequisites:
Any Linux. Basic knowledge of linux is mandatory.
Tools for Unpacking and Packing images.
Base Samsung Galaxy SLCD Gingerbread Cf-root.
Samsung Galaxy SLCD Gingerbread Firmware ROM for cf-root creation.
Downloads & Setup
Any Linux: For this tutorial I am using Linux Mint KDE. You are free to use the Linux of your choice. Ideal starting point for downloading and installing Linux would be Distrowatch.com.
Tools for unpacking and packing images: These are sets of tools that allow you to unpack and pack boot images. Basically one requires just a few tools to achieve.
Link to Download: cfroot-tools.zip - 19 KB.
Download and exatract it into your home folder. It will create a cfroot-tools folder under home folder. Go to the folder and execute the following comand:
Code:
chmod +x *
Base Cf-root: Download any latest cf-root from this Link. Extract the normalboot.img from the cf-root tar file.
normalboot.img: Require normalboot.img extracted from downloaded Gb ROM.
Hex editor: You will require and Hex Editor. I am using bless hex editor. You can use any one which you are comfortable or the one available under your linux distribution.
Open terminal window and enter the following commands:
Code:
[FONT=Microsoft Sans Serif][SIZE=2]cd
[/SIZE][/FONT][FONT=Microsoft Sans Serif][SIZE=2]gedit ~/.bashrc[/SIZE][/FONT]
You can use any editor of your choice. The main purpose is to set the tools path. At the bottom of this file, add the following lines:
Code:
PATH=$HOME/cfroot-tools:$PATH
export PATH
Save and close the file.
Logoff from linux and login again for the new path to take effect.
The Actual Process
For the purpose of tutorial, I am going to use XXKPQ cf-root as the base and DDKP3 for creating new one.
Create a folder called “cfroot” with out the quotes under home.
Go to the created folder and create two more folders: DDKP3 and XXKPQ.
Now copy the normalboot.img extracted from XXKPQ cf-root and copy it into the XXKPQ folder. Next copy the normalboot.img fromDDKP3 firmware and copy it into DDKP3 folder.
Now go to the cfroot-tools folder under HOME and copy the decom.sh and recom.sh into XXKPQ and DDKP3 folders.
The above steps can be accomplished by the below code. Open command window and type the following:
Code:
cd
mkdir ~/cfroot
mkdir ~/cfroot/XXKPQ
mkdir ~/cfroot/DDKP3
cd ~/cfroot/XXKPQ
cp ~/cfroot-tools/*.sh .
chmod +x *.sh
cd ~/cfroot/DDKP3
cp ~/cfroot-tools/*.sh .
chmod +x *.sh
You need to press enter after each command.
From terminal window, first to change directory to XXKPQ, type the following commands:
Code:
cd ~/cfroot/XXKPQ
./decom.sh
After the execution of the above command, the following files and folders will be created:
normalboot.img-base
normalboot.img-cmdline
normalboot.img-pagesize
normalboot.img-ramdisk.gz => Ramdisk
normalboot.img-zImage => Kernel
Click to expand...
Click to collapse
Apart from these files, a folder called ramdisk will be created, into which the contents of normalboot.img-ramdisk.gz would have been extracted.
Now once more from the terminal window execute the following command:
Code:
cd ~/cfroot/DDKP3
./decom.sh
Also make note of the following values, which are shown, when the decom.sh script is executed.
Code:
BOARD_KERNEL_BASE 81800000
BOARD_PAGE_SIZE 00001000
Now under DDKP3 folder, edit the recom.sh file. Replace the value after --base with the value after BOARD_KERNEL_BASE. Replace the value after --pagesize with value after BOARD_PAGE_SIZE. Save the file.
Now we can switch to file manager. It will be easier to work using a file manager from here on. Open the XXKPQ/ramdisk and DDKP3/ramdisk folders separately in file manager.
Copy the folders res & sbin from base cf-root (XXKPQ in our case) and paste into DDKP3/ramdisk folder. Overwrite all when prompted.
Copy all the files under XXKPQ/ramdisk (in the root) to DDKP3/ramdisk.
From XXKPQ/ramdisk/lib/modules/2.6.35.7/kernel/ copy the fs folder into DDKP3/ramdisk/lib/modules/2.6.35.7/kernel/.
At this point of time, we no longer require the XXKPQ folder. So we can close the file manager window browsing XXKPQ folder.
Now comes the tricky and critical part. This must be done very carefully. We need to edit the .ko files using a hex editor.
Under the kernel/crypto/ folder, there is a pcbc.ko file, edit it using an hex editor. Search for 2.6.35.7 using find option in the editor. Now note down the six digit numbers starting immediately after 2.6.35.7-CL. In our case the magic number is 882023. Close the file and the editor.
Now we open the kernel/fs/ folder in the file manager.
Now open the mbcache.ko file in the hex editor. Search for 2.6.35.7 again. As we can see that the six digits after 2.6.35.7-CL is not 882023. In our case it is 709629. We need to change 709629 to 882023 and save the file. Different editors provide for different methods of editing. In my case I can just simply click on starting number that is 7 and start typing 882023 and save the file.
Now you need to do the same for two more files under kernel/fs/jbd2/ and kernel/fs/ext4/.
Now go back to ramdisk folder. Under ramdisk/sbin/boot/ there is a file called install.sh. We are now going to edit this file. This not important that you edit this file.
Edit the first line and replace XXKPQ with DDKP3.
Similarly under the “# Once be enough”, there is another XXKPQ which is to be replace with DDKP3.
Now save this file.
Now back to command prompt and execute the following commands:
Code:
cd ~/cfroot/DDKP3
./recom.sh
Executing the above script recreates the normalboot.img-ramdisk.gz, the normalboot.img and create DDKP3-CFROOT-16-02-2012.tar.
The DDKP3-CFROOT-16-02-2012.tar is the cf-root for DDKP3 and can be flashed using ODIN as Pda file.
*
Thats it folks. Hope my effort is worthwhile and benefits some of you.
*
Additional Links:
A text file Create Custom Rom (though not for our phone but is quite useful all the same) - Found it while searching google. Don't know who created it. But here is the link. Create_Custom_Rom.txt - 5 KB
The link to tools zip mentioned in the above text file. tools.tar.gz - 49 MB
Script to uncompress and compress UC Kernel
uc_decom.sh - 258 b
uc_recom.sh - 382 b
10 Chars ......
For Future Use
Whoa! This is huge! Awesomr work man! Thanks.
Edit - No offence meant, but it would be appropriate if the title is How to "port" or similar. Since it ws "created" by ChainFire and we just porting it.
ganeshbiyer is good, very patient, did not think that my trouble!
Has been helping me! Am very grateful!
great job! & i already translate it into chinese^^
and a problem:
after i run the script "decom.sh",it display following words:
[[email protected] xxkpq]# ./decom.sh
./decom.sh: line 5: unpackbootimg: command not found
gunzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] xxkpq]#
help me please~what's going on?
cRainin said:
great job! & i already translate it into chinese^^
and a problem:
after i run the script "decom.sh",it display following words:
[[email protected] xxkpq]# ./decom.sh
./decom.sh: line 5: unpackbootimg: command not found
gunzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] xxkpq]#
help me please~what's going on?
Click to expand...
Click to collapse
unpackbootimg must be in the path.
also it must be executable.
ganeshbiyer said:
unpackbootimg must be in the path.
also it must be executable.
Click to expand...
Click to collapse
sorry,i paste the wrong code. my problem is this:
[[email protected] XXKPQ]$ ./decom.sh./decom.sh: /home/chenyu/cfroot-tools/unpackbootimg: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
gzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] XXKPQ]$
cRainin said:
sorry,i paste the wrong code. my problem is this:
[[email protected] XXKPQ]$ ./decom.sh./decom.sh: /home/chenyu/cfroot-tools/unpackbootimg: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
gzip: ../normalboot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
[[email protected] XXKPQ]$
Click to expand...
Click to collapse
Need to install the missing file ld-linux.so.2
Sent from my GT-I9003 using xda premium
Thank you Ganeshbiyer! this is the tutorial for which send multiple private messages and never answered .. Thanks again, nowI can make a version for Gingerbread UBKPD.
goodbye
Yeah ganesh! A superb work..well done bro
thanks bhaiya....
Thanks for the tutorial buddy
Hope it has been useful.
_
Release all PERFECT! I had no problem in making the entire guide .. BUT ... when flashing in ODIN, and says that when it failed to finish.
I knew that I would be so easy, so I started to analyze both folders (my UBKPD and XXKPQ) and did not get that at the root of KPD I have 12 files and only 11 KPQ. The 12th file executable type KPD called RECOVERY. This file should remove it before using recom.sh?
Thanks again for the guide. goodbye
Edit2:
Well, my little patience led me to delete that file and then went back to RECOVERY recom.sh run and throw me error that could not erase normalboot.img and did not understand, but looking at the files in the root, not the size you normalboot.img was higher than the stock then replace the stock normalboot (+5 mb), run again and finally he created recom.sh cf.root, I flash with ODIN successfully without any problem in these +30 minutes.
Thanks (again).
Now I have as including UV & OC (freqmax 1100MHz is very good speed and would think you do not need more with this phone)
maybe a stupid question:
would it work with other phones as well? natually with the files of the other phone and not with the 9003 files
fabsau said:
maybe a stupid question:
would it work with other phones as well? natually with the files of the other phone and not with the 9003 files
Click to expand...
Click to collapse
Well you can always try
thanks for your reply
I will try it soon^^
wait for my next reply
greetings fabsau
i do it all at this tutorial and it create .tar fine without trouble.. i flash with odin also no problem happen.. but while device open.. at boot logo get stuck or freeze at long time.. why it happen???
i confuse with this line:-
-Copy the folders res & sbin from base cf-root (XXKPQ in our case) and paste into DDKP3/ramdisk folder. Overwrite all when prompted.
-Copy all the files under XXKPQ/ramdisk (in the root) to DDKP3/ramdisk.
-From XXKPQ/ramdisk/lib/modules/2.6.35.7/kernel/ copy the fs folder into DDKP3/ramdisk/lib/modules/2.6.35.7/kernel/
Click to expand...
Click to collapse
why do not copy all the file in ramdisk n skip copy file inside the ramdisk folder.. it is difference?? please tell me if i do a mistake.

[TOOL] Boot.img tools [unpack, repack, ramdisk]

I have not seen this posted anywhere, so I thought I would post it here. This is NOT purely my work, and I do not take credit for it as such.
Included in the attached ZIP are the following files:
boot_info - prints information about the boot.img passed to it, including the base address and ramdisk address. This tool prints out everything needed to repack the boot.img correctly.
split_boot - More commonly known as split_bootimg.pl, this rips apart the boot.img to extract the ramdisk and zImage. It has been modified by me to split the boot.img into a separate folder (specified by the file name of the boot.img passed to it) and to extract the ramdisk into a sub-folder as well (extracts the cpio from the gz and then extracts the actual files from the cpio archive)
unpack_ramdisk - unpacks the given ramdisk file.
Code:
Usage: unpack_ramdisk <ramdiskFile>
repack_ramdisk - repacks the ramdisk from the given directory (found online and modified slightly to take a directory)
Code:
Usage: repack_ramdisk <ramdiskDirectory> [outputFile]
mkbootimg - mkbootimg binary that creates a boot.img file from the given ramdisk and zImage. Updated to a version compiled by me to support the --ramdiskaddr option (ramdisk address) so that even nonstandard boot.img's can be repacked correctly (Use with boot_info for best results).
umkbootimg - included for convenience. Not made by me. Original thread here.
unpack - wrapper script made by me for the umkbootimg binary^ to unpack the boot.img into a separate directory and then unpack the ramdisk into a sub-directory.
Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.
ANYONE is free to use / modify / kang these files as they see fit. No need to ever ask or do anything more than download.
Enjoy.
UPDATE: If you downloaded, please redownload. There was an error with my repack_ramdisk script, but it's fixed now.
Updated tools with a new boot_info script, also added my own mkbootimg binary compiled with the ramdisk address option.
Boot_info now displays the following information:
Commandline
Pagesize
Base address
Ramdisk address.
Which is everything you need to make a functional boot.img, even when the original boot.img is packed with a non-standard mkbootimg (ie, the ramdisk offset is different than the normal offset).
How exactly do we use these files to unpack and repack?
I've tried running the scripts with chmod at 755 but it doesn't work.
I am i missing something?
All the scripts must be in a folder in your path (~/bin for example)
Then it should work, because they call on each other. I keep all of them in my ~/bin folder, but they can be anywhere in your PATH
Sent from my buttered S3
if Android Magic Word not found at offset 0, it fail.
twins.7 said:
if Android Magic Word not found at offset 0, it fail.
Click to expand...
Click to collapse
No, if you use unmkbootimg instead split_boot, it also finds embedded images.
CNexus said:
No, if you use unmkbootimg instead split_boot, it also finds embedded images.
Click to expand...
Click to collapse
OK, it work. But .... sorry to much complain
My boot.img has magic word in offset 2048. so it mean, there is additional header in first 2048 byte.
umkbootimg succesfully extract embedded boot.img, but in repacking, I lost the first 2048 byte, because magic header placed in offset 0.
Actually, what is the additional header for? really asking...
I fail to fastboot flash if the image have no additional header.
And it will fail to verify, if the additional header is wrong. or is it called signed boot.img?
If I change the content of boot.img, I can't flash it to device. It always said verify fail. I though, the additional header has CRC or hash or anything.
If you have spare time and want to help me, I'll post my image
Thanks for this tools
Send from my AMOI N828 using Xda Premium
twins.7 said:
OK, it work. But .... sorry to much complain
My boot.img has magic word in offset 2048. so it mean, there is additional header in first 2048 byte.
umkbootimg succesfully extract embedded boot.img, but in repacking, I lost the first 2048 byte, because magic header placed in offset 0.
Actually, what is the additional header for? really asking...
I fail to fastboot flash if the image have no additional header.
And it will fail to verify, if the additional header is wrong. or is it called signed boot.img?
If I change the content of boot.img, I can't flash it to device. It always said verify fail. I though, the additional header has CRC or hash or anything.
If you have spare time and want to help me, I'll post my image
Click to expand...
Click to collapse
I'm not sure. No tool will work for all devices, and since I've never had a device that has this special packing, it would be best if you asked one of your kernel devs for help unpacking/repacking
CNexus said:
I'm not sure. No tool will work for all devices, and since I've never had a device that has this special packing, it would be best if you asked one of your kernel devs for help unpacking/repacking
Click to expand...
Click to collapse
ok thank's
CNexus said:
I have not seen this posted anywhere, so I thought I would post it here. This is NOT purely my work, and I do not take credit for it as such.
Included in the attached ZIP are the following files:
boot_info - prints information about the boot.img passed to it, including the base address and ramdisk address. This tool prints out everything needed to repack the boot.img correctly.
split_boot - More commonly known as split_bootimg.pl, this rips apart the boot.img to extract the ramdisk and zImage. It has been modified by me to split the boot.img into a separate folder (specified by the file name of the boot.img passed to it) and to extract the ramdisk into a sub-folder as well (extracts the cpio from the gz and then extracts the actual files from the cpio archive)
unpack_ramdisk - unpacks the given ramdisk file.
Code:
Usage: unpack_ramdisk <ramdiskFile>
repack_ramdisk - repacks the ramdisk from the given directory (found online and modified slightly to take a directory)
Code:
Usage: repack_ramdisk <ramdiskDirectory> [outputFile]
mkbootimg - mkbootimg binary that creates a boot.img file from the given ramdisk and zImage. Updated to a version compiled by me to support the --ramdiskaddr option (ramdisk address) so that even nonstandard boot.img's can be repacked correctly (Use with boot_info for best results).
umkbootimg - included for convenience. Not made by me. Original thread here.
unpack - wrapper script made by me for the umkbootimg binary^ to unpack the boot.img into a separate directory and then unpack the ramdisk into a sub-directory.
Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.
ANYONE is free to use / modify / kang these files as they see fit. No need to ever ask or do anything more than download.
Enjoy.
Click to expand...
Click to collapse
is it possible to make these run on the device?
i have tried
adb root
adb remount
adb push * /sdcard/tmp/
adb push * /system/xbin/
adb push * /system/bin/
adb shell
cd /sdcard/tmp/
for f in $(ls)
do
chmod 755 /system/bin/$f
chmod 775 /system/xbin/$f
done
cd /
rm -r /sdcard/tmp
cd /sdcard/working
split_bootimg.pl boot.img
returns "Permission denied"
hmmmmm???????? what could be the problem????????
ricky310711 said:
is it possible to make these run on the device?
i have tried
adb root
adb remount
adb push * /sdcard/tmp/
adb push * /system/xbin/
adb push * /system/bin/
adb shell
cd /sdcard/tmp/
for f in $(ls)
do
chmod 755 /system/bin/$f
chmod 775 /system/xbin/$f
done
cd /
rm -r /sdcard/tmp
cd /sdcard/working
split_bootimg.pl boot.img
returns "Permission denied"
hmmmmm???????? what could be the problem????????
Click to expand...
Click to collapse
The Perl script should work if you have Perl (compiled for ARM x86) on your device.
The binaries will not work as they are not compiled for ARM. The scripts (at least some of them) should work if you change all instances of "#!/bin/bash" and "#!/usr/bin/env bash" to "#!/system/bin/sh".
CNexus said:
The Perl script should work if you have Perl (compiled for ARM x86) on your device.
The binaries will not work as they are not compiled for ARM. The scripts (at least some of them) should work if you change all instances of "#!/bin/bash" and "#!/usr/bin/env bash" to "#!/system/bin/sh".
Click to expand...
Click to collapse
will see if i can get it working tonight! this could be pretty good if i can get it to unpack on device!
ricky310711 said:
will see if i can get it working tonight! this could be pretty good if i can get it to unpack on device!
Click to expand...
Click to collapse
No need...download this zip and extract http://www12.zippyshare.com/v/37266634/file.html
It already contains an unmkbootimg binary compiled for ARM. Then you would just need to unpack the ramdisk to finish it off.
CNexus said:
No need...download this zip and extract http://www12.zippyshare.com/v/37266634/file.html
It already contains an unmkbootimg binary compiled for ARM. Then you would just need to unpack the ramdisk to finish it off.
Click to expand...
Click to collapse
no way, ive been looking for something like this for ages, who is the author?
ricky310711 said:
no way, ive been looking for something like this for ages, who is the author?
Click to expand...
Click to collapse
I don't know who originally compiled that unmkbootimg binary for ARM.
CNexus said:
I don't know who originally compiled that unmkbootimg binary for ARM.
Click to expand...
Click to collapse
hmm, gotta findout! i wanna use it in my tool!
Is this boot.img tool compatible with Microsoft windows as well?
Sent from my SPH-L710 using XDA Premium 4 mobile app
shakim24 said:
Is this boot.img tool compatible with Microsoft windows as well?
Sent from my SPH-L710 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Read the OP.

[Q] IMEI Repair

I own the D-820 model of the phone. I was trying to change the PRL, and the IMEI is showing up as 0 now.
Having said that, I flashed the kernel with diagnostic mode enabled and installed LG United drivers. I was successful at getting the device SPC. Using DFS, I was able to change the "Ruim mode" as well. The changes got successfully written so far. Changing PRL screwed up the IMEI.
Ever since, I've been trying to set ESN, MEID and IMEI using DFS, CDMADevTerm, QPST NV Manager, and EFS Pro (Qualcomm NV Tools). All fail (the IMEI reverts to 0; the original IMEI does not get written back).
I have even tried changing the connection mode in Qualcomm NV Tools (EFS Pro) to factory test mode, before writing. It results in "Unknown" baseband and blank IMEI (upon dialing *#06# on the phone). "Low power" connection mode also fails to write the IMEI back.
I've read the MEID fields are secured in some way. Anybody have any pointers to make it work?
By the way, the phone accepts any 16-digit diagnostic password in the aforementioned tools. I've been told it may not apply to phones other than Samsung devices. Could it be possible the phone is waiting for the correct 16-digit password to "unlock" the MEID fields, and simply accepts other passwords but does NOT unlock the fields?
I have also tried flashing stock firmware, and it appears it wasn't the case where phone is not able to read the stored IMEI.
Anybody have any clues about the security used?
Writing IMEI isn't allowed to discuss over here since it's illegal. Just send it to a LG center and let them write it for you.
May be @bitdomo can help you will the partition/security query you've got
halfbytecode said:
Anybody have any clues about the security used?
Click to expand...
Click to collapse
I am not familiar with efs yet.
Maybe try to follow the guide about fix imei on lg g2. It could serve as a good base. http://forum.xda-developers.com/showthread.php?t=2701861
If you have a backup of your efs before you started editing the nvitems then restore it. It is important to make efs backup before you start to play with those kind of efs tools.
vin4yak said:
Writing IMEI isn't allowed to discuss over here since it's illegal. Just send it to a LG center and let them write it for you.
May be @bitdomo can help you will the partition/security query you've got
Click to expand...
Click to collapse
I'm just trying to fix my device here on my own, by writing back the IMEI found on my phone's sim tray, box, etc. I'm kind of broke these days, so it's hard.
bitdomo said:
I am not familiar with efs yet.
Maybe try to follow the guide about fix imei on lg g2. It could serve as a good base. http://forum.xda-developers.com/showthread.php?t=2701861
If you have a backup of your efs before you started editing the nvitems then restore it. It is important to make efs backup before you start to play with those kind of efs tools.
Click to expand...
Click to collapse
I had indeed tried out NV Manager in QPST, but it failed to write to item number 550 (IMEI).
In fact I found this exact same guide and a bunch of others too.
I'm kind of surprised it works on LG g2 and not for me on nexus 5.
Could it be possible the diagnostic mode that was enabled by modifying the kernel (found here on XDA) didn't enable it fully?
halfbytecode said:
I'm just trying to fix my device here on my own, by writing back the IMEI found on my phone's sim tray, box, etc. I'm kind of broke these days, so it's hard.
I had indeed tried out NV Manager in QPST, but it failed to write to item number 550 (IMEI).
In fact I found this exact same guide and a bunch of others too.
I'm kind of surprised it works on LG g2 and not for me on nexus 5.
Could it be possible the diagnostic mode that was enabled by modifying the kernel (found here on XDA) didn't enable it fully?
Click to expand...
Click to collapse
It could be. What if we find a lg g2 as a donor. You flash the efs from your nexus to lg g2 and try to fix it, then if it worked you move the fixed efs from lg g2 back to nexus 5.
Nexus 5 has a second recovery it is on the LAF partition, this is called download mode. By exteacting the ramdisk of it I found traces that it could be used with qpst. To enable it I have to edit the ramdisk. The file which have to be edited is usb.init.rc or something similar. I dont remember well.
I can extract ramdisk and change the content, but I dont know the command parameters for put the kernel image and the ramdisk together as a whole boot.img
bitdomo said:
It could be. What if we find a lg g2 as a donor. You flash the efs from your nexus to lg g2 and try to fix it, then if it worked you move the fixed efs from lg g2 back to nexus 5.
Nexus 5 has a second recovery it is on the LAF partition, this is called download mode. By exteacting the ramdisk of it I found traces that it could be used with qpst. To enable it I have to edit the ramdisk. The file which have to be edited is usb.init.rc or something similar. I dont remember well.
I can extract ramdisk and change the content, but I dont know the command parameters for put the kernel image and the ramdisk together as a whole boot.img
Click to expand...
Click to collapse
I'm not really sure where I could find a donor g2. The plan could work though.
The boot IMG with diag mode is on page 3 here http://forum.xda-developers.com/showthread.php?t=2535478 if you want to look.
I may be able to figure out how to put ramdisk together with the zimage (of the diag mode kernel above). I've analyzed some kernels which do it using updater-script. In the past I've also used tools like android kitchen (not sure about the exact name).
@bitdomo Are you referring to this file?
https://android.googlesource.com/device/lge/hammerhead/+/kitkat-release/init.hammerhead.usb.rc
halfbytecode said:
I'm not really sure where I could find a donor g2. The plan could work though.
The boot IMG with diag mode is on page 3 here http://forum.xda-developers.com/showthread.php?t=2535478 if you want to look.
I may be able to figure out how to put ramdisk together with the zimage (of the diag mode kernel above). I've analyzed some kernels which do it using updater-script. In the past I've also used tools like android kitchen (not sure about the exact name).
Click to expand...
Click to collapse
hm... comparing the laf ramdis and the diag enabled ramdisk I have to say that I was wrong, but still this is a interesting thing in the init.laf.usb.rc file:
# it can run as user cable for QCT PID
on property:ro.boot.laf=QCOM
wait /sys/class/android_usb/android0/enable
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 05C6
write /sys/class/android_usb/android0/idProduct 903A
write /sys/class/android_usb/android0/f_acm/acm_transports tty
write /sys/class/android_usb/android0/f_diag/clients diag
write /sys/class/android_usb/android0/functions mtp,laf
write /sys/class/android_usb/android0/enable 1
Click to expand...
Click to collapse
What could this QCT PID be? I thought these are the lines for teh diag mode.
Here is the laf image with extracted ramdisk and some from here to build the kernel
You could also try this early key lime pie rom. This is an internal test version of android 4.4 from september or august. Maybe this kernel can be used to enable diag mode. If I remember well it may have an app called hidden menu where you can change the usb port settings so you dont need root an use adb commands. Before you flash it backup you misc partition because at the first booting this rom will change the device factory version string on the misc partition to something else which will cause cause that LG flashtool will stop wokring for you device unless you change that string back from "FACTORY" to "USER"
to backup your misc: dd if=/dev/block/platform/msm_sdcc.1/by-name/misc of=/sdcard/misc.img
from your sdcard copy it to you pc just for safety reasones
To return to stock flash back any stock rom from google then restore your misc partition using this command:
dd if=/sdcard/misc.img of=/dev/block/platform/msm_sdcc.1/by-name/misc
Well that is really intriguing. I was oblivious to the laf mode. I did know about .tot files and lg flash tool, but nothing more than that.
I see laf has seprate a kernel and a ramdisk, which is what you were talking about all along. It makes sense to me now.
I will give this a shot when I have some free time on my hands and will let you know.
Thanks for the key lime pie leak too!
halfbytecode said:
Well that is really intriguing. I was oblivious to the laf mode. I did know about .tot files and lg flash tool, but nothing more than that.
I see laf has seprate a kernel and a ramdisk, which is what you were talking about all along. It makes sense to me now.
I will give this a shot when I have some free time on my hands and will let you know.
Thanks for the key lime pie leak too!
Click to expand...
Click to collapse
I already extracted it for you, the original laf is the "laf.img" everything is untouched.
bitdomo said:
I already extracted it for you, the original laf is the "laf.img" everything is untouched.
Click to expand...
Click to collapse
Yes I will give that a shot soon and see what happens. Thanks for the help so far.
@bitdomo I modified the file that you mentioned, swapping USER and QCOM lines. Repacked the ramdisk, and then put together the laf image by supplying the base address, ramdisk address, command line value and page size from the the original laf dump. I flashed it on my phone using Terminal Emulator using the following command:
Code:
dd if=/sdcard/laf1.img of=/dev/block/platform/msm_sdcc.1/by-name/laf
Now when I connect the phone in download mode, the phone is stuck at the tiny "Download Mode" logo and windows does not detect any USB device.
Further, I observed the original dump size is 22 MB and the repacked laf image size is merely 13.2 MB. The size of the extracted kernel and ramdisk sums up to 13.2 MB.
It gets me to think these tools are missing out on the remaining stuff in the laf image. Ive uploaded the modified laf image. https://www.sendspace.com/file/f31xi1
I didn't read these posts just wanted to share my experience...
This happened to me 2x months and months ago ( lost Imei) I don't remember what I was doing to cause it but the only thing that fixed it for me was my TWRP backup . my backup efs file did nothing factory IMG did nothing and everything else I tries did nothing . agn this probably helps u NONE but wanted share anyways ...
Tampering with the imei is illegal
Sent from my Nexus 5
drawde40599 said:
I didn't read these posts just wanted to share my experience...
This happened to me 2x months and months ago ( lost Imei) I don't remember what I was doing to cause it but the only thing that fixed it for me was my TWRP backup . my backup efs file did nothing factory IMG did nothing and everything else I tries did nothing . agn this probably helps u NONE but wanted share anyways ...
Click to expand...
Click to collapse
Yes, it may help someone reading this thread.
dicecuber said:
Tampering with the imei is illegal
Sent from my Nexus 5
Click to expand...
Click to collapse
Just trying to restore the IMEI. I'm not attempting to do something illegal.
halfbytecode said:
@bitdomo I modified the file that you mentioned, swapping USER and QCOM lines. Repacked the ramdisk, and then put together the laf image by supplying the base address, ramdisk address, command line value and page size from the the original laf dump. I flashed it on my phone using Terminal Emulator using the following command:
Code:
dd if=/sdcard/laf1.img of=/dev/block/platform/msm_sdcc.1/by-name/laf
Now when I connect the phone in download mode, the phone is stuck at the tiny "Download Mode" logo and windows does not detect any USB device.
Further, I observed the original dump size is 22 MB and the repacked laf image size is merely 13.2 MB. The size of the extracted kernel and ramdisk sums up to 13.2 MB.
It gets me to think these tools are missing out on the remaining stuff in the laf image. Ive uploaded the modified laf image. https://www.sendspace.com/file/f31xi1
Click to expand...
Click to collapse
@bitdomo I compared the original laf dump and my modified image using a hex editor.
Just as I had suspected, the original dump is padded with zeros. Disregarding that, their actual size looks similar.
So I take back what I said about the tools not being able to extract from the laf image completely.
Do you know what could be the issue here?
EDIT: There was an interesting tidbit from unmkbootimg output. (The full command line output is attached with this post, ramdisk was repacked separately using the tool in the package - not in the output)
Code:
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0xFD908100
OFF_RAMDISK_ADDR is 0x00200100
OFF_SECOND_ADDR is 0xFE800100
Please modify mkbootimg.c using the above values to build your image.
****************
Could compiling mkbootimg with the above be of any help, since the mkbootimg had been modified to include ramdisk address parameter in the links you posted?
halfbytecode said:
@bitdomo I compared the original laf dump and my modified image using a hex editor.
Just as I had suspected, the original dump is padded with zeros. Disregarding that, their actual size looks similar.
So I take back what I said about the tools not being able to extract from the laf image completely.
Do you know what could be the issue here?
EDIT: There was an interesting tidbit from unmkbootimg output. (The full command line output is attached with this post, ramdisk was repacked separately using the tool in the package - not in the output)
Code:
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0xFD908100
OFF_RAMDISK_ADDR is 0x00200100
OFF_SECOND_ADDR is 0xFE800100
Please modify mkbootimg.c using the above values to build your image.
****************
Could compiling mkbootimg with the above be of any help, since the mkbootimg had been modified to include ramdisk address parameter in the links you posted?
Click to expand...
Click to collapse
what was the command you used to put the kernel and the modified ramdisk together?
halfbytecode said:
Yes, it may help someone reading this thread.
Just trying to restore the IMEI. I'm not attempting to do something illegal.
Click to expand...
Click to collapse
U no what I just remembered how I lost my IMEI back then . I was updating to 4.4.3 from factory .IMG and did the command "Fastboot wipe cache" after fastbooting the system.IMG . ( I no it makes no sense) but that's how mine was lost . now I just Fastboot system.IMG with new updates no wipe cache and works perfect . but ya a restore of TWRP was only thing that fixed it .
bitdomo said:
what was the command you used to put the kernel and the modified ramdisk together?
Click to expand...
Click to collapse
I used
Code:
mkbootimg --kernel laf_dump.img-kernel --ramdisk new-ramdisk.cpio.gz --base 0x026fff00 --cmdline '"console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 maxcpus=2 msm_watchdog_v2.enable=1"' --pagesize 2048 --ramdiskaddr 0x02900000 -o laf_q_mod_3.img
Just a note, this is the modified mkbootimg which has "ramdiskaddr" parameter (from the thread you linked to in one of your previous posts). Version shipped with bbqlinux distribution has "ramdisk_offset" instead. The original version does not have either, as you may know.

[Utility] Odin for Linux !!! (JOdin3 CASUAL)

I have finally found a working version of Odin for Linux!
JOdin 3 Casual powered by Heimdall
You need at least Java 8, if you don't have it already:
To see the java version type:
Code:
java -version
Aptitude Package Manager:
Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java9-installer
If necessary change the java environment to the new one(this should be changed automatically by the installer of the new package):
Code:
sudo update-alternatives --config java
JOdin3 Mirrors:
mega.nz
androidfilehost.com
FYI:
{
"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"
}
__________________
Thanks I am new to this and not a developer. I have downloaded Jodin3 files but how do I install please? Thanks Hugo
iamhugo said:
Thanks I am new to this and not a developer. I have downloaded Jodin3 files but how do I install please? Thanks Hugo
Click to expand...
Click to collapse
Download jdoin .gz file, decompress it to your directory you want e.g /home/username/programs/jodin/
than right click on the file "JOdin3CASUAL" and open it, if you have installed java 8.
i need take smilock this program will be good?
Okay, so, I have to ask. Why does this program need super user authentication? I don't understand why it needs that level of access if it's just for flashing the ROM on a cellphone. I'm just saying that's unrelated to needing root access on my computer, I think.
Zakku said:
Okay, so, I have to ask. Why does this program need super user authentication? I don't understand why it needs that level of access if it's just for flashing the ROM on a cellphone. I'm just saying that's unrelated to needing root access on my computer, I think.
Click to expand...
Click to collapse
I am not 100% shure but I think it has something to do with access to the usb port... Odin needs permission to use the port for other things than mounting a flash drive... Again im not shure, haven't looked into it much. Since the adb cli also need root permissions I think that odin also really needs higher permissions.
Toby4213 said:
I am not 100% shure but I think it has something to do with access to the usb port... Odin needs permission to use the port for other things than mounting a flash drive... Again im not shure, haven't looked into it much. Since the adb cli also need root permissions I think that odin also really needs higher permissions.
Click to expand...
Click to collapse
IT is quite common, Xiaomi also needs sudo to work
.
Looks like Oracle not supporting Java 9 through PPA
I downloaded files and it looks like "old" version
Can someone explain to me how to get "new" version because I am trying to install firmware on Note9
I just spent 4 hours looking through youtube and the web trying to get the "new" version of jodin.
ty for any help given.
Why odin needs su access
Odin needs su access because the underlying adb shell needs root to execute programs on the device itself, which Odin will need to do in order to perform the update/root procedure. I'm not an advanced android engineer, but I know linux well enough to know running arbitrary code on an attached peripheral is a security hole and should not be run unless one knows what they are doing (hence needing su, since admins are the ones that should know if a program is malicious)
Hi! Can this be installed on Arm64, specifically through a containerized instance of linux? Asking for a friend!
[UPDATE]
OK, so to explain the reasoning behind the question... I've been trying to explain to this dude why this won't work but he refuses to listen because odin is in the linux repositories despite the software description saying something about MRI machines. He now finally after a couple hours understands the difference between that odin and this odin. FINALLY.
He wants to run this odin on his TabS4 through linux on dex in order to flash his note 9... I know... I tried... Maybe someone here can explain it better to him, I have him keeping an eye on these comments.
phoenixbyrd said:
Hi! Can this be installed on Arm64, specifically through a containerized instance of linux? Asking for a friend!
[UPDATE]
OK, so to explain the reasoning behind the question... I've been trying to explain to this dude why this won't work but he refuses to listen because odin is in the linux repositories despite the software description saying something about MRI machines. He now finally after a couple hours understands the difference between that odin and this odin. FINALLY.
He wants to run this odin on his TabS4 through linux on dex in order to flash his note 9... I know... I tried... Maybe someone here can explain it better to him, I have him keeping an eye on these comments.
Click to expand...
Click to collapse
I highly doubt that this would work for the sole reason that odin and for that matter fastboot and adb, need OS level access to the usb controller. DeX in desktop mode would take up the only available usb-c port, this would be a problem since on pc you need to connect the phone directly to the mainboard on the pc instead of using a usb hub. Without the docking station this *might* work but then again I doubt that the linux container has enought OS level permissions to use the usb port in that way. On the bright side, arm64 shouldn't be a problem since java is also available on arm. This means that the odin .jar should be able to run and show the gui but flashing wouldn't be possible but you could give it a try. If odin doesn't work try fastboot on android(not in DEX), links below.
That said there are other ways of getting phone to phone flashing to work. Here are some links:
https://forum.xda-developers.com/showthread.php?t=2586472
https://github.com/kosborn/p2p-adb/
With fastboot you could flash twrp and with that could flash root and custom roms and so on. This nowadays is the preferred method anyway, since you wouldn't depend on a usb cable to f*** up the rom flash.
Using JOdin3 with 'sudo' shows 'java.lang.OutOfMemoryError: Java heap space'
These are recommendations I'd found:
Heap size specifies the amount of dynamic memory to be made available to the JVM code.
For systems with less than 1 GB of physical memory, use a maximum heap size of 256 MB, and an initial heap size of 0 MB.
For systems with 2 GB memory, use a maximum heap size of 768 MB, and an initial heap size of 256 MB.
For larger systems (more than 2GB), use a maximum heap size of 1024 MB, and an initial heap size of 512 MB.
Is that also suitable for JOdin3?
This is the current error I've got:
Exception in thread "Thread-78" java.lang.OutOfMemoryError: Java heap space
at CASUAL.communicationstools.heimdall.odin.OdinFile.extractOdinContents(OdinFile.java:145)
at CASUAL.communicationstools.heimdall.odin.Odin.getHeimdallFileParametersFromOdinFile(Odin.java:50)
at com.casual_dev.jodin.JOdinController.getHeimdallCommandFromOdinPackageList(JOdinController.java:621)
at com.casual_dev.jodin.JOdinController.access$3300(JOdinController.java:54)
at com.casual_dev.jodin.JOdinController$13.run(JOdinController.java:572)
at java.lang.Thread.run(Thread.java:745)
How do I edit the 'heap space' settings for JOdin3 in Linux Mint 19.1?
Toby4213 said:
I have finally found a working version of Odin for Linux!
JOdin 3 Casual powered by Heimdall
You need at least Java 8, if you don't have it already:
To see the java version type:
Code:
java -version
Aptitude Package Manager:
Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java9-installer
If necessary change the java environment to the new one(this should be changed automatically by the installer of the new package):
Code:
sudo update-alternatives --config java
JOdin3 Mirrors:
mega.nz
androidfilehost.com
FYI:
__________________
Click to expand...
Click to collapse
That's all good and JOdin3 launched, yet while uncompressing the system.img file (about 1.5GB) the following error shows:
[VERBOSE]Heimdall Device detected!
verified file /home/location/Downloads/OudereStockRom-4.4.2kk/T210XXBNH4_T210OXABNH4_HOME/T210XXBNH4_T210OXABNH4_HOME.tar.md5
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/boot.img
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/recovery.img
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/PBL.bin
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/param.lfs
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/loke_2nd.bin
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/loke_pxa988.bin
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/system.img
Exception in thread "Thread-31" java.lang.OutOfMemoryError: Java heap space
at CASUAL.communicationstools.heimdall.odin.OdinFile.extractOdinContents(OdinFile.java:145)
at CASUAL.communicationstools.heimdall.odin.Odin.getHeimdallFileParametersFromOdinFile(Odin.java:50)
at com.casual_dev.jodin.JOdinController.getHeimdallCommandFromOdinPackageList(JOdinController.java:621)
at com.casual_dev.jodin.JOdinController.access$3300(JOdinController.java:54)
at com.casual_dev.jodin.JOdinController$13.run(JOdinController.java:572)
at java.lang.Thread.run(Thread.java:745)
xdausernl said:
These are recommendations I'd found:
Heap size specifies the amount of dynamic memory to be made available to the JVM code.
For systems with less than 1 GB of physical memory, use a maximum heap size of 256 MB, and an initial heap size of 0 MB.
For systems with 2 GB memory, use a maximum heap size of 768 MB, and an initial heap size of 256 MB.
For larger systems (more than 2GB), use a maximum heap size of 1024 MB, and an initial heap size of 512 MB.
Is that also suitable for JOdin3?
This is the current error I've got:
Exception in thread "Thread-78" java.lang.OutOfMemoryError: Java heap space
at CASUAL.communicationstools.heimdall.odin.OdinFile.extractOdinContents(OdinFile.java:145)
at CASUAL.communicationstools.heimdall.odin.Odin.getHeimdallFileParametersFromOdinFile(Odin.java:50)
at com.casual_dev.jodin.JOdinController.getHeimdallCommandFromOdinPackageList(JOdinController.java:621)
at com.casual_dev.jodin.JOdinController.access$3300(JOdinController.java:54)
at com.casual_dev.jodin.JOdinController$13.run(JOdinController.java:572)
at java.lang.Thread.run(Thread.java:745)
How do I edit the 'heap space' settings for JOdin3 in Linux Mint 19.1?
Click to expand...
Click to collapse
xdausernl said:
That's all good and JOdin3 launched, yet while uncompressing the system.img file (about 1.5GB) the following error shows:
[VERBOSE]Heimdall Device detected!
verified file /home/location/Downloads/OudereStockRom-4.4.2kk/T210XXBNH4_T210OXABNH4_HOME/T210XXBNH4_T210OXABNH4_HOME.tar.md5
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/boot.img
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/recovery.img
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/PBL.bin
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/param.lfs
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/loke_2nd.bin
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/loke_pxa988.bin
decompressing file:/tmp/CASUALroot-2019-07-28-20.56.18/system.img
Exception in thread "Thread-31" java.lang.OutOfMemoryError: Java heap space
at CASUAL.communicationstools.heimdall.odin.OdinFile.extractOdinContents(OdinFile.java:145)
at CASUAL.communicationstools.heimdall.odin.Odin.getHeimdallFileParametersFromOdinFile(Odin.java:50)
at com.casual_dev.jodin.JOdinController.getHeimdallCommandFromOdinPackageList(JOdinController.java:621)
at com.casual_dev.jodin.JOdinController.access$3300(JOdinController.java:54)
at com.casual_dev.jodin.JOdinController$13.run(JOdinController.java:572)
at java.lang.Thread.run(Thread.java:745)
Click to expand...
Click to collapse
Just f*ing google it...
I dont know whats so hard about reading the error message but ok here you go:
Code:
java -Xms512m -Xmx2g -jar JOdin3CASUAL.jar
Here the link: https://alvinalexander.com/blog/post/java/java-xmx-xms-memory-heap-size-control
If you are wondering what magic that is, its literally the first answer for typing "java increase heap size"
Toby4213 said:
Just f*ing google it...
I dont know whats so hard about reading the error message but ok here you go:
Code:
java -Xms512m -Xmx2g -jar JOdin3CASUAL.jar
Here the link: https://alvinalexander.com/blog/post/java/java-xmx-xms-memory-heap-size-control
If you are wondering what magic that is, its literally the first answer for typing "java increase heap size"
Click to expand...
Click to collapse
Thanks Toby4213, you're right ... and I have been there but didn't know how to use it as this is all new for me so I'm sorry for being a noob.
But I still remain unable to get the job done.
Using your line of code with or without 'sudo' results in this error:
Error: Unable to access jarfile JOdin3CASUAL.jar
Do I need to take some additional steps?
xdausernl said:
Thanks Toby4213, you're right ... and I have been there but didn't know how to use it as this is all new for me so I'm sorry for being a noob.
But I still remain unable to get the job done.
Using your line of code with or without 'sudo' results in this error:
Error: Unable to access jarfile JOdin3CASUAL.jar
Do I need to take some additional steps?
Click to expand...
Click to collapse
Sorry for being rude earlier, had a bad day.
matador84 said:
Thanks I am new to this and not a developer. I have downloaded Jodin3 files but how do I install please?
Click to expand...
Click to collapse
Alright so this is what you both have to do:
1. As stated in my original post make sure you have java installed.
2. Download the JOdin archive file linked in my original post
3. Unpack the archive into a folder. Linux Mint should automatically generate a folder called "JOdin3CASUAL-linux-R991"
4. navigate into this folder using the terminal(you can right click and select open "terminal in this folder" or similar) type: cd ./JOdin3CASUAL-linux-R991
5. once you are in the JOdin3CASUAL-linux-R991 folder type ls into the terminal. You should see 2 folders "app" and "runtime" and a file called "JOdin3CASUAL"
6. Type cd ./app
7. again type ls and now you should see the file "JOdin3CASUAL.jar" among another file and a folder
8. Now you can run the .jar file with the before mentioned command: java -Xms512m -Xmx2g -jar JOdin3CASUAL.jar
I hope everything is clear now. If you have any questions feel free to ask. I absolutely encourage the use of Linux and compared to ****ty Windows 10 it is an absolute dream to work and tinker with.
I would recommend that you start to learn how to use the terminal/console. It is really easy once you know what you are doing. Here is a great link to get started: http://linuxcommand.org/
Toby4213 said:
Sorry for being rude earlier, had a bad day.
Alright so this is what you both have to do:
1. As stated in my original post make sure you have java installed.
2. Download the JOdin archive file linked in my original post
3. Unpack the archive into a folder. Linux Mint should automatically generate a folder called "JOdin3CASUAL-linux-R991"
4. navigate into this folder using the terminal(you can right click and select open "terminal in this folder" or similar) type: cd ./JOdin3CASUAL-linux-R991
5. once you are in the JOdin3CASUAL-linux-R991 folder type ls into the terminal. You should see 2 folders "app" and "runtime" and a file called "JOdin3CASUAL"
6. Type cd ./app
7. again type ls and now you should see the file "JOdin3CASUAL.jar" among another file and a folder
8. Now you can run the .jar file with the before mentioned command: java -Xms512m -Xmx2g -jar JOdin3CASUAL.jar
I hope everything is clear now. If you have any questions feel free to ask. I absolutely encourage the use of Linux and compared to ****ty Windows 10 it is an absolute dream to work and tinker with.
I would recommend that you start to learn how to use the terminal/console. It is really easy once you know what you are doing. Here is a great link to get started: http://linuxcommand.org/
Click to expand...
Click to collapse
Apology accepted .... and I'm busy with trial and error.
Now on Linux Mint 19.1 Heimdall is installed and I have this 'JOdin3CASUAL-r1142-dist' version.
So when I unzipped the compressed file in the default 'downloads' folder, I found a folder with 2 folders and a file inside like you described.
Next I entered the 'app' folder and launched inside the terminal session, pasted the command you provided 'java -Xms512m -Xmx2g -jar JOdin3CASUAL.jar'.
The following error popped up:
Error: Could not find or load main class com.casual_dev.jodin.JOdinMain
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
So I firstly installed openjdk-11, but the problem still persists.
Did I do something wrong or are steps missing?
xdausernl said:
Apology accepted .... and I'm busy with trial and error.
Now on Linux Mint 19.1 Heimdall is installed and I have this 'JOdin3CASUAL-r1142-dist' version.
So when I unzipped the compressed file in the default 'downloads' folder, I found a folder with 2 folders and a file inside like you described.
Next I entered the 'app' folder and launched inside the terminal session, pasted the command you provided 'java -Xms512m -Xmx2g -jar JOdin3CASUAL.jar'.
The following error popped up:
Error: Could not find or load main class com.casual_dev.jodin.JOdinMain
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
So I firstly installed openjdk-11, but the problem still persists.
Did I do something wrong or are steps missing?
Click to expand...
Click to collapse
Alright so I finally got it working myself. I haven't used jodin for a long time.
Ok so first make sure that you have JavaFX installed. For that just type sudo apt install openjfx in the terminal.(This might be optional for you, if you get an error containing JavaFX thats the command to fix it)
Since JOdin doesn't quite work when launched via the .jar file the only way to get it to run is to use the binary. Thats the file in the very first folder just called "JOdin3CASUAL".
But since we are not running the jar directly we cant add -Xmx2g as a launch option. In order to get the bigger heap size type export _JAVA_OPTIONS=-Xmx2g in the terminal. You have to run this everytime you close the terminal window. In order to keep this setting permanently add this line to the .profile file in your home directory.
After that go into the folder with app, runtime and JOdin3CASUAL and type: sudo ./JOdin3CASUAL
Hope this works for you.
Cheers
Toby4213 said:
Alright so I finally got it working myself. I haven't used jodin for a long time.
Ok so first make sure that you have JavaFX installed. For that just type sudo apt install openjfx in the terminal.(This might be optional for you, if you get an error containing JavaFX thats the command to fix it)
Since JOdin doesn't quite work when launched via the .jar file the only way to get it to run is to use the binary. Thats the file in the very first folder just called "JOdin3CASUAL".
But since we are not running the jar directly we cant add -Xmx2g as a launch option. In order to get the bigger heap size type export _JAVA_OPTIONS=-Xmx2g in the terminal. You have to run this everytime you close the terminal window. In order to keep this setting permanently add this line to the .profile file in your home directory.
After that go into the folder with app, runtime and JOdin3CASUAL and type: sudo ./JOdin3CASUAL
Hope this works for you.
Cheers
Click to expand...
Click to collapse
I took all the steps you wrote down for me and I got JOdin working, finally..
But there goes something wrong still.
Because ... uploading the stock ROM (1,5GB) should take a while, is not done in just a few minutes.
Uploading all the files should take at least 10 minutes to complete.
Yet, in the end, it does say reset in green though.
And I'm quite sure that something is wrong, because I didn't see the blue status bar on the Samsung tablet during the upload process.
Uploading the extracted files seperately in Heimdall, 10 pieces out of the stock ROM, will take 10 - 15 minutes to complete and the largest of them all is the 'system.img' file which is 1,2 or 1,5GB in size.
With Heimdall I do see the status bar in both the program while uploading and in blue the same status bar on the Samsung tablet.
On the end of the day, I still have a rooted and faulty Android system running on that Samsung tablet.
Somehow the clean factory default is not loaded when the Samsung device reboot after all uploads with Heimdall.
Although the software uploaded is Android 4.4.2 for Tab3 7.0 8GB WiFi, with all the correct changes, date of build and country code.
Is there a final method to clean out the current faulty content of the Samsung Tab3 device?
xdausernl said:
I took all the steps you wrote down for me and I got JOdin working, finally..
But there goes something wrong still.
Because ... uploading the stock ROM (1,5GB) should take a while, is not done in just a few minutes.
Uploading all the files should take at least 10 minutes to complete.
Yet, in the end, it does say reset in green though.
And I'm quite sure that something is wrong, because I didn't see the blue status bar on the Samsung tablet during the upload process.
Uploading the extracted files seperately in Heimdall, 10 pieces out of the stock ROM, will take 10 - 15 minutes to complete and the largest of them all is the 'system.img' file which is 1,2 or 1,5GB in size.
With Heimdall I do see the status bar in both the program while uploading and in blue the same status bar on the Samsung tablet.
On the end of the day, I still have a rooted and faulty Android system running on that Samsung tablet.
Somehow the clean factory default is not loaded when the Samsung device reboot after all uploads with Heimdall.
Although the software uploaded is Android 4.4.2 for Tab3 7.0 8GB WiFi, with all the correct changes, date of build and country code.
Is there a final method to clean out the current faulty content of the Samsung Tab3 device?
Click to expand...
Click to collapse
I'm sorry but I don't know why its not working for you. I don't use odin anymore so I haven't tested the uploading anything to the phone.
I would recommend you to use adb and fastboot. Both are available in the standard repository, just type sudo apt install adb and sudo apt install fastboot. Furthermore it is much saver to do any flashing that way, because it is basically the intended way of debugging a android smartphone/tablet.
Edit: ok I just found out that fastboot does not work with samsung devices
Try to use odin on windows https://samsungodin.com/ or through wine on linux but I highly doubt that this would work.
I am sorry, but at this point I can't help you more. I haven't used a Samsung device in about 4 years and have no idea any more about all the problems and kinks with odin or generall samsung devices.
I wish you the best of luck.

Categories

Resources