How can I backup and reflash factoryfs.img? - Galaxy S II Q&A, Help & Troubleshooting

I did like these.
Turn on adb
-------------------------------------------------------------------------
$ su
# cat /dev/block/mmcblk0p9 > /sdcard/factoryfs.img
cat /dev/block/mmcblk0p9 > /sdcard/factoryfs.img
# exit
exit
c:\adb>adb-windows pull /sdcard/factoryfs.img c:\factoryfs.img
3936 KB/s (536870912 bytes in 133.175s)
-------------------------------------------------------------------------
and pushed factoryfs.img into .tar -> factoryfs.tar
(a way of containing a file in .tar flashed well on odin with compressing program)
then I get my sgs2 rebooted in download mode and launched odin.
I connected my sgs2 at my PC and tried to flash factoryfs.tar, I get a message from odin : FAIL!.
Did I miss something?

Why backup factoryfs .
No idea what you are trying to accomplish .
jje

Backing up /system instead of CWM

CWM see post in Dev section work in progress by Chainfire .
jje

marbulas said:
I did like these.
Turn on adb
-------------------------------------------------------------------------
$ su
# cat /dev/block/mmcblk0p9 > /sdcard/factoryfs.img
cat /dev/block/mmcblk0p9 > /sdcard/factoryfs.img
# exit
exit
c:\adb>adb-windows pull /sdcard/factoryfs.img c:\factoryfs.img
3936 KB/s (536870912 bytes in 133.175s)
-------------------------------------------------------------------------
and pushed factoryfs.img into .tar -> factoryfs.tar
(a way of containing a file in .tar flashed well on odin with compressing program)
then I get my sgs2 rebooted in download mode and launched odin.
I connected my sgs2 at my PC and tried to flash factoryfs.tar, I get a message from odin : FAIL!.
Did I miss something?
Click to expand...
Click to collapse
I am trying to do the same thing. Can anyone help with this? The idea is to flash a rooted factoryfs.img so you don't have to have a rooted kernel. Some of us like to remain as close to stock as possible. This was easy on the SGS using RFS but I can't get it to work on the SGS2.

Related

[Q] Is this the right way to extract Modem for Odin?

Hi,
After searching and reading through the forum about extracting the modem from the phone and package it for Odin, there is no specific command for SGII that I can find.
So, please help me confirm if these are the correct steps. I want to backup my modem before flashing a new one through Odin.
--------------------------
adb shell
su
# dd if=/dev/block/mmcblk0p8 of=/sdcard/modem.bin bs=4096
Copy modem.bin to linux
$ tar -H ustar -cvf my_modem.tar modem.bin
$ md5sum -t my_modem.tar >> my_modem.tar
$ mv my_modem.tar my_modem.tar.md5
----------------------------
now, I can use the my_modem.tar.md5 file as a backup if I want to go back to the original modem, right?
Thanks.

[Q] full rom dump?

use to follow darky's tutorial for my i9000 do a system dump then write an odin flashable rom for backup,
but i have no clue what to dump on my i9100??
The most common partitions are:
/dev/block/mmcblk0p5 -> Kernel
/dev/block/mmcblk0p7 -> Cache
/dev/block/mmcblk0p8 -> Modem / Radio / Baseband (w/e you like to call it)
/dev/block/mmcblk0p9 -> System (factoryfs for Odin .tars)
/dev/block/mmcblk0p10 -> (user) data
i tried it, extracted all the files and created the tar but it fails as soon as i start it..
heres the commands i used :
dd if=/dev/block/mmcblk0p9 of=/sdcard/factoryfs.rfs bs=4096
dd if=/dev/block/mmcblk0p7 of=/sdcard/cache.rfs bs=4096
dd if=/dev/block/mmcblk0p5 of=/sdcard/zImage bs=4096
dd if=/dev/block/mmcblk0p8 of=/sdcard/modem.bin bs=4096
Click to expand...
Click to collapse
then
tar -H ustar -c factoryfs.rfs cache.rfs modem.bin zImage > rom.tar
Click to expand...
Click to collapse
and then md5 ... ?? what am i doing wrong?
Yeah, you can't just reflash raw dumps with Odin, unfortunately.
You can use them to restore via dd though.
But this thread might help for Odin flashing: (the re-packing part)
http://forum.xda-developers.com/showthread.php?t=1081239
read a bunch of threads from that link and so on,
i dont have a linux machine at work so i need to take this home and try but i honestly got my doubts, looks too complicated for a noob like me ha!
i need some easy tutorial to follow, i guess i just have to wait till someone actually writes it!
thank for the help though!

T959TLKG2 modem request

Hi,
Can anyone please provide me T959TLKG2 modem for download.
thanks in advance for any help given.
demetris_I said:
Hi,
Can anyone please provide me T959TLKG2 modem for download.
thanks in advance for any help given.
Click to expand...
Click to collapse
I don't think you can rip the modem.
Hi,
Thanks for your reply.
You can rip the modem using root explorer after you rooted the phone.
Browse system with root explorer and find modem.bin copy paste it onto sd card and the post it here
demetris_I said:
Hi,
Thanks for your reply.
You can rip the modem using root explorer after you rooted the phone.
Browse system with root explorer and find modem.bin copy paste it onto sd card and the post it here
Click to expand...
Click to collapse
I just searched EVERY directory, there is no modem.bin to be found. It can't be ripped in anyway with a stock rom.
Are you rooted?
With root, run adb and use:
adb shell
su
cat /dev/block/bml12 > /sdcard/modem.bin
dd if=/dev/block/bml12 of=/sdcard/modem2.bin bs=4096
exit
exit
Then md5 them to see if they are the same but i think cat /dev/block/bml12 > /sdcard/modem.bin will do the trick just fine.
demetris_I said:
Are you rooted?
With root, run adb and use:
adb shell
su
cat /dev/block/bml12 > /sdcard/modem.bin
dd if=/dev/block/bml12 of=/sdcard/modem2.bin bs=4096
exit
exit
Then md5 them to see if they are the same but i think cat /dev/block/bml12 > /sdcard/modem.bin will do the trick just fine.
Click to expand...
Click to collapse
I've got the modem.bin file for you, where can I put it so you can download it
EDIT: N/M I just made a mediafire account... I will post link as soon as I know which is proper file to post for you.
When I md5sum, I'm a little confused... heres what I did..
for one I did
md5sum -t t959_gb_modem.tar >> t959_modem.tar (not a type, did use different filenames)
mv t959_modem.tar t959_modem.tar.md5
This left me with 2 files... one which was the tar modem, 12.8mb,
t959_gb_modem.tar... and the other file was 1kb, t959_modem.tar.md5
The second time I did this...
md5sum -t t959_gb_modem.tar >> t959_gb_modem.tar (same filenames)
mv t959_gb_modem.tar t959_gb_modem.tar.md5
this left me with one file, 12.8mb, t959_gb_modem.tar.md5
I guess what I need to know is which is the proper method to use so the file will flash in ODIN.
As for the tar command, I use tar -H ustar -c modem.bin > t959_gb_modem.tar
thx, Maniac
I dont need odin flashable, just zip/rar it and upload it, thanks
Modem.bin should be 12,0 MB (12.582.912 bytes) when right click and select properties on it
Multiupload would be great.
http://www.multiupload.com/
thanks again
P.s
for odin flashable tar size should be:
Size:12,0 MB (12.585.032 bytes)
Size on disk: 12,0 MB (12.587.008 bytes)
After you have the correct modem.bin
Modem.bin should be 12,0 MB (12.582.912 bytes) when right click and select properties on it
Then to make it odin flashable you need a linux live cd or linux installation on hdd then:
tar -H ustar -c modem.bin > T959TLKG2.tar
MD5 it for a security check:
md5sum –t T959TLKG2.tar >> T959TLKG2.tar
Rename the tar file like this:
mv T959TLKG2.tar T959TLKG2.tar.md5
And you will have:
T959TLKG2.tar.md5
Odin flashable
The file I have is 12.8m so I think
there may be something wrong. But i'm at work now so I can't upload now.
Sent from Samsung Fascinate (XDA Prem)
No problem, and thanks.
Maybe you see what reported 12.288kb which is correct
Thanks for everything, modem found in full dump link by harimgs.
great modem btw

[Dev][Tool][Script to]Make ODIN flashable Roms ext4 devices

Hey fellas!!!
This is my first real contribution to my xda friends .I happy to share with you guys the script to make ODIN flashable rom for ext4 devices.
First of all I would like to say that this script currently supports only International variants of sgs2,sgs3 and SG Note.This is because I own only Note (similar to s2) and my friend has s3 which I used to make s3 compatible.I can support any devices if you guys can give me the required data
So now into the topic
In order to work with the script,you need the following:
A PC/Laptop with linux installed either as dualboot or in vm
A rooted Phone which supported by the script.
A usb cable
And of course you need your brain
Apart from the hardware,you will also need:
A stock rom from which you need to take the following:
cache.img
modem.bin
hidden.img
and a custom kernel(zImage) of you choice.(recovery.img and boot.img in case of s3)
Now download the script and do the following:
Extract ODIN-script.tar anywhere.
Run first_time.sh (Needed Only for the first time)
Put the above collected .img's,.bin and/or zImage inside ODIN-script directory
Connect your phone to PC/Laptop with usb debugging enabled.
Run the script and follow the instructions
Your Rom will be in the same directory in few mins
Note1:The Rom obtained by the above is not a full wipe rom.If you need to make it full wipe(factory reset),you need aditional empty data.img(for note/s2) or userdata.img(s3).I will upload data.img for Note.It "may" work on s2 too.But I havent tested.so its on your own risk
S3 users,I'm sorry I can help you .Because I dont know the size of /data partition to make an empty image.
Note2:You can always flash the rom with .pit and repartition.I have always used .pit to flash my rom.But still you are at your own risk.
Disclaimer:Do this at your own risk!!!I'm not responsible if you brick your phone.(Though you cannot if you do everything correctly )
Download link and changelog on next post.
And finally if you like my project and if you think you need to support me for future updates on this,Please do donate .And do not copy/edit/alter this work without my permission!!!
Download Links and changelogs
Changelog for v1:
Code:
[LIST]
[*]Initial release
[/LIST];)
Changelog for v2:
Code:
[LIST]
[*]Cleaned the code and redone entirely
[*]Added support for preload for some devices
[*]bug fixes
[/LIST]
Thanks to:
1.As-I9000 for zlibs and first_time.sh
vijai2011 said:
Reserved
Click to expand...
Click to collapse
Reserved!!!
really awesome...going to try now and let you know the feedback...
Ok...Thats good...Just an update...Dont add cache.img for now...It takes forever in recovery to flash....Found the issue and working on a fix
vijai2011 said:
Ok...Thats good...Just an update...Dont add cache.img for now...It takes forever in recovery to flash....Found the issue and working on a fix
Click to expand...
Click to collapse
thank you and i was about to test and i will refrain from doing that till you release the fix!
grgsiocl said:
thank you and i was about to test and i will refrain from doing that till you release the fix!
Click to expand...
Click to collapse
Hey...You can try it without cache.img as long as you have csc within you /system
But still if you have added cache.img,it will boot but only with couple of reboots and a looooong time in recovery
vijai2011 said:
Hey fellas!!!
Note1:The Rom obtained by the above is not a full wipe rom.If you need to make it full wipe(factory reset),you need aditional empty data.img(for note/s2) or userdata.img(s3).I will upload data.img for Note.It "may" work on s2 too.But I havent tested.so its on your own risk
[/COLOR]
Click to expand...
Click to collapse
If you needed FULL WIPE DATA - FACTORY RESET, you need to put the image cache file with the command wipe data...
as i9000 said:
If you needed FULL WIPE DATA - FACTORY RESET, you need to put the image cache file with the command wipe data...
Click to expand...
Click to collapse
Nope...instead I have added a empty data.img It will wipe off data...But didn't make it for s3 because I have heard s3 has /data and /sdcard combined.So if I make one for s3,it will wipe sdcard too.But need a confirmation on this
And I have fixed recovery issue too in v2 and it should be fine now.
Finally had a look on your script too.It also looks good.good job.nice work .May be we two can work together to make a kitchen???
Sent from my GT-N7000 using xda app-developers app
I used your script as guiding for customizing my own odin rom.
- I untarred my firmware.tar.md5
- $ simg2img system.img.ext4 system.raw
- $ sudo mount -t ext4 -o loop system.raw /tmp
I didn't change a thing and then repacked it
- make_ext4fs -s -l 512M -a system newsystem.img.ext4 /tmp
- chown 1000:1000 newsystem.img.ext4
- packed everything with $tar -H ustar -cvf out.tar *.img.* fat.bin
- signed the package md5sum -t out.tar >> out.tar
- mv out.tar out.tar.md5
I flashed it, had no problems, but after the flashing i see "failed to mount /system (invalid argument)
And as my system partition doesn't get mounted, i cant startup my phone.
Does anyone have a clue on what i could be doing wrong?
1bymany said:
I used your script as guiding for customizing my own odin rom.
- I untarred my firmware.tar.md5
- $ simg2img system.img.ext4 system.raw
- $ sudo mount -t ext4 -o loop system.raw /tmp
I didn't change a thing and then repacked it
- make_ext4fs -s -l 512M -a system newsystem.img.ext4 /tmp
- chown 1000:1000 newsystem.img.ext4
- packed everything with $tar -H ustar -cvf out.tar *.img.* fat.bin
- signed the package md5sum -t out.tar >> out.tar
- mv out.tar out.tar.md5
I flashed it, had no problems, but after the flashing i see "failed to mount /system (invalid argument)
And as my system partition doesn't get mounted, i cant startup my phone.
Does anyone have a clue on what i could be doing wrong?
Click to expand...
Click to collapse
If you did exactly what you posted,then,
1. You should not have got system.img.ext4 but system.img and so simg2img is simg2img system.img system.img.ext
2./temp in mount command would be your temp filesystem where system files are stored.Use a relative path like TempDir in your PWD
3. Are you sure the make_ext4fs line is correct?You said you used my script as reference and I have never used that command at all.Its like:
Code:
sudo ./mkuserimg.sh -s TempDir factoryfs.img ext4 ./temp 893386752B
(in mb is also fine)
where the numbers indicate the size of system partition in Bytes.Be sure to cd to ext4_utils before executing this command and should always be run as sudo as the mount is done as sudo.And donot include .ext4 at the end.Use just img.Works better.
4.again...chown should be sudo.As the img is owned by root and so you cannot chown it with basic user permissions.Simple user hierarchy
5.You did a blunder here in tar command if you put the original system.img and the newly packed img in the same directory.As the command will include all .img's which we donot want.
vijai2011 said:
If you did exactly what you posted,then,
1. You should not have got system.img.ext4 but system.img and so simg2img is simg2img system.img system.img.ext
2./temp in mount command would be your temp filesystem where system files are stored.Use a relative path like TempDir in your PWD
3. Are you sure the make_ext4fs line is correct?You said you used my script as reference and I have never used that command at all.Its like:
Code:
sudo ./mkuserimg.sh -s TempDir factoryfs.img ext4 ./temp 893386752B
(in mb is also fine)
where the numbers indicate the size of system partition in Bytes.Be sure to cd to ext4_utils before executing this command and should always be run as sudo as the mount is done as sudo.And donot include .ext4 at the end.Use just img.Works better.
4.again...chown should be sudo.As the img is owned by root and so you cannot chown it with basic user permissions.Simple user hierarchy
5.You did a blunder here in tar command if you put the original system.img and the newly packed img in the same directory.As the command will include all .img's which we donot want.
Click to expand...
Click to collapse
First of all, thanks for the reply.
second:
1. My phone is not rooted yet, it's a GT-S6500D aka Samsung galaxy tab. So I used a firmware.tar.md5 (that i have flashed to test and works)
and in this firmware.tar.md5 i have following files: boot.img, cache.img.ext4, fat.bin, hidden.img.ext4, recovery.img and system.img.ext4
So the system.img.ext4 wasn't a typo and the system.raw is just an arbitrary name i have chosen.
2. I don't get the mountpoint. Is this the mountpoint on the phone? of on my computer?
3. I have analysed the mkuserimg.sh script, and it is just a wrapper that flips the argument order. I have no clue why they made it..
So i doubt my problem would be in this line, but I will try, as i don't know what else can go wrong
4. chown should indeed be sudo, no doubt about that I just didn't type it here
5. I skipped this step a bit in the explanation, but i made the sure the directory only concluded the necessary files, naming the original files from step 1 or modified files.
6. I don't know if this could help, but if i unpack for example system.img.ext4 and repack it again, the new file will be bigger then the original one.. I was thinking maybe Samsung adjusted some things, but maybe i need some more arguments in my make_ext4fs command..
grtz
Fixed it!
The problem was that i was using a size of 512M without knowing where it came from.
I flashed the original firmware back to the phone, did a
Code:
adb shell "df /system "
to know what size my img needed to be. In my case it was a total size of 492M. So i used following command to make my system.img.ext4
Code:
make_ext4fs -s -l 492M -a system system.img.ext4 /system
Now trying to pack my own kernel in the boot.img
thanks for the support!
1bymany said:
Fixed it!
The problem was that i was using a size of 512M without knowing where it came from.
I flashed the original firmware back to the phone, did a
Code:
adb shell "df /system "
to know what size my img needed to be. In my case it was a total size of 492M. So i used following command to make my system.img.ext4
Code:
make_ext4fs -s -l 492M -a system system.img.ext4 /system
Now trying to pack my own kernel in the boot.img
thanks for the support!
Click to expand...
Click to collapse
Sorry for the late response .got a little busy.Happy that you solved it .Just an hint,you can use -h to see the size better readable by humans(In M and G) in df command incase you find its in kb or B
Sent from my GT-N7000 using xda app-developers app
Updated to v2
vijai2011 said:
Updated to v2
Click to expand...
Click to collapse
thanks man

Help: Rebuild img for change language

Add language
I test samsung s2 i9100
Extract I9100XXLPQ.tar.md5 --> factoryfs.img (sgs2toext4.jar) --> factoryfs.ext4.img
Ubuntu
...
mkdir /mnt/system
mount factoryfs.ext4.img /mnt/system
cp framework/*.apk /mnt/system/framework/ <---Language change here
cp app/*.apk /mnt/system/app/ <---Language change here
tar cvf factoryfs.img /mnt/system <---suspect here (!)
e2fsck factoryfs.img <--- can abort
umount /mnt/system
step1:
tar cvpf factoryfs.tar factoryfs.img
md5sum -t factoryfs.tar >> factoryfs.tar
mv factoryfs.tar factoryfs.tar.md5
factoryfs.tar.md5 flash with odin failed
step2:
tar -H ustar -c boot.bin cache.img factoryfs.img hidden.img modem.bin param.lfs Sbl.bin zImage > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
your_odin_package.tar.md5 flash with odin
boot.bin ok
cache.img ok
factoryfs.img <--- failed here
....stop here.....
please, help me!
Thanks!
thanhlapvn said:
Add language
I test samsung s2 i9100
Extract I9100XXLPQ.tar.md5 --> factoryfs.img (sgs2toext4.jar) --> factoryfs.ext4.img
Ubuntu
...
mkdir /mnt/system
mount factoryfs.ext4.img /mnt/system
cp framework/*.apk /mnt/system/framework/ <---Language change here
cp app/*.apk /mnt/system/app/ <---Language change here
tar cvf factoryfs.img /mnt/system <---suspect here (!)
e2fsck factoryfs.img <--- can abort
umount /mnt/system
step1:
tar cvpf factoryfs.tar factoryfs.img
md5sum -t factoryfs.tar >> factoryfs.tar
mv factoryfs.tar factoryfs.tar.md5
factoryfs.tar.md5 flash with odin failed
step2:
tar -H ustar -c boot.bin cache.img factoryfs.img hidden.img modem.bin param.lfs Sbl.bin zImage > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
your_odin_package.tar.md5 flash with odin
boot.bin ok
cache.img ok
factoryfs.img <--- failed here
....stop here.....
please, help me!
Thanks!
Click to expand...
Click to collapse
I think tar cvf factoryfs.image is basically just a tar file not a repacked ext4.image file so i think you should use the command or a tool to repack the image file and that you should continue step 1 or 2 with the repacked file, so what I am suggesting is you dont need these two lines
tar cvf factoryfs.img /mnt/system <---suspect here (!)
e2fsck factoryfs.img <--- can abort
after unmount, repack it in whatever way you like ,then proceed with step 1 or 2 with the repacked file.
Edit:And by repacking I dont mean compressing into a tar again, there maybe tools available for repacking.
Hmm I been meaning to ask you but did you try pushing both apk via a signed zip file through the stock recovery?
Sent from my GT-I9100 using xda app-developers app
king_below_my_lord said:
Hmm I been meaning to ask you but did you try pushing both apk via a signed zip file through the stock recovery?
Sent from my GT-I9100 using xda app-developers app
Click to expand...
Click to collapse
I create update zip (cwm) change language ok but i like build md5 flash via odin (no need recovery, no need root, no need update ver same ver pack update...)
thanhlapvn said:
I create update zip (cwm) change language ok but i like build md5 flash via odin (no need recovery, no need root, no need update ver same ver pack update...)
Click to expand...
Click to collapse
Lol, yeah to each his own preferences. But I always prefer the shortest way, where minimal action is needed, and with root I can make most changes from inside the OS, but I am intrigued which language did you insert?
Edit :Since the matter is over add Solved in title.
Sent from my GT-I9100 using xda app-developers app

Categories

Resources