[GUIDE] Extract .rfs files - Galaxy S I9000 Android Development

I came from HTC Hero to the Samsung Galaxy S GT-I9000
So I had never problems with cooking something up, but in the Galaxy I faced .rfs files and a flashing tool I can't use on linux...
So I searched through some boards to find a way to extract the .rfs files here a working guide for the S I9000.
What you need
Linux (tested with Debian testing)
It's pretty simple, execute this commands as root on your computer
SHORT WAY (thanks to mimocan)
Code:
# mount -o loop factory.rfs /some_dir
LOOOONG WAY
Attatch the rfs file to the loop device
Code:
# losetup /dev/loop0 /somedir/factoryfs.rfs
Create a directory to mount the device
Code:
# mkdir /somedir/mnt
Mount the device
Code:
# mount /dev/loop0 /somedir/mnt
the content of the rfs is NOT saved on the sdcard! you have to copy it!
Now you can copy the content from the /sdcard/tmp directory to the sdcard
Code:
# cp -R /somedir/mnt /somedir/factoryfs
hope this is helpful for someone

Code:
#mount -o loop factory.rfs /some_dir
should do the same

This works because rfs is based on vfat.
But have you ever tried this on cache.rfs or dbdata.rfs?
The mounted folder is empty. The cache.rfs in my case was around 1.2 mb.
Maybe the 1.2 mb are journaling data rfs uses?
I also tried mounting cache.rfs and dbdata.rfs directly on my sgs without any luck.
Since the phone has built in rfs drivers it should be able to mount it.

psternx said:
This works because rfs is based on vfat.
But have you ever tried this on cache.rfs or dbdata.rfs?
The mounted folder is empty. The cache.rfs in my case was around 1.2 mb.
Maybe the 1.2 mb are journaling data rfs uses?
I also tried mounting cache.rfs and dbdata.rfs directly on my sgs without any luck.
Since the phone has built in rfs drivers it should be able to mount it.
Click to expand...
Click to collapse
If you open the cache.rfs or dbdata.rfs from a PDA build (tested I900XXJP3) in a hexeditor you will see they are empty, just the headers and a lot of zeros

Have you been able to modify something from a rfs file and save it?

Actually Cache.rfs file in CSC is a renamed update.zip. At least with a few firmwares I have tried. So just open it with, for example, 7-zip and you can browse the files.

deleted............

Tried to mount a cache.rfs and got a "Device or resource busy".
Then tried to open it trough MagicISO, and voilá, I got the CSC files I needed

Now im into modifying factoryfs.rfs and hoping you can give me some tips.
Alt1
mount -o loop factoryfs.rfs directory & Copy files to a new place and edit them but how to create a .rfs from that point?
Alt2
sudo mount -v -o rw,loop,uid=$UID factoryfs.rfs Directory
Edit the files , umount the .rfs . Mount it again but the the changes are gone.
How do you do it?
Thanks.

a-son said:
Now im into modifying factoryfs.rfs and hoping you can give me some tips.
Alt1
mount -o loop factoryfs.rfs directory & Copy files to a new place and edit them but how to create a .rfs from that point?
Alt2
sudo mount -v -o rw,loop,uid=$UID factoryfs.rfs Directory
Edit the files , umount the .rfs . Mount it again but the the changes are gone.
How do you do it?
Thanks.
Click to expand...
Click to collapse
for me, i'll definitelty mod it elsewhere

ykk_five said:
for me, i'll definitelty mod it elsewhere
Click to expand...
Click to collapse
Thanks for answer.
Alt 1 i suppose you mean. But how to create the .rfs ?

a-son said:
Thanks for answer.
Alt 1 i suppose you mean. But how to create the .rfs ?
Click to expand...
Click to collapse
yess!!!!
how to recompile the .rfs ?????

KBJ911 said:
yess!!!!
how to recompile the .rfs ?????
Click to expand...
Click to collapse
BUMP!
Actually some cache.rfs aren't simple renamed zipfiles, as they (i.e. multi-csc) also contains more stuff
So I loopmounted rw the vfat cache.rfs, extracted and modified the contained sec_csc.zip (this one IS an update.zip structured file...)
But when I put it inside, sync, unmount and mount again to verify stuff, I got a corrupted filesystem and a corrupted zip file.
Any clue to successfully modify contents of such .rfs ?

mopodo said:
I came from HTC Hero to the Samsung Galaxy S GT-I9000
So I had never problems with cooking something up, but in the Galaxy I faced .rfs files and a flashing tool I can't use on linux...
So I searched through some boards to find a way to extract the .rfs files here a working guide for the S I9000.
What you need
Linux (tested with Debian testing)
It's pretty simple, execute this commands as root on your computer
SHORT WAY (thanks to mimocan)
Code:
# mount -o loop factory.rfs /some_dir
LOOOONG WAY
Attatch the rfs file to the loop device
Code:
# losetup /dev/loop0 /somedir/factoryfs.rfs
Create a directory to mount the device
Code:
# mkdir /somedir/mnt
Mount the device
Code:
# mount /dev/loop0 /somedir/mnt
the content of the rfs is NOT saved on the sdcard! you have to copy it!
Now you can copy the content from the /sdcard/tmp directory to the sdcard
Code:
# cp -R /somedir/mnt /somedir/factoryfs
hope this is helpful for someone
Click to expand...
Click to collapse
Is there a way to convert it back to rfs?

@all
Is there a way to convert it back to rfs?

criskelo said:
@all
Is there a way to convert it back to rfs?
Click to expand...
Click to collapse
If you used the shortway # mount -o loop factory.rfs /some_dir
than you can modify the files in some_dir.
when finished simple un mount the some_dir and the files are saved in the factory.rfs
Then tar and md5 the factory.rfs and you can flash it with odin

in windows use "magiciso" to extract .rfs

lownoise said:
Then tar and md5 the factory.rfs and you can flash it with odin
Click to expand...
Click to collapse
I lost at there, what does that means?

From linux
fastcx said:
I lost at there, what does that means?
Click to expand...
Click to collapse
From the linux command line you have to use
tar -cf filename.tar factory.rfs
md5sum filename.tar >filename.tar.md5

If you have extracted it with MagicISO and now just want to create it back to factoryfs.rfs can I do this with Cygwin and what would the command line be?

Related

[GUIDE] How to make an Odin ROM

How to make an Odin flashable ROM
This is just a small guide I want to share with anyone who's interested in the commands I personally use. Feel free to correct me or give better commands / instructions.
@Moderators:
If this thread is in the wrong section or already present at XDA, PM me.
This needs a UNIX compatible OS - like Linux or Mac OS X.
On Windows, you can use "Cygwin".
Click to expand...
Click to collapse
Use the dd (datadump) command to make the .rfs files
Of course you need to connect your phone via USB and have ADB prepared on your computer.
# Get Root access first
Code:
su
# Do this first to mount the /system R/W
(thanks to scheichuwe for the simplified command)
Code:
mount -o remount,rw /dev/block/stl9 /system
# Dump the needed data / partitions to your /sdcard
Code:
dd if=/dev/block/stl9 of=/sdcard/factoryfs.rfs bs=4096
dd if=/dev/block/stl11 of=/sdcard/cache.rfs bs=4096
dd if=/dev/block/bml7 of=/sdcard/zImage bs=4096
dd if=/dev/block/bml12 of=/sdcard/modem.bin bs=4096
# Make the tar ball
Code:
tar -H ustar -c factoryfs.rfs cache.rfs modem.bin zImage > darky.tar
# MD5 it for a security check
Code:
md5sum –t darky.tar >> darky.tar
# Rename the tar file
Code:
mv darky.tar darky.tar.md5
Optional:
Make your own pit file
The pit file is used to set the partition layout (Partition Information Table).
# Dump the pit
Code:
dd if=/dev/block/bml2 of=/sdcard/darky.pit bs=4096
I hope I could help you with that
- darkyy.
Nice
Yeah first
Oh and one more thing:
If someone is gonna rate this thread 1 star, please explain here why.
So this means I can make an Odin rom of my current installed config? Or am I missing something?
If you then flash your tar + pit, you have your kernel and rom restored? This would be an awesome way to backup a good config, no?
VenQWish said:
So this means I can make an Odin rom of my current installed config? Or am I missing something?
If you then flash your tar + pit, you have your kernel and rom restored? This would be an awesome way to backup a good config, no?
Click to expand...
Click to collapse
Exactly - these commands will dump the data directly from your current phone.
And yes, you'll have a 1 to 1 Backup.
That is actually VERY useful! I'm constantly switching between a modded Insanity and CM7, and constantly reverting to stock, flashing custom kernels and flashing nandroids is getting quite annoying now.
Don't have access to a linux machine now, I'll try this asap, thanks!
Wow, dasch mal nützlich ville dank^^
Neat. Thank you!
Quipeace said:
That is actually VERY useful! I'm constantly switching between a modded Insanity and CM7, and constantly reverting to stock, flashing custom kernels and flashing nandroids is getting quite annoying now.
Don't have access to a linux machine now, I'll try this asap, thanks!
Click to expand...
Click to collapse
Well you can install cygwin, just remember to install bash terminal when cygwin setup is running.
Sent from my GT-P1000 using Tapatalk
Code:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
Galaxy S is running on yaffs2? Interesting
Code:
mount -o rw,remount /system
That should work too...
Is this the same as this?
http://forum.xda-developers.com/showthread.php?t=943588
Mackzen said:
Is this the same as this?
http://forum.xda-developers.com/showthread.php?t=943588
Click to expand...
Click to collapse
No:
The instructions from drakyy create a flashable ROM from the phone.
The Application from bohdans creates a flashable ROM from files on your computer
scheichuwe said:
Galaxy S is running on yaffs2? Interesting
Code:
mount -o rw,remount /system
That should work too...
Click to expand...
Click to collapse
Thanks - gonna change it in the first post
Verified?
Cool stuff Darkyy,
is this working without any issues, any testers?
mr_at_sgs said:
Cool stuff Darkyy,
is this working without any issues, any testers?
Click to expand...
Click to collapse
It's what we used for the Darky's Resurrection Edition
Damn. Left my laptop charger at work. Just when I need battery also.
Great thread. Thank you.
Tricky103 UltraSlim Essential Rom on DamianGTO Ultimate kernel
I have a problem. When tryign to create the tar-file i get:
cannot create jesper.tar: read-only file system.
What to do?
Does this also work when the partitions are NOT RFS.
Like all in ext4?
Will Odin be able to flash that image?
I somehow doubt it...
zurchpet said:
Does this also work when the partitions are NOT RFS.
Like all in ext4?
Will Odin be able to flash that image?
I somehow doubt it...
Click to expand...
Click to collapse
Good question..... I'd like to know this too..
Although even if having to disable lag fix to create it the apply again after flashing is still a quicker way to toggle between your current rom and cm7..
Neat Darky
but can i do these dumps on the phone without a pc or adb
Sent from my GT-I9000 using XDA App
Perhaps some could write a script to do this at the phone
Sent from my GT-I9000 using XDA App

NT: Build root filesystem

Extracting the N2 root filesystem and adding rc.local
These instructions assume using a linux console.
The root filesystem lives in a u-boot/PPCboot ramdisk. These instructions tell you how to extract it.
Boot your nt with the "rooted forever" sdcard while connected with usb.
Make a copy of the boot partition. After this you may reboot your nt normally.
$ tar -cf boot.tar boot/
$ tar xvf boot.tar
$ cd boot
Extract the uRamdisk file. first 64 bytes is the u-boot header, we need to skip it.
$ dd if=URamdisk bs=64 skip=1 of=ramdisk.gz
ramdisk.gz now contains the root file system.
Copy ramdisk.gz to a work directory, then extract it:
gunzip -v ramdisk.gz
cpio -iv < ramdisk
The root file system will populate your work dir. Delete the ramdisk file. You can now make changes to the root file system.
The change I'm going to make is a simple one: adding the ability to run an rc.local file at boot.
edit the init.rc file in your work directory, adding at the bottom:
Code:
service rclocal /etc/rc.local
enabled
user root
oneshot
rebuilding the uRamdisk file is simple, once you know how (thanks to JesusFreke for pointing me in the right direction). cd into your working directory, issue these commands:
Code:
find . -regex "./.*"| cpio -ov -H newc | gzip > ../ramdisk.gz
mkimage -A ARM -T RAMDisk -n Image -d ../ramdisk.gz ../uRamdisk
A script with the the commands above is attached. Also attached is a rooted uRamdisk with the rc.local ability already build in. To replace the uRamdisk file, boot with your "Rooted Forever" sdcard, and copy the uRamdisk file to the nook's boot directory.
What's this good for? That's up to you. I'm using it to automatically start dropbear so I can ssh in my Nooks and also use rsync to keep them synced with my ebook library. This is also one of the steps in building a kernel for the Nook ST.
jocala said:
Extracting the N2 root filesystem and adding rc.local
These instructions assume using a linux console.
The root filesystem lives in a u-boot/PPCboot ramdisk. These instructions tell you how to extract it.
Boot your nt with the "rooted forever" sdcard while connected with usb.
Make a copy of the boot partition. After this you may reboot your nt normally.
$ tar -cf boot.tar boot/
$ tar xvf boot.tar
$ cd boot
Extract the uRamdisk file. first 64 bytes is the u-boot header, we need to skip it.
$ dd if=URamdisk bs=64 skip=1 of=ramdisk.gz
ramdisk.gz now contains the root file system.
Copy ramdisk.gz to a work directory, then extract it:
gunzip -v ramdisk.gz
cpio -iv < ramdisk
The root file system will populate your work dir. Delete the ramdisk file. You can now make changes to the root file system.
The change I'm going to make is a simple one: adding the ability to run an rc.local file at boot.
edit the init.rc file in your work directory, adding at the bottom:
Code:
service rclocal /etc/rc.local
enabled
user root
oneshot
rebuilding the uRamdisk file is simple, once you know how (thanks to JesusFreke for pointing me in the right direction). cd into your working directory, issue these commands:
Code:
find . -regex "./.*"| cpio -ov -H newc | gzip > ../ramdisk.gz
mkimage -A ARM -T RAMDisk -n Image -d ../ramdisk.gz ../uRamdisk
A script with the the commands above is attached. Also attached is a rooted uRamdisk with the rc.local ability already build in. To replace the uRamdisk file, boot with your "Rooted Forever" sdcard, and copy the uRamdisk file to the nook's boot directory.
What's this good for? That's up to you. I'm using it to automatically start dropbear so I can ssh in my Nooks and also use rsync to keep them synced with my ebook library. This is also one of the steps in building a kernel for the Nook ST.
Click to expand...
Click to collapse
dd if=URamdisk bs=64 skip=1 of=ramdisk.gz
Click to expand...
Click to collapse
"uRamdisk" instead of "URamdisk"
Thanks again.

[ROOT ICS] The hard way && Digging for roots

For anyone that doesn't want to root the hard way crossix has come up with a double click root for Windows forum.xda-developers.com/showpost.php?p=23052186&postcount=105
Update 2/26/12
/system can now be mounted writable see the bottom of this post.
So the old Honeycomb exploit has now been patched in ICS. But there was an exploit found in the newer ICS kernels. Written by saurik,: called mempodroid
There is an offset needed as an argument to the binary, for the a100 we'll use what has worked for the a200 as noted in sauriks github linked above.
The issue with this is mounting /system as writable. I'm not sure if it's something in ICS, but it appears to be write protected. As noted here and here we will loop mount the system partition.
The tools needed are:
1. mempodroid under Usage Instructions, download pre-compiled
2. busybox 1.20 snapshot 3-10-12
3. su the latest from androidsu.com, extract from system/bin
4. mount.txt script
After downloading and extracting place them all in a folder called tools.
This must be done with adb. Issue the following from cmd or a terminal:
Code:
$ adb shell mkdir /data/local/tools
$ adb push tools /data/local/tools ; adb shell
$ cd /data/local ; chmod 755 tools/*
$ cd tools ; ./mempodroid 0xd9f0 0xaf47 sh
If all went well you should be at a hash # prompt. This is temp root.
mount /system rw the new way:
Code:
# PATH=$PWD:$PATH
# sh mount.txt -o remount,rw /system
Copy su and busybox to /system
Code:
# ./busybox cp busybox /system/xbin; ./busybox cp su /system/xbin/
# chmod 6755 /system/xbin/su
Install busybox
Code:
# cd /system/xbin
# for i in $(busybox --list); do ln -s busybox $i; done; sync
Copy the mount script
If busybox is updated this step must be run again
Code:
# cp /data/local/tools/mount.txt /system/bin/mount
# cp /data/local/tools/mount.txt /system/xbin/mount
Done your a100 should be rooted
the old way:
Now lets loop mount /system
Code:
[b]This is no longer needed[/b]
# ./busybox losetup -o $((512 * 51200)) /dev/block/loop7 /dev/block/mmcblk0
Code:
# ./busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3
# mkdir loop ; mount -t ext4 /dev/block/loop7 loop
Copy su and busybox to the new mount point.
Code:
# ./busybox cp su loop/xbin/ ; ./busybox cp busybox loop/xbin/
# chmod 6755 loop/xbin/su ; sync
If it worked your a100 is fully rooted. Make sure to install SuperUser from the Market.
Either get busybox installer from the market, and install it to /data/local/tools/loop/xbin
Or:
Code:
# cd loop/xbin
# for i in $(busybox --list); do ln -s busybox $i; done; sync
The mount point won't survive a reboot so in order to write to /system again run:
Code:
# busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3
# mount -t ext4 /dev/block/loop7 /data/local/tools/loop
[update 2/26/12]
To mount /system as writable do the following from adb. We'll just make a directory called /data/loop for easy access.
Code:
$ adb shell
$ su
# stop
[b]your screen will go black[/b]
# mkdir /data/loop
[b]skip this if the loop is already set up
# busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3[/b]
# mount -t ext4 /dev/block/loop7 /data/loop
# mount -o bind /data/loop /system
# start
You can write to /system with any app but /system can't be remounted ro then back to rw.
This can be added to /etc/install-recovery.sh to make it permanent
Code:
busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3
mount /dev/block/loop7 /data/loop
mount -o bind /data/loop /system
Thanks to crossix as the first to get temp root, and Icewyng for pointing out the exploit and helping with the magic number.
Ill be testing this when I get home, if it works Ill attempt to write a 1 command script to do it.
Sent from my MB860 using XDA App
OK...
Testing this out and found there were a couple of bugs.
You didn't have a "loop" folder created so I made one in the "tools" folder.
and, when mounting, you need to specify -t ext4.
Here are the revised commands for # mount /dev/block/loop7 loop
mkdir loop;mount -t ext4 /dev/block/loop7 /data/local/tools/loop
I noticed that the files /data/local/tools/loop/xbin/su and /data/local/tools/loop/xbin/busybox don't exist on /system/xbin until after a restart.
Finally, the busybox we are using to install doesn't seem to make all of the links to all of the nice commands we are used to, so things like grep, cp, etc... they won't work. I'm trying to figure out how to re-run the GUI busybox installer and point it to the loop folder, but haven't had much success.
danifunker said:
OK...
Testing this out and found there were a couple of bugs.
You didn't have a "loop" folder created so I made one in the "tools" folder.
and, when mounting, you need to specify -t ext4.
Here are the revised commands for # mount /dev/block/loop7 loop
mkdir loop;mount -t ext4 /dev/block/loop7 /data/local/tools/loop
I noticed that the files /data/local/tools/loop/xbin/su and /data/local/tools/loop/xbin/busybox don't exist on /system/xbin until after a restart.
Finally, the busybox we are using to install doesn't seem to make all of the links to all of the nice commands we are used to, so things like grep, cp, etc... they won't work. I'm trying to figure out how to re-run the GUI busybox installer and point it to the loop folder, but haven't had much success.
Click to expand...
Click to collapse
You beat me to the punch... was about to point it out.
Not sure what version of busybox this is but I will try with 1.19.2 and see how it goes.
Edit: Got root! It works great... for Busybox, use Busybox Installer to be able to get the latest version (1.19.4) I confirm that system is R/O for now.
danifunker said:
OK...
Testing this out and found there were a couple of bugs.
You didn't have a "loop" folder created so I made one in the "tools" folder.
and, when mounting, you need to specify -t ext4.
Here are the revised commands for # mount /dev/block/loop7 loop
mkdir loop;mount -t ext4 /dev/block/loop7 /data/local/tools/loop
I noticed that the files /data/local/tools/loop/xbin/su and /data/local/tools/loop/xbin/busybox don't exist on /system/xbin until after a restart.
Finally, the busybox we are using to install doesn't seem to make all of the links to all of the nice commands we are used to, so things like grep, cp, etc... they won't work. I'm trying to figure out how to re-run the GUI busybox installer and point it to the loop folder, but haven't had much success.
Click to expand...
Click to collapse
I did have some typos, think it's right now. That is an old busybox, it was just a quick find and it includes losetup but it's not one to use full time. Maybe sync is needed at the end so files are written properly. I didn't have to use -t ext4 with HC, but Ill add it to the OP
[edit] you have to use "busybox cp or busybox grep" I didn't include a way to add all the symlinks. Wow I have typos everywhere it's the end of the day for me, working nights.
Ok ... Got root!
Titanium works, Busybox Installer works, Superuser works, Root Explorer works...
Only thing is that System is R/O but we will work on it.
Waiting for a R/W system...and then, no one will stop my update
I can't get it to root :-(
It say not found
Sent from my A100 using xda premium
jondi23 said:
I can't get it to root :-(
It say not found
Sent from my A100 using xda premium
Click to expand...
Click to collapse
At what point, need some more details.
The tools folder gets pushed (the 3 files are copied) but then it says there is no such folder.
edit: never mind - i created the folder manually and pushed the files into the folder
edit2: rooted - thakns guys
Brilliat work, will try this later (need to get the sdk all set up again, I've been distro swapping). Got a pool match tonight too, so will try as soon as I can, will give whatever feedback I can later.
myprecious27 said:
The tools folder gets pushed (the 3 files are copied) but then it says there is no such folder.
edit: never mind - i created the folder manually and pushed the files into the folder
Click to expand...
Click to collapse
I forgot adb can't push a whole directory, it instead only copies the files within the directory.
wait how is it rooted if it's r/o I thought point of root was to make the file system r/w... er is root just allowing you to view all directories? Sorry for a noobish question, but you gotta start somewhere right?
rando152 said:
wait how is it rooted if it's r/o I thought point of root was to make the file system r/w... er is root just allowing you to view all directories? Sorry for a noobish question, but you gotta start somewhere right?
Click to expand...
Click to collapse
Well I think if we have su working we will be able to mount /system rw in some way if not directly. I cant imagine not being able to.
In any case though being able to write to /data as root is very useful. Example: Hulu flash fix.
You can't view /data if you're not root. That's one thig. Also, other functions may require root, like advanced networking things, etc.
I agree, not being able to write to /system is a major inconvenience, but most of the root programs will still work, as long as you're not writing to /system.
Since this is a temp root, does it mean that I will have to reroot every time I reboot? Will apps like Adfree work on this?
better yet is there a way we can do this solely on the tab? im away for work for another 4 weeks and only have my cell and a100 with me :-(
Sent from my SGH-I897 using xda premium
I get
Code:
255|[email protected]:/data/local/tools # mount -t ext4 /dev/block/loop7 /data/local
/tools/loop
lock/loop7 /data/local/tools/loop <
mount: Invalid argument
simoneser said:
I get
Code:
255|[email protected]:/data/local/tools # mount -t ext4 /dev/block/loop7 /data/local
/tools/loop
lock/loop7 /data/local/tools/loop <
mount: Invalid argument
Click to expand...
Click to collapse
I noticed the same thing happen after you root it and restart... not sure what to do next. Are you at temp loop?
simoneser said:
I get
Code:
255|[email protected]:/data/local/tools # mount -t ext4 /dev/block/loop7 /data/local
/tools/loop
lock/loop7 /data/local/tools/loop <
mount: Invalid argument
Click to expand...
Click to collapse
danifunker said:
I noticed the same thing happen after you root it and restart... not sure what to do next. Are you at temp loop?
Click to expand...
Click to collapse
try:
Code:
# busybox losetup -d /dev/block/loop7
# busybox losetup -o $((512 * 51200)) /dev/block/loop7 /dev/block/mmcblk0
# mount -t ext4 /dev/block/loop7 /data/local/tools/loop
The first line may produce
losetup: /dev/block/loop7: No such device or address
If it's not looped
After you are rooted the above can be run without adb from a terminal as su.
The mount point can be anywhere ex. /sdcard/loop instead of /data/local/tools/loop

ext4 extraction from system.sin issues

Hi,
As you probably know, ext4 image can be extracted from system.sin but cannot be mounted. When trying to mount it, it fails with :
[ 1476.821582] EXT4-fs (loop0): bad geometry: block count 262144 exceeds size of device (144631 blocks)
I open this thread just to share what I did around the issue and maybe have some helpful quotes about it
Here is what I did (under linux)
# First create an zero filled file. Size is system partition size (262144 blocks of 4096 each)
dd if=/dev/zero of=/home/xperia/virtualfs bs=4096 count=262144
# Attach file to loopback
sudo losetup /dev/loop0 /home/xperia/virtualfs
# Format it with same features as system partition on phone
sudo mkfs.ext4 -O has_journal,^ext_attr,^dir_index,^flex_bg,^huge_file,resize_inode,filetype,extent,sparse_super,large_file,^uninit_bg,^dir_nlink,^extra_isize -v /dev/loop0
# Write extracted system.sin.ext4 extracted image to loopback
sudo dd if=system.sin.ext4 of=/dev/loop0
# Mount filesystem
sudo mount /dev/loop0 /mnt
It can be mounted and I can have folder structure but I can't work with files. Editing default.prop gives me a non readable file.
But we can go a step ahead as we can now mount the image.
Still some issues have to be worked out.
The poit is, why we cant mount system.img on ICS but we can on GB?
maybe someone can contact with sony t oask
im extracting the .sin to .img like always but its impossible to mount.. what are you using to extract the .sin to a .ext4?
BTW, thanks for the info, i've been trying to modify system.img since ICS appeared.
EDIT: of, ext4 can be extracte with flashtool ~.~
maybe we need to read something from system.partinfo
Yakandu said:
The poit is, why we cant mount system.img on ICS but we can on GB?
maybe someone can contact with sony t oask
im extracting the .sin to .img like always but its impossible to mount.. what are you using to extract the .sin to a .ext4?
BTW, thanks for the info, i've been trying to modify system.img since ICS appeared.
EDIT: of, ext4 can be extracte with flashtool ~.~
maybe we need to read something from system.partinfo
Click to expand...
Click to collapse
Yes Flashtool can extract image from system.sin.
partinfo is partition information used by loader in flashmode to identify where to flash image on phone. (Something like start nand address of system partition)
so, any ideas why ext4 cant be mounted? maybe its encrypted or something..
Sorry for double post, i found a solution
Flash the system through a .ftf with flashtools
Flash a custom kernel with recovery (or the nozomi recovery)
Backup nandroid
We get a system.ext4.tar ··· move it to your developement folder
Create a folder (mkdir system)
Enter nautilus with root acces
Extract system files to the created folder
Modify whatever you want
Make a flashable system.img with: "./mkuserimg.sh -s /system ./system.img ext4 ./temp 1024M"
AND ITS WORKING!
Yakandu said:
Sorry for double post, i found a solution
Flash the system through a .ftf with flashtools
Flash a custom kernel with recovery (or the nozomi recovery)
Backup nandroid
We get a system.ext4.tar ··· move it to your developement folder
Create a folder (mkdir system)
Enter nautilus with root acces
Extract system files to the created folder
Modify whatever you want
Make a flashable system.img with: "./mkuserimg.sh -s /system ./system.img ext4 ./temp 1024M"
AND ITS WORKING!
Click to expand...
Click to collapse
This solution is already known
But my goal is to be able to mod a system partition without having to flash it before. And more, understand why extracted system image cannot be mounted and how to work this out
oh, ok xD
i didnt know that solution, its new for me
Yakandu said:
Sorry for double post, i found a solution
Flash the system through a .ftf with flashtools
Flash a custom kernel with recovery (or the nozomi recovery)
Backup nandroid
We get a system.ext4.tar ··· move it to your developement folder
Create a folder (mkdir system)
Enter nautilus with root acces
Extract system files to the created folder
Modify whatever you want
Make a flashable system.img with: "./mkuserimg.sh -s /system ./system.img ext4 ./temp 1024M"
AND ITS WORKING!
Click to expand...
Click to collapse
Have you already tried flashing this img on your device? I have already tried this solution twice but didn't succeed (@Spectre51 that's why I haven't replied your PM yet). system.img was succesfully created but I got boot loop when I flashed it on my device.
Hi Androxyde,
I figured it out, basically we have to dig further in sin format as new ext4 sins skips part of the file. See my thread for more details.
PS: Thanks for flashtool, it's a great tool!
LeTama
letama said:
Hi Androxyde,
I figured it out, basically we have to dig further in sin format as new ext4 sins skips part of the file. See my thread for more details.
PS: Thanks for flashtool, it's a great tool!
LeTama
Click to expand...
Click to collapse
:good:

[Download] system.img was extracted to a 7z file (Prerooted)

It's a 7z file. It was extracted from system.img
link: http://minus.com/lJ9OQT5ktY7Vr
I used the below command to get the system.img. Root is required. Image size is 1Gb.
Code:
dd if=/dev/block/mmcblk0p15 of=/sdcard/system.img
adb pull /sdcard/system.img
To mount:
Code:
mkdir sys
sudo mount -o loop system.img sys
Is this Gingerbread or ICS? What version?
popfan said:
Is this Gingerbread or ICS? What version?
Click to expand...
Click to collapse
LT28H 4.0.4
ganeshbiyer said:
I used the below command to get the system.img. Root is required. Image size is 1Gb.
Code:
dd if=/dev/block/mmcblk0p15 of=/sdcard/system.img
adb pull /sdcard/system.img
To mount:
Code:
mkdir sys
sudo mount -o loop system.img sys
Click to expand...
Click to collapse
Now we need a usable cwm

Categories

Resources