Related
I'm sure several people will be wanting this information, so I figured I would post it here for everyone. This will allow you to backup your system and create custom Odin images for restore purposes. For anyone unfamiliar with the Samsung system, they use Odin to flash things to the device, much like HTC has RUU and Moto has SBF. Odin files are either .tar files, or .tar.md5 files.
The .tar.md5 files are .tar files with the md5 checksum added to the end of the file. If you attempt to flash a .tar.md5 file, Odin will automatically check that the contents are what they should be before flashing and proceed with the flash if the md5 is valid, otherwise it will stop.
In Odin, you should use the PDA button for all flashing. The PIT button may be used as well, if we can get a valid .pit file for the device, but for now, PIT won't be used either. Other than PDA, Start/Reset are the only other buttons you need to worry about.
Now, on to creating the backup files. First, you will need your device to be rooted (perm or temp root will work), and you also need to have access to terminal on the phone, either via an emulator or adb shell access. To create the backup files, you won't need a Linux/UNIX system, but you will if you want to create a flashable Odin package. The following will output the files on the root of the SDCard, adjust the "of=" path if you want them somewhere else. It will also create the files for the proper filename for Odin as well. So to create the files, here are the commands you will use from root shell (#):
System:
Code:
dd if=/dev/block/stl10 of=/sdcard/factoryfs.rfs bs=4096
Kernel:
Code:
dd if=/dev/block/bml8 of=/sdcard/zImage bs=4096
Recovery:
Code:
dd if=/dev/block/bml9 of=/sdcard/recovery.bin bs=4096
DO NOT INCLUDE THE FOLLOWING IN ANYTHING BUT A PERSONAL BACKUP
Cache:
Code:
dd if=/dev/block/mmcblk0p3 of=/sdcard/cache.rfs bs=4096
DBData:
Code:
dd if=/dev/block/stl11 of=/sdcard/dbdata.rfs bs=4096
Data:
Code:
dd if=/dev/block/mmcblk0p1 of=/sdcard/movinand.bin bs=4096
The last three files (cache, dbdata, data) may contain personal information, so do not include these 3 files in anything but a personal backup/recovery package.
To create a flashable Odin package, you need to pull all of the files off of the phone/sdcard and onto your computer. From there, you use the following to create the package:
Code:
tar -H ustar -c factoryfs.rfs recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
If you want to include cache/dbdata/data in the above for personal use, just add them after the "-c" and before the ">".
There are other files that may be in Odin packages, but they are protected by Samsung and cannot be dumped properly. The files are the bootloader, secondary bootloader, modems, and .lfs partitions. The files would be boot.bin, Sbl.bin, modem.bin (not sure what it would be for the CDMA/LTE dual modem here), and param.lfs. It however isn't that big of an issue that these can't be dumped as the can't really be altered by normal flashing of the device, and are usually only altered via OTA updates.
Thanks for this info imnuts! I unfortunately updated to the new update and would like to go back to rooted but cant until I downgrade.
Thanks!
Thanks for posting this. I'm going to attempt to make a personal backup and then I can factory reset the phone and make a stock version for people to use. I'm haven't installed the update yet either, so I'm hoping this will let people get back to ED1. I've also been playing around with theming using the fascinate community rom theme and ninjamorph to swap files. It'll take a while, but it's currently the only way I feel safe messing with framework-res.
wynalazca said:
Thanks for posting this. I'm going to attempt to make a personal backup and then I can factory reset the phone and make a stock version for people to use. I'm haven't installed the update yet either, so I'm hoping this will let people get back to ED1. I've also been playing around with theming using the fascinate community rom theme and ninjamorph to swap files. It'll take a while, but it's currently the only way I feel safe messing with framework-res.
Click to expand...
Click to collapse
I'm definitely looking forward to having a downgrade ROM image to get back to ED1!
So how do you add the last personal 3 i just got the droid charge and i am not very familiar with samsung files i had a droid x and a thunderbolt very shortly and am familiar with ruu and sbf but how do you add cache dbdata and the other one. I meab like the actual command not the instruction to put it after c
rami98 said:
So how do you add the last personal 3 i just got the droid charge and i am not very familiar with samsung files i had a droid x and a thunderbolt very shortly and am familiar with ruu and sbf but how do you add cache dbdata and the other one. I meab like the actual command not the instruction to put it after c
Click to expand...
Click to collapse
The only thing that would change would be the tar command. If you want to include the other files, it would be:
Code:
tar -H ustar -c cache.rfs dbdata.rfs factoryfs.rfs movinand.bin recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
You just need to pull the files from your phone and have them in the same directory that you're in in terminal, and have them named appropriately. It also doesn't matter what order they are in (that I know of), I just have them in alphabetical order for ease of reading.
So im going to try and do the voodoo lagfix for the first time ever but I wanted to make a backup. Im on ED2 and NOT rooted so how would I go about making these backups?
imnuts said:
The only thing that would change would be the tar command. If you want to include the other files, it would be:
Code:
tar -H ustar -c cache.rfs dbdata.rfs factoryfs.rfs movinand.bin recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
You just need to pull the files from your phone and have them in the same directory that you're in in terminal, and have them named appropriately. It also doesn't matter what order they are in (that I know of), I just have them in alphabetical order for ease of reading.
Click to expand...
Click to collapse
I tried the above and I keep getting this error message in the command prompt:
'tar' is not recognized as an internal or external command, operable program or batch file.
(I'm trying this on windows 7 professional)
Any help would be appreciated, thanks!
mypantsaretorn said:
I tried the above and I keep getting this error message in the command prompt:
'tar' is not recognized as an internal or external command, operable program or batch file.
(I'm trying this on windows 7 professional)
Any help would be appreciated, thanks!
Click to expand...
Click to collapse
You wouldn't by any chance be trying the "tar" command at a windows command prompt, would you?
imnuts said:
To create the backup files, you won't need a Linux/UNIX system, but you will if you want to create a flashable Odin package.
To create a flashable Odin package, you need to pull all of the files off of the phone/sdcard and onto your computer. From there, you use the following to create the package:
Code:
tar -H ustar -c factoryfs.rfs recovery.bin zImage > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
If you want to include cache/dbdata/data in the above for personal use, just add them after the "-c" and before the ">".
Click to expand...
Click to collapse
Course you might be running Linux in a vmware or Hyper-V environment....hint?
HTH
Damn! I didn't pay attention to the second part of that sentence! Lol
Thanks for the "hint"..
Sent from my SCH-I510 using XDA App
The other option would be using Cygwin, but I've never tried it, so it may or may not work.
imnuts said:
The other option would be using Cygwin, but I've never tried it, so it may or may not work.
Click to expand...
Click to collapse
cygwin works!
Edit: Here is how:
1. Search google for cygwin - download
2. Run - you will be prompted to get packages - I assumed "archive" was a good place to start - not sure if you need this or not...
3. When complete you will see a new icon on your desktop - double-click
4. Be patient as it loads
5. Copy the files output'ed from first post to same folder on PC
6. Back in cygwin:
a. cd x: (where x: is the drive letter of the drive that has the folder with the files)
b. tar -H ustar -c cache.rfs dbdata.rfs movinand.bin factoryfs.rfs recovery.bin zImage > package_name.tar
c: md5sum -t package_name.tar >> package_name.tar
d: mv package_name.tar package_name.tar.md5
Complete output of commands:
These files are for the users to personalise their cygwin experience.
They will never be overwritten nor automatically updated.
`./.bashrc' -> `/home/UWINKET//.bashrc'
`./.bash_profile' -> `/home/UWINKET//.bash_profile'
`./.inputrc' -> `/home/UWINKET//.inputrc'
`./.profile' -> `/home/UWINKET//.profile'
Your group is currently "mkgroup". This indicates that neither
your gid nor your pgsid (primary group associated with your SID)
is in /etc/group.
The /etc/group (and possibly /etc/passwd) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] > /etc/passwd
mkgroup -l [-d] > /etc/group
Note that the -d switch is necessary for domain users.
[email protected] ~
$ cd h:
System Volume Information
[email protected] /cygdrive/h
$ cd downloads
[email protected] /cygdrive/h/downloads
$ cd charge
[email protected] /cygdrive/h/downloads/charge
$ cd tarbackup/
[email protected] /cygdrive/h/downloads/charge/tarbackup
$ tar -H ustar -c cache.rfs dbdata.rfs movinand.bin factoryfs.rfs recovery.bin
zImage > package_name.tar
[email protected] /cygdrive/h/downloads/charge/tarbackup
$ md5sum -t package_name.tar >> package_name.tar
[email protected] /cygdrive/h/downloads/charge/tarbackup
$ mv package_name.tar package_name.tar.md5
[email protected] /cygdrive/h/downloads/charge/tarbackup
$
Hmm flash did not work with my personal data in it - got an error. Created a new .tar file with just factoryfs.rfs recovery.bin and zImage and was able to flash that. TG for TiBu!
jism31 said:
Thanks for this info imnuts! I unfortunately updated to the new update and would like to go back to rooted but cant until I downgrade.
Click to expand...
Click to collapse
How do you start doing this. How do I get to root shell (#)... Thanks
AD
I plan to get rooted on ED1 so I can get a stock image backed up, and have a clean base to work from. Still getting my head around the odin stuff first.
RaptorMD said:
I plan to get rooted on ED1 so I can get a stock image backed up, and have a clean base to work from. Still getting my head around the odin stuff first.
Click to expand...
Click to collapse
you dont have to do that its already done
http://forum.xda-developers.com/showthread.php?t=1085190
Well, I successfully followed all the instructions and have created my first ODIN flashable file, I have not tried to flash it yet. I'm just curious, I pull all the different .rfs, .bin, and zImage on this file and noticed it's about 1.8gb file. Is this normal?
Also, before I try to flash this. Should I have dissable voodoo lagfix and converted back to rfs before I dumped the files?
Thanks for all the help!
JKChad said:
Well, I successfully followed all the instructions and have created my first ODIN flashable file, I have not tried to flash it yet. I'm just curious, I pull all the different .rfs, .bin, and zImage on this file and noticed it's about 1.8gb file. Is this normal?
Also, before I try to flash this. Should I have dissable voodoo lagfix and converted back to rfs before I dumped the files?
Thanks for all the help!
Click to expand...
Click to collapse
Yes, that's normal for it to be so large as dd will dump the partition, including empty space. If you were to compress it with zip or lzma, it'd drop down considerably.
Not sure about the voodoo part as I've never dumped files from an ext4 partition. I don't see any reason why it wouldn't work, but I'd flash with caution and have another working image ready just in case.
imnuts said:
Not sure about the voodoo part as I've never dumped files from an ext4 partition. I don't see any reason why it wouldn't work, but I'd flash with caution and have another working image ready just in case.
Click to expand...
Click to collapse
Shouldn't be an issue as long as he keeps the voodoo kernel.
Sent from my SCH-I510 using Tapatalk
Anybody try this with voodoo yet ?
SAMSUNG GALAXY ACE 2 i8160/i8160P
This could be complicated if you never used any Linux os, however with this method you can root your phone without increasing the flash counter.
Kernel, recovery, etc. will be the same as in original samsung roms, we will flash a modified (pre-rooted) system.img.
For prerooted system images and csc files see 2nd post!
Requirements:
Linux - Ubuntu 12 recommended (a virtual one will also do the job)
Windows with Odin for flashing
Patience
References:
Ext4Utils
Insipred by: Expert root method which does not increase the flash counter
First of all download your original rom from: http://www.sammobile.com/firmware/?page=3
1, Create a "samsung" directory on your linux filesystem -> "home/username" folder where username is your linux username.
2, Extract the downloaded firmware, then move system.img.md5 and cache.img.md5 to home/username/samsung dir.
(root_package.zip and ext4utils.zip also extract here)
3, Open a terminal window, and enter:
Code:
sudo mkdir /mnt/system
Type the root password and enter.
4, Now set current dir to samsung directory and mount the system image:
Code:
cd /home/username/samsung
mv system.img.md5 system.img.ext4
make
./simg2img system.img.ext4 system.img
sudo mount system.img /mnt/system
if you get error when executiong "make" type:
Code:
sudo apt-get install zlib1g-dev
5, The original system image has been mounted, now extract su binary and superuser.apk to samsung dir then, enter:
I suggest only su binary to include in /system, SuperUser can be installed later!
Code:
sudo cp su /mnt/system/bin/su
6, Now we have to adjust the permissions:
For SU binary:
Code:
sudo chown root:root /mnt/system/bin/su
sudo chmod 06755 /mnt/system/bin/su
For SuperUser app:
Code:
sudo chmod 644 /mnt/system/app/superuser.apk
7, Unmount the image:
Code:
sudo umount /mnt/system
or if it's not working:
Code:
sudo umount system.img
8, Now create md5 hashes:
Code:
md5sum -t system.img>>system.img
mv system.img system.img.md5
if you get "permission denied" first:
Code:
sudo chown username:username system.img
9, Create falshable tar and md5 hashes for odin package:
Code:
tar cf system_rooted.tar system.img.md5
md5sum -t system_rooted.tar>>system_rooted.tar
mv system_rooted.tar system_rooted.tar.md5
As you remember we copied the cache.img.md5 also, that's because we need to flash this as a separated CSC package.
10, Creating CSC package.
Code:
tar cf csc.tar cache.img.md5
md5sum -t csc.tar>>csc.tar
mv csc.tar csc.tar.md5
11, Now open Odin and select system_rooted.tar.md5 as PDA, and csc.tar as csc.
Check: Auto reboot and F. Reset Time.
Enjoy your rooted phone.
NOTES:
After flashing phone will boot in recovery mode to apply csc, then reboots automatically to normal mode.
If you download different rom than already have on the device first flash the unmodified samsung tar as PDA.
PRE-ROOTED ROMs
(Only modified system and csc - if Superuser not included download manually from Play store or install from sdcard)
PDA: XXLD8 | CSC: I8160DBTLD2 -> -> DOWNLOAD <-
Thanks to: powermetza
PDA: XXLD8 | CSC: XXLD3 | Product code: XEO -> Mirror 1 | Mirror 2
Thanks to: mastermid | szczepan2
For i8160P - Galaxy Ace 2 NFC model
PDA: I8160PXXLE6 | CSC: I8160PDBTLE5 -> Mirrors
Thanks to: soraxx
SuperUser FIX for pre-rooted rom (only if you have problems): View
FLASHING INSTRUCTIONS
0, Download odin from 1st post, extract the downloaded (pre-rooted) rom.
1, Open odin and select csc.tar.md5 (or something like that it's a smaller file max. 20 MB) as CSC.
2, Select the other file (possibly system.tar.md5 or pda.tar.md5, it's 500+ MB) as PDA.
3, Check, Auto reboot and F. Reset Time then start.
(of course first switch to download mode and connect the phone )
mount: must specify filesystem (this is error)
My OS - Linux Mint 13 with MATE, run natively.
I don't know what's the problem, the filesystem should be ext4, but in Ubuntu mounted without any errors.
any chance to reset counter? mine just rooted yesterday. damn
Thank you! It would be a good solution can be used under Windows ...
GT-I8160-ról küldve
@Szaby59
Three simple questions:
1. Can I use this method to cook pre-rooted ROM (that doesn't increase flash counter), but without samsungs bloatware? In other words: Can I somehow remove any APK that comes from samsung and still have valid warranty?
2. Did you tried this method with flash_counter=0 or did you already voided warranty and then NOT increased flash_counter?
3. Are both values "Custom Binary Download=NO" and "Current Binary: Samsung Official" still intact after this root method?
Anyway... Thank you for this... I was waiting for something like this since I bought I8160.
1, I think you can remove apps and modify some other things if you want I didn't test it but 99% it's possible (or you can remove aps later with root explorer from /system/app)
But for warranty purposes (removing root, restoring original apps) reflash the original unmodified samsung tar.
2-3, No, I didn't tried any other methods, the custom binary downloads is 0 (NO) and I have "Samsung Official".
I think the counter only observing kernel flashes, with this method the flash counter will be the same as before the flash.
Also I noticed when you reboot from adb or terminal to download mode it doesn't shows the odin mode... stuffs, only when you use the hardware keys (vol down+home+power). !Maybe! in this way we can flash a modified kernel but it's not 100% and first you need to root the phone somehow to enable "su reboot download" command.
By the way... There is no way to download the ROM from THIS site... Loading, loading, and... loading...
szczepan2 said:
By the way... There is no way to download the ROM from THIS site... Loading, loading, and... loading...
Click to expand...
Click to collapse
Login first -> blank screen -> go back and refresh > download firmware.
Do I need to create CSC file again if I want to flash back to stock-non rooted firmware? Or should I use stock PDA file only, without CSC?
Can you write down a simple "Going back to stock ROM procedure without touching Flash Counter". Many noobs (including me) would be grateful for complete solution.
Maybe the editing ROM is not working because it's Polish? I can't open it too with any archive manager...
arroyo said:
Do I need to create CSC file again if I want to flash back to stock-non rooted firmware? Or should I use stock PDA file only, without CSC?
Can you write down a simple "Going back to stock ROM procedure without touching Flash Counter". Many noobs (including me) would be grateful for complete solution.
Click to expand...
Click to collapse
Just flash back the original tar with all files as pda no csc or phone needed it's included in the tar.
@szczepan2: you can't use any know archiver to open img.md5 files.
For extracting the tar use winrar or 7zip.
Szaby59 said:
@szczepan2: you can't use any know archiver to open img.md5 files.
For extracting the tar use winrar or 7zip.
Click to expand...
Click to collapse
Ahh, got it. So if it impossible to open it, so how it's possible to mount it?
Ehh, i'm really angry because I can't root my phone... You use Ubuntu in VM or native? Or maybe LiveCD?
szczepan2 said:
Ahh, got it. So if it impossible to open it, so how it's possible to mount it?
Ehh, i'm really angry because I can't root my phone... You use Ubuntu in VM or native? Or maybe LiveCD?
Click to expand...
Click to collapse
I installed on a virtualbox virtual machine, (with 8 GB vhd) for mounting and rooting follow the steps from 1st post.
@Szaby59
I have also the problem that I need to specify type of mounting filesystem, but I have an idea.
If you are able to mount succesfuly system.img, then could you in console just type:
Code:
mount
It will give you the list with all mounted devices/images and their types - I would be grateful if you could check what type is /mnt/system.
Thanks in advance.
mastermid said:
@Szaby59
I have also the problem that I need to specify type of mounting filesystem, but I have an idea.
If you are able to mount succesfuly system.img, then could you in console just type:
Code:
mount
It will give you the list with all mounted devices/images and their types - I would be grateful if you could check what type is /mnt/system.
Thanks in advance.
Click to expand...
Click to collapse
It shows ext4 filesystem.
mastermid said:
@Szaby59
I have also the problem that I need to specify type of mounting filesystem, but I have an idea.
If you are able to mount succesfuly system.img, then could you in console just type:
Code:
mount
It will give you the list with all mounted devices/images and their types - I would be grateful if you could check what type is /mnt/system.
Thanks in advance.
Click to expand...
Click to collapse
cloudm33 samsung # mount -t ext4 system.img /mnt/system/
mount: Filesystem error, wrong superblock at /dev/loop0 etc.
Tutorial updated with additional tools and instructions.
Szaby59 said:
Tutorial updated with additional tools and instructions.
Click to expand...
Click to collapse
Can you upload also a pre-rooted rom?
For example the polish or the germany stock rom?
Thanks in advance!
I have a Samsung Galaxy Player 70 Plus (YP-GB70D) which is sold in Korea only (got it secondhand from ebay). I cannot find any development of this player (or the Korean development team is not willing to share), particularly on installation of CWM. I would at least like to have this rooted. I did manage to find copies of the OEM firmware in TAR format.
I read about dsixda's Android Kitchen. I installed Virtualbox on my Windows 7 machine to run ubuntu 12. I successfully installed Kitchen and used it to modify my TAR firmware. However, I notice that the modified firmware is in ZIP format suitable for flashing with CWM (as I said there is no CWM for this player). I renamed this to "update.zip" and tried Samsung's 3e recovery, but it rejected it saying "verification fails".
Further research shows that I can unpack the factoryfs.img in the TAR firmware, and manually add su / superuser into the system folders, then repack it back into factoryfs.img and then the TAR firmware, and use ODIN or Heimdall to flash it to the player. I have also successfully installed EXT4_UTILS on ubuntu and used it to unpack the factoryfs.img into an ext4 image, and mounted the unpacked image using this command:
Code:
sudo mount -o loop output.img tempdir
Unfortunately, the mounted image only allows you to see the content of the image, and you cannot add / delete / change anything inside. I tried modifying the permission of the folder of the mounted image, but no luck.
When I look at the output from Kitchen and the mounted image, I notice they have all the identical system folders and files (except su and superuser added in the Kitchen output). Therefore, I copied the "system" folder from Kitchen output and repacked it into factoryfs.img with EXT4_UTILS, and replaced the original factoryfs.img of the OEM firmware with the modified version (I repacked the TAR using 7zip).
Unfortunately, when I flashed the modified TAR with ODIN (which detected the player without problem), it said "failed" and aborted. When I used Heimdall (which detected the player without problem), it gave me a "usblib error -12" message and aborted. I have tried unsintalling the "Samsung USB driver for mobile phone" and reinstalling the Heimdall driver from zadig.exe, but no luck.
My questions are:
(1) Is there a way to make the mounted ext4 image of the EXT4_UTILS read/writable, so that I can modify the content and add su / superuser to "bin"?
(2) Does ODIN check whether the firmware is original (OEM) or custom, and reject custom firmware? If not, why would my method of replacing the "system" folder of the original factoryfs.img with that from the Ktichen output fail?
Thanks for helping a noob out.
I following the instructions found from here:
Building Kernels
and download the kernel from here:
INDEX of ROMS/RECOVERY/ROOT/GUIDES/FIRMWARE/KERNEL/VIDEOS/etc..
I am using TF300TG, so I just followed the link to my tablet kernel source from the thread. I have successfully built the kernel by using the config.gz found in the tablet /proc/config.gz (is great that Asus is providing such info). I also enable a kernel module for my old USB ethernet dongle and able to use it to get online. :victory:
After poking around the kernel configuration, and reading the thread TF300T kernel source repository, I am curious about enabling OC and possible other features. I had downloaded the update.zip from the thread, and trying to understand the whole process of how to flash kernel to the tablet. My idea is to modify the update.zip to make use of it to update my tablet. But before I start doing something serious, I have questions...
I found the following kernel file: kernel.blob in update.zip. Is this the same file as 'zImage' in arch/arm/boot/ after built successful?
The next question is on how to backup my existing kernel? I notice from the update-script, the kernel is flash using the following command:
run_program("/sbin/busybox", "dd", "if=/tmp/kernel.blob", "of=/dev/block/mmcblk0p4");
Click to expand...
Click to collapse
Does this mean, I can run the same command in reverse to keep a copy of my current kernel?
I had done kernel compiling before, but those were in PC/x86 platform. ARM platform seems to be different from what I used to.
I found the following kernel file: kernel.blob in update.zip. Is this the same file as 'zImage' in arch/arm/boot/ after built successful?
Click to expand...
Click to collapse
Not exactly...
A blob file is a sort of archive that can contain several files.
For example, the kernel.blob you mention above contains the actual kernel (zImage) but also a ram disk.
As far as I understand a blob file is the only type of file that can be flashed to different partitions of your TF300T(G) using fastboot method.
To flash using CWM or TWRP you will need to pack blob file(s) into a special kind of zip package.
Below I have shared my script that I use to create a TWRP flashable zip package including a custom built kernel.
Hopefully it may shed some light in the steps required to go from zImage to blob file and TWRP flashable zip package.
The script takes the root path to your kernel source directory as first (and only) argument.
In same directory as script I have unpacked update.zip (from untermensch's kernel repository thread) as parts of this zip file are re-used.
---
#!/bin/sh
KERNEL_HOME=$1
KERNEL_NAME=my_kernel_$$
# Repack new kernel and old ram disk into blob file
cp ${KERNEL_HOME}/arch/arm/boot/zImage boot.blob.lnx-kernel.gz
repack-bootimg.pl boot.blob.lnx-kernel.gz boot.blob.lnx-ramdisk out.blob.lnx
blobpack out.blob LNX out.blob.lnx
# Prepend magic header
cat signblob_magic out.blob > kernel.blob
# Add kernel modules to ensure kernel and modules always match.
# If mismatch e.g WiFi might not work.
find ${KERNEL_HOME} -name "*.ko" -exec cp {} system/lib/modules \;
# Save kernel config in case it needs to be rebuilt some day.
cp ${KERNEL_HOME}/.config kernel_config
# Zip everything
zip -9 -r ${KERNEL_NAME}.zip kernel_config kernel.blob system/ META-INF/
# Sign zip using SignApk
java -Xmx1024m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ${KERNEL_NAME}.zip ${KERNEL_NAME}-signed.zip
---
The next question is on how to backup my existing kernel? I notice from the update-script, the kernel is flash using the following command:
Does this mean, I can run the same command in reverse to keep a copy of my current kernel?
Click to expand...
Click to collapse
In theory this should work but if not mistaken mmcblk0p4 is just a sort of staging partition.
During bootup whatever is in mmcblk0p4 is copied to another partition (mmcblk0p0?).
(I guess this is the blue bar you can observe when flashing custom roms/kernels)
Someone more familiar with the details please correct me.
Instead of trying to backup your current kernel I would suggest to try to get the original
kernel by unpacking the official update packages from ASUS support web page.
I had done kernel compiling before, but those were in PC/x86 platform. ARM platform seems to be different from what I used to.
Click to expand...
Click to collapse
Not that much different really, just need to search the google.com and XDA forums and you shall find answers...
gaze57 said:
Not exactly...
A blob file is a sort of archive that can contain several files.
For example, the kernel.blob you mention above contains the actual kernel (zImage) but also a ram disk.
As far as I understand a blob file is the only type of file that can be flashed to different partitions of your TF300T(G) using fastboot method.
To flash using CWM or TWRP you will need to pack blob file(s) into a special kind of zip package.
Below I have shared my script that I use to create a TWRP flashable zip package including a custom built kernel.
Hopefully it may shed some light in the steps required to go from zImage to blob file and TWRP flashable zip package.
The script takes the root path to your kernel source directory as first (and only) argument.
In same directory as script I have unpacked update.zip (from untermensch's kernel repository thread) as parts of this zip file are re-used.
---
#!/bin/sh
KERNEL_HOME=$1
KERNEL_NAME=my_kernel_$$
# Repack new kernel and old ram disk into blob file
cp ${KERNEL_HOME}/arch/arm/boot/zImage boot.blob.lnx-kernel.gz
repack-bootimg.pl boot.blob.lnx-kernel.gz boot.blob.lnx-ramdisk out.blob.lnx
blobpack out.blob LNX out.blob.lnx
# Prepend magic header
cat signblob_magic out.blob > kernel.blob
# Add kernel modules to ensure kernel and modules always match.
# If mismatch e.g WiFi might not work.
find ${KERNEL_HOME} -name "*.ko" -exec cp {} system/lib/modules \;
# Save kernel config in case it needs to be rebuilt some day.
cp ${KERNEL_HOME}/.config kernel_config
# Zip everything
zip -9 -r ${KERNEL_NAME}.zip kernel_config kernel.blob system/ META-INF/
# Sign zip using SignApk
java -Xmx1024m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ${KERNEL_NAME}.zip ${KERNEL_NAME}-signed.zip
---
In theory this should work but if not mistaken mmcblk0p4 is just a sort of staging partition.
During bootup whatever is in mmcblk0p4 is copied to another partition (mmcblk0p0?).
(I guess this is the blue bar you can observe when flashing custom roms/kernels)
Someone more familiar with the details please correct me.
Instead of trying to backup your current kernel I would suggest to try to get the original
kernel by unpacking the official update packages from ASUS support web page.
Not that much different really, just need to search the google.com and XDA forums and you shall find answers...
Click to expand...
Click to collapse
Whoa... Thanks for the info. I go read up more on this.
Hi xda
for some reson the ext4_utils is not working well on the galaxy s4, but there is another way to do that.
so thanks to hua_wuxin explained to me how to do it, and big thank to Chenglu for this.
What do you need to do:
first flash the firmware you wnat to modify, and root the phone. (it's can't be done without root first)
Do your changes in the device, by root explorer, zip files and etc.
Then via CMD (or terminal emulator) you type the following commands to dump the partition to samsung img file. (odin img, not ext4)
The commands according to the device and partition.
I9500
System:
Code:
su
make_ext4fs -s -l 2764M -a system /sdcard/system.img /system
Cache:
Code:
su
make_ext4fs -s -l 2072M -a cache /sdcard/cache.img /cache
I9505
System:
Code:
su
make_ext4fs -s -l 2760M -a system /sdcard/system.img.ext4 /system
Cache:
Code:
su
make_ext4fs -s -l 2070M -a cache /sdcard/cache.img.ext4 /cache
Now you can flash in odin by making tar from this modified img and the rest of the firmware.
The commands to create tar file, for example to I9500. (Cygwin or Linux)
Code:
tar -c boot.img cache.img hidden.img modem.bin recovery.img system.img >> file_name.tar
md5sum -t file_name.tar >> file_name.tar
mv file_name.tar file_name.tar.md5
Good Luck!
Sorry for my bad english.
Unfortunately, this still doesn't work for the I9500. Works fine for I9505 (which for me never had any issue at all, and worked with existing make_ext4fs tools just fine), but can't get *anything* to work with I9500.
To me it worked for both I9500 and I9505.
I created successfully for the I9500/I9505 scripts to add hebrew language to the languages list, by flashing custem recovery and cache img. (extended command and zip like your old root method to I9300)
also, i created full firmwares to both models with system and cache modified.
i flashed this files on over 1000 devices (I9500), and it's works gerat.
avicohh said:
To me it worked for both I9500 and I9505.
I created successfully for the I9500/I9505 scripts to add hebrew language to the languages list, by flashing custem recovery and cache img. (extended command and zip like your old root method to I9300)
also, i created full firmwares to both models with system and cache modified.
i flashed this files on over 1000 devices (I9500), and it's works gerat.
Click to expand...
Click to collapse
Have you tried making the I9500 image on the I9505 ? Or only on the I9500 ?
Could you make and attach an empty (or containing one small file: echo 1 > file ) custom cache.img for the I9500, so I can test some more ?
Really need to get this working I wish I actually had the device, heh ...
EDIT: Also maybe attach the make_ext4fs from your device ?
Chainfire said:
Unfortunately, this still doesn't work for the I9500. Works fine for I9505 (which for me never had any issue at all, and worked with existing make_ext4fs tools just fine), but can't get *anything* to work with I9500.
Click to expand...
Click to collapse
+1 :good:
You have to make the img on the same model exactly, because they have some differences in the img building.
For example the cache.img from the I9500 cannot be convert to ext4 by sgs2ext4.jar on windows. The cache.img.ext4 from the i9505 converted fine with this jar, so there is some differences. (Maybe it is the CPU differences)
any way I made the imgs for the i9500 on the i9500, and for i9505 on i9505.
I dont have the i9500 next to me, I have it in the work. (I will be there tomorrow)
For now i'm attaching a small cache.img from the firmware I made, containing only a command file for wipe data. (after flashing)
I hope it's will help.
Any way if you want, you can send me the cfroot folder with the root files and i will build it tomorrow for you to a cache.img. (with 32M size or 2072M)
btw. how exactly i can copy the the make_ext4fs from my device? (ftom where)
Thanks, just trying to figure out what the damned difference is
If you're on Windows, can you run this ? https://dl.dropboxusercontent.com/u/25695577/i9500_makefs_test.zip
Should make a cache.img file from your i9500, identical to ones I have here from a different device. This may help me figure the difference. Please attach both cache.img and commands.out files
file attached
Thanks! My my, Samsung is adding bytes to the image, make it non-standard and outside of spec. Not sure what those bytes mean yet, I've made an image with them zeroed out. Can you see if this flashes no your i9500, or ODIN produces an error ?
check it now.
edit:
works!!
how did you made this img? (on the I9505/computer)
Awesome!
Can you try this test version of CF-Auto-Root ? https://dl.dropboxusercontent.com/u/25695577/cfar_i9500_test.zip
Please:
- unroot your device before trying (just do full unroot from SuperSU's settings tab)
- flash this test CF-Auto-Root
- pay attention - is the Android you see during rooting red, blue, or green ?
- boot and see if you are re-rooted
As for what I did: I put a lot of files together, figured out what the difference was, and wrote a tool to convert between normal images and the ones used for the i9500. If all this works, I'll upload the tool (and the code, and the docs) later.
These images are made on the computer, by the way. As I said before, for the I9505 I didn't need to do this on the phone anyway, just make_ext4fs from latest Android source. And add to that my new tool, and you can make images for i9500 ... no phone needed.
works great!
i flashed it on new device and i checked it with root explorer.
the android was red like all cf-auto root.
waitng to your tool..
thanks.
https://github.com/Chainfire/sgs4ext4fs
Chainfire said:
https://github.com/Chainfire/sgs4ext4fs
Click to expand...
Click to collapse
Hi Cainfire, tnx for your tools, may be this can help you repack image I9505...
checkout android-4.2.2_r1.2
as i9000 said:
Hi Cainfire, tnx for your tools, may be this can help you repack image I9505...
checkout android-4.2.2_r1.2
Click to expand...
Click to collapse
I don't get it... I don't need help repacking i9505, as I've stated, latest ext4 utils will just work ?
i need to repack firmware for i9505 with hidden.img.ext4
i see in your commands hidden.img without ext4 extension
This should be work (create hidden img from the device)
Code:
make_ext4fs -s -l 500M -a hidden /sdcard/hidden.img.ext4 /preload
if you like to make a tar file, use those commands
Code:
tar -c boot.img cache.img.ext4 hidden.img.ext4 modem.bin NON-HLOS.bin persdata.img.ext4 recovery.img system.img.ext4 >> file_name.tar
md5sum -t file_name.tar >> file_name.tar
mv file_name.tar file_name.tar.md5
Works like a charm
Thanks Chainfire
I've tried it on the cache partition and system partition on i9500 and everything is more than fine/
Thank you very much.
do we need to make cache.img.ext4 off of our phone in Terminal EMUlator for all to work well or is that optional. thanks
also why such a large cache size and what is the difference between the larger and smaller cache recommended sizes ? ie 30M vs the 2000+ size and should we stick with those numbers.
iask because one time odin failed me on the cach.img.ext4 so I am wondering thanks again
hebrew
Hello cainfire,thanks for your work,it's amazing, i'm useing it alot.
Is there a chance to get a hebrew script or a tar for the samsung galaxy 9505,9500
You will make me happy and i would be happy to buy u a beer
Thanks