Extract system.img - G2 and Desire Z Q&A, Help & Troubleshooting

Hello guys,
I am trying to extract system.img.
I got system.img from this file
RUU_Vision_HTC_ARA_1.83.415.2_Radio_12.28e.60.140f_26.04.02.17_M2_SF_release_168396_signed.exe
I tried unyaffs with no luck. I actually tried to use unyaffs on some other system.img and it worked.
I get this
0 [main] unyaffs 4172 exception::handle: Exception: STATUS_ACCESS_VIOLATIO N
1094 [main] unyaffs 4172 open_stackdumpfile: Dumping stack trace to unyaffs.exe.stackdump
Please help

hey,
maybe you should try this in the android developement forum. here are only g2 users and i guess in the developement forum there might be more ppl who could help you with that!

Unyaffs is used on img files created during a nandroid backup.
For most img files contained in an RUU, it's simply the filesystem it would normally be on the phone, in this case ext3. You need to mount or open the file with the ext3 filesystem.

I found ext2explore tool much easier on Windows.
Download
Edit: Didn't realize it's old thread-

Related

pack/repack cg39

Hi i'd like to unyaffs a cg39 file from a sbf
ajust it a little, and pack it back to do a nandroid restore (system.img)
how do i repack my /system dump to system.img
i've read that i need to use mkyaffs2image to back it into a system.img
(and do the md5sum)
where can i get mkyaffs2image.exe for windows ?
or is there an other way to make system.img files on a windows machine ?
(or do i have to use linux for (de)packing ??)
kind regards, Collen

Can't unpack a system.img?

Just for the hell of it, I'd like to unpack a system.img the easy way. I tried unyaffs for Windows but it doesn't seem to work. Does the factory images from Google even use the yaffs format?
When I try to unyaffs system.img, I get this which I condumped:
Code:
0 [main] unyaffs 6232 exception::handle: Exception: STATUS_ACCESS_VIOLATIO
N
831 [main] unyaffs 6232 open_stackdumpfile: Dumping stack trace to unyaffs.e
xe.stackdump
What am I doing wrong? I open a command window in the directory of the image file, make sure unyaffs.exe and cygwin1.dll is there and then type "unyaffs system.img"
Same question here
Don't forget to hit thanks
I have already posted how to do this in this post... Have a look at the last few lines of the "How to flash" section in blue.

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:

looking for stock rom.zip for Tab 10.5 SM-T805 LTE

I would like to looking for the Stock rom.zip for Tab SM-805 LTE. but can't
please share me if you have or the link for downloading
Thanks so much!
No such thing. Stock firmware comes in a tar package.
samsung-updates.com or sammobile
crownvn said:
I would like to looking for the Stock rom.zip for Tab SM-805 LTE. but can't
please share me if you have or the link for downloading
Thanks so much!
Click to expand...
Click to collapse
You need to download the whole firmware package (which is a .tar archive), extract it, and get system.img
After that, you need to use (on a either linux OS or cygwin/VM with linux) simg2img to unpack the raw partition found in system.img
Code:
simg2img system.img system.raw
Next, you need to mount that raw partition to a premade folder
Code:
mkdir system_unpacked
sudo mount -t ext4 -o loop system.raw system_unpacked
You now have your stock rom unpacked. Pack the files found in system_unpacked in a .zip, add a propper META-INF with a propper updater script and that's all
P.S. Google is your friend in all this process!
P.P.S. if your tablet is already rooted, you can use flashfire on it to directly flash the system.img (as @ashyx mentioned in his great rooting guide)
All in all, good luck! Cheers!:good:

Finding file_contexts from stock image

Hello,
After modifying my system.img filesystem, I need to find the adequat file_contexts file for my PixelC to be able repack my system file as an image.
To do so, I opened the boot.img image and extracted the ram disk.
Unfortunately I could not find a file name "file_contexts" but only "plat_file_contexts" or "nonplat_file_contexts" which ended up making the tablet not boot.
Where can I find the appropriate file_contexts for the Pixel C ?
Thank you.
Das Kartoffel said:
Hello,
After modifying my system.img filesystem, I need to find the adequat file_contexts file for my PixelC to be able repack my system file as an image.
To do so, I opened the boot.img image and extracted the ram disk.
Unfortunately I could not find a file name "file_contexts" but only "plat_file_contexts" or "nonplat_file_contexts" which ended up making the tablet not boot.
Where can I find the appropriate file_contexts for the Pixel C ?
Thank you.
Click to expand...
Click to collapse
When you change system.img .. do you remove DM-verity too ?
Otherwise it will never boot.
No need for file_contexts .. just use simg2img tool to make sparse image again ..or keep it as ext4 system.img.
It seems like file_contexts got split between plat_ and nonplat_ from Android 8.0 on. See this: https://source.android.com/security/selinux/compatibility

Categories

Resources