[Q] Unpacking and repacking stock rom .img files - Galaxy S II Q&A, Help & Troubleshooting

hello,
Question on this post, I have no access to answer
http://forum.xda-developers.com/showthread.php?t=1081239
Thanks, good work to unpack the .img file.
I have a problem
repacking factoryfs_custom.img only 10,2*Mio (10678552 octets)
Code:
[email protected]:/home/max/ext4_utils# mkdir tempdir; mount -o loop output.img tempdir
[email protected]:/home/max/ext4_utils# ./mkuserimg.sh -s /some/directory/with/files ./factoryfs_custom.img ext4 ./temp 512M
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
./make_ext4fs -s -l 512M -a ./temp ./factoryfs_custom.img /some/directory/with/files
Creating filesystem with parameters:
Size: 536870912
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 2048
Label:
Blocks: 131072
Block groups: 4
Reserved block group size: 31
Created filesystem with 10/32768 inodes and 4205/131072 blocks
[email protected]:/home/max/ext4_utils# ls -l factoryfs_custom.img
-rw-r--r-- 1 root root 10678552 2011-05-28 09:57 factoryfs_custom.img
[email protected]:/home/max/ext4_utils#
what is the problem?
sorry for my bad English
Thanks

Can we move my question in the original post?
http://forum.xda-developers.com/showthread.php?t=1081239
Thank

max30 said:
Can we move my question in the original post?
http://forum.xda-developers.com/showthread.php?t=1081239
Thank
Click to expand...
Click to collapse
It remains for me to write the six missing messages to be able to ask my question in the right place

max30 said:
It remains for me to write the six missing messages to be able to ask my question in the right place
Click to expand...
Click to collapse
I can go post in the right place now

Related

Issue with creating/flashing prerooted system.img

Having an issue making the prerooted system.img. Builds just fine only issue is when I flash it.
here is the error from the command prompt when trying to flash it:
sending 'system' (413386 KB)...
(bootloader) USB download speed was 32173kB/s
OKAY [ 13.172s]
writing 'system'...
(bootloader) Flash of partition 'system' requested
(bootloader) S1 partID 0x00000004, block 0x00022000-0x00221fff
(bootloader) Unsupported chunk type: 0x6565
Any ideas?
Try to use doomkernel instead
GR0S said:
Try to use doomkernel instead
Click to expand...
Click to collapse
Dont want a custom kernel.
Sent from my LT26i using Tapatalk 2
Spectre51 said:
Dont want a custom kernel.
Sent from my LT26i using Tapatalk 2
Click to expand...
Click to collapse
You don't have to, it won't help anyway. Might be your image is broken. Have you tried any others?
Did you create it using ext-4 tools in Linux? You can't do it properly with unyaffs for Xperia 2012 devices
Sent from my LT26i using XDA
krabappel2548 said:
Did you create it using ext-4 tools in Linux? You can't do it properly with unyaffs for Xperia 2012 devices
Sent from my LT26i using XDA
Click to expand...
Click to collapse
Yes I did. Followed the guide in the firmwares and root compilation thread.
Spectre51 said:
Yes I did. Followed the guide in the firmwares and root compilation thread.
Click to expand...
Click to collapse
Ok, I looked at the guide but I don't think it's a really good guide. Maybe I'll write a guide in general about it when I have some time
Sent from my LT26i using XDA
krabappel2548 said:
Ok, I looked at the guide but I don't think it's a really good guide. Maybe I'll write a guide in general about it when I have some time
Sent from my LT26i using XDA
Click to expand...
Click to collapse
yeh its not really complete. I had to find some help in other posts but its a starting point. Just gotta figure out if its something I am doing or if sony put something in .75 to make it harder to root this way.
Spectre51 said:
yeh its not really complete. I had to find some help in other posts but its a starting point. Just gotta figure out if its something I am doing or if sony put something in .75 to make it harder to root this way.
Click to expand...
Click to collapse
I prerooted .76 without issues by using that guide.
Could you give us some more details about the steps you followed, and eventually post all the commands you ran and their output?
crimilde said:
I prerooted .76 without issues by using that guide.
Could you give us some more details about the steps you followed, and eventually post all the commands you ran and their output?
Click to expand...
Click to collapse
Agree with this post. I created my own shell script following that guide to pre-root image for .73 and .75 and never found any issue.
Would be great if you could provide us the steps and commands you used
I'll paste the commands exactly and their output when I get back to my computer.
This is what I get when making the img:
[email protected]:/home/jtking/Desktop/android# ./sin2img.py system.sin system.img
[email protected]:/home/jtking/Desktop/android# mkdir system; mount -o loop system.img system
[email protected]:/home/jtking/Desktop/android# cp Superuser.apk system/app/
[email protected]:/home/jtking/Desktop/android# cp su system/b
bin/ build.prop
[email protected]:/home/jtking/Desktop/android# cp su system/bin/
[email protected]:/home/jtking/Desktop/android# chmod 644 system/app/Superuser.apk
[email protected]:/home/jtking/Desktop/android# chmod 06755 system/bin/su
[email protected]:/home/jtking/Desktop/android# ./mkuserimg.sh -s system ./system2.img ext4 ./temp 1024M
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
./make_ext4fs -s -l 1024M -a ./temp ./system2.img system
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 1224/65536 inodes and 107179/262144 blocks
[email protected]:/home/jtking/Desktop/android#
And again this is what I got when trying to flash that img
writing 'system'...
(bootloader) Flash of partition 'system' requested
(bootloader) S1 partID 0x00000004, block 0x00022000-0x00221fff
(bootloader) Unsupported chunk type: 0x656c
I was able to unlock the bootloader just fine with this system multiple times and had flashed the .73 system image previously so I don't think its an issue with the computer.
Thank you for posting commands you used here. Those are the same ones as I use so this problem seems too difficult for my knowledge.
There is a possible cause I'm thinking of now. That guideline creates 2 img file: system.img and system2.img. system2.img is the prerooted one and it is the file to be flashed via fastboot. Their names are confusing. The question is which file you used to flashed?
If your answer is system2.img, I think you did everything correctly. We need to find someone else who has better knowledge than me to help.
Spectre51 said:
[email protected]:/home/jtking/Desktop/android# cp su system/b
bin/ build.prop
Click to expand...
Click to collapse
Well, this line seems strange to me, what did you try to do here?
Spectre51 said:
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 1224/65536 inodes and 107179/262144 blocks
Click to expand...
Click to collapse
I also tried to preroot and make the system img using the system.sin from 6.0.A.3.75_CE1 just to compare the output and I got:
Code:
[[email protected] ext4_utils]# ./mkuserimg.sh -s ../system ../system2.img ext4 ./temp 1024M
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
./make_ext4fs -s -l 1024M -a ./temp ../system2.img ../system
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 1230/65536 inodes and 108440/262144 blocks
So the inodes and block numbers clearly differ from yours. I didn't try to flash it though, to see if it works or not, as I already got .76, but I'd suggest you try a different FTF if you didn't use the one I mentioned already.
Also, maybe it's unrelated, but when you ran make on the ext4_utils, was the result ok?
crimilde said:
Well, this line seems strange to me, what did you try to do here?
I also tried to preroot and make the system img using the system.sin from 6.0.A.3.75_CE1 just to compare the output and I got:
Code:
[[email protected] ext4_utils]# ./mkuserimg.sh -s ../system ../system2.img ext4 ./temp 1024M
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
./make_ext4fs -s -l 1024M -a ./temp ../system2.img ../system
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 1230/65536 inodes and 108440/262144 blocks
So the inodes and block numbers clearly differ from yours. I didn't try to flash it though, to see if it works or not, as I already got .76, but I'd suggest you try a different FTF if you didn't use the one I mentioned already.
Also, maybe it's unrelated, but when you ran make on the ext4_utils, was the result ok?
Click to expand...
Click to collapse
1) bash completion
2) it's different sizes
Haha, I must be going bad in the eyes, what with the bash completion fail I just did right there. Thanks.
Sent from my Sony Tablet S using xda premium
tot_anusak said:
There is a possible cause I'm thinking of now. That guideline creates 2 img file: system.img and system2.img. system2.img is the prerooted one and it is the file to be flashed via fastboot. Their names are confusing. The question is which file you used to flashed?
If your answer is system2.img
Click to expand...
Click to collapse
I used system2.img to flash
crimilde said:
Also, maybe it's unrelated, but when you ran make on the ext4_utils, was the result ok?
Click to expand...
Click to collapse
ext4_utils make went fine with no errors or anything.
Just to make sure I got the system.sin the right way. From the SEUS blob_fs folder I took the two biggest files from the .75 update download and and in flashtool did the decrypt files option. Took the system.sin file from there to use for this process.
Spectre51 said:
Just to make sure I got the system.sin the right way. From the SEUS blob_fs folder I took the two biggest files from the .75 update download and and in flashtool did the decrypt files option. Took the system.sin file from there to use for this process.
Click to expand...
Click to collapse
Yes, you did it right way.
Okay not sure what the deal is then with making this pre-rooted system image. Now for the Superuser.apk and su files I got them from http://androidsu.com/superuser/ Downloaded and extracted the Superuser.apk and su from the system/app and system/bin folders and thats what I was using to put into the prerooted system.img
Is that also the correct way to do it?
Not sure why I am having so much trouble getting this to work. If I upload the system.sin can someone else try making it to see if maybe something with my system is messing it up?

How to make Odin package for ex4 devices

Hey fellow guys!!!
I have been trying to make ODIN roms for my device (Galaxy NOTE).
I have tried making system.img using adb using this command:
Code:
dd if=/dev/block/mmcblk0p9 of=/sdcard/system.img bs=4096
And got system.img in my sdcard.When I made tar ball of the img and tried to flash with ODIN it said failed!!
So I continued searching and found this thread.
what I made was:
extract my previously created system.img into a folder called system and used this command in terminal:
Code:
[email protected]:~/ext4_utils$ ./mkuserimg.sh -s ~/system/ ./factoryfs_custom.img ext4 ./temp 512M
But I get this error:
Code:
in mkuserimg.sh PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
./make_ext4fs -s -l 512M -a ./temp ./factoryfs_custom.img /home/vijai/system/
./mkuserimg.sh: line 52: ./make_ext4fs: No such file or directory
Where am I going wrong??Or someone could guide me in right direction??
Thanks.
You need the make_ext4fs tool, get it by googling and place it in the directory the script is.
Sent from my GT-P1000
cdesai said:
You need the make_ext4fs tool, get it by googling and place it in the directory the script is.
Sent from my GT-P1000
Click to expand...
Click to collapse
thanks Will report after trying
Now I get this error:
Code:
./mkuserimg.sh: line 52: ./make_ext4fs: cannot execute binary file
vijai2011 said:
Now I get this error:
Code:
./mkuserimg.sh: line 52: ./make_ext4fs: cannot execute binary file
Click to expand...
Click to collapse
chmod +x ./make_ext4fs
Sent from my GT-P1000
cdesai said:
chmod +x ./make_ext4fs
Sent from my GT-P1000
Click to expand...
Click to collapse
Sorry the file was a wrong one .
I put in the correct file and type the command and I got this error:
[email protected]:~/ext4_utils$ ./mkuserimg.sh -s ~/system/ ./factoryfs_custom.img ext4 ./temp 512M
in mkuserimg.sh PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
./make_ext4fs -s -l 512M -a ./temp ./factoryfs_custom.img /home/vijai/system/
Creating filesystem with parameters:
Size: 536870912
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 2048
Label:
Blocks: 131072
Block groups: 4
Reserved block group size: 31
error: do_inode_allocate_extents: Failed to allocate 134 blocks
Click to expand...
Click to collapse
vijai2011 said:
Sorry the file was a wrong one .
I put in the correct file and type the command and I got this error:
Click to expand...
Click to collapse
hello
i have the same error, have you solved?

Error while restorting CWM backup

Hi there.
I'm trying to do port CWM for Xperia J for a locked bootloader.
Everything works except restoring backup /system:
Code:
Checking MD5 sums...
boot.img: OK
cache.ext4.dup: OK
data.ext4.dup: OK
system.ext4.dup: OK
couldn't find default
Found new backup image: /sdcard/clockworkmod/backup/2012-12-29.00.19.49//system.ext4.dup
Restoring system...
Creating filesystem with parameters:
Size: 681574400
Block size: 4096
Blocks per group: 32768
Inodes per group: 6944
Inode size: 256
Journal blocks: 2600
Label:
Blocks: 166400
Block groups: 6
Reserved block group size: 47
Created filesystem with 11/41664 inodes and 5415/166400 blocks
Unable to copy file ./app/AccessoryKeyDispatcher.apk
system
app
AccessoryKeyDispatcher.apk
Error while restoring /system!
Then the phone will not start. I need reflash fw (recovery doesn't work then because it is on /system partition - locked bl)

Can't edit cache.img file using simg2img and img2simg

I tried on both windows and ubuntu.
First I try to flash the original cache.img
Code:
heimdall flash --CACHE cache.img
Works, no errors and everything goes fine. Now when I do...
Code:
>file cache.img
cache.img: Android sparse image, version: 1.0, Total of 16384 4096-byte output blocks in 14 input chunks.
>simg2img cache.img cache.raw
>img2simg cache.raw cache2.img
>file cache2.img
cache2.img: Android sparse image, version: 1.0, Total of 16384 4096-byte output blocks in 74 input chunks.
Without changing (or even mounting) the raw file at all! I just converted it to raw and back.
Then I tried to flash the new file again, fails. And as you can see they are obviously very different, even though I did absolutely no changes!
I verified the block size, the default one (4096) is the correct one.
Also, the original cache.img is 49.4 MB, the cache2.img file is 39.6 MB
The output when trying to flash the new cache.img file:
Code:
Uploading CACHE
100%
ERROR: Failed to confirm end of file transfer sequence!
ERROR: CACHE upload failed!
It should be the same file, but isn't. What am I doing wrong?
Edit:
Instead of using img2simg, I used mkuserimg.sh which created a file that's NEARLY identical to my original file:
Code:
>sudo ./mkuserimg.sh -s ./cache ./cache2.img ext4 cache 64M
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
make_ext4fs -s -l 64M -a cache ./cache2.img ./cache
Creating filesystem with parameters:
Size: 67108864
Block size: 4096
Blocks per group: 32768
Inodes per group: 4096
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 16384
Block groups: 1
Reserved block group size: 7
Created filesystem with 15/4096 inodes and 12062/16384 blocks
>file *.img
cache2.img: Android sparse image, version: 1.0, Total of 16384 4096-byte output blocks in 14 input chunks.
cache.img: Android sparse image, version: 1.0, Total of 16384 4096-byte output blocks in 14 input chunks.
>ls -l *.img
-rw-r--r-- 1 root root 49406148 Aug 20 13:19 cache2.img
-rwxrw-rw- 1 ae ae 49406208 May 19 09:24 cache.img
As you see they slightly differ now, but flashing still fails. Adding --verbose to heimdall adds this:
Code:
ERROR: Failed to unpack received packet.
Edit 2:
I'm using a Samsung device (Galaxy S7)
Fixed it in the end using manually compiled and modified binaries of the sim2img and img2sim. The original source is obtained from
github .com/ASdev/android_img_repack_tools/tree/android-6.0.1
and then apply this patch
gist. github .com/jedld/4f388496bda03b349f5744f367749a67
(had to add spaces because i'm a new user, but wanted to put this here in case someone else has this problem)
then build it, and it flashes now properly. (using simg2img and img2simg)

Need help with image repack. Make_ext4fs image doesnt load on device.

Hi all!
I have a tablet device Digma CITI 7507 4g, and have a task to put custom application to firmware to "priv-apps'.
So, what have i done:
1. Taken stock FW from manufacturer site.
2. Inside archive i found .pac file, i unpack that file with Spreatrum ResearchDownload tool
3. After unpack i found several files including some img's, and system.img too.
4. So, file system.img already in raw format and i can mount in to the folder
5. I copied all the content of a mounted folder to the system_new folder, and appended here my apk.
6. After that i packed system_new folder to the system_new.img with the make_ext4fs tool
7. Flashing firmware with new system_new.img through Spreatrum ResearchDownload tool
8. After that device is stuck on first screen with "Powered by Android" that'all ((((
9. Re-flashing with stock image becomes device alive
Info about image files:
file system.img (stock)
system.img: Linux rev 1.0 ext4 filesystem data, UUID=da594c53-9beb-f85c-85c5-cedf76546f7a, volume name "system" (extents) (large files)
file system_new.img (custom)
system_new.img: Linux rev 1.0 ext4 filesystem data, UUID=da594c53-9beb-f85c-85c5-cedf76546f7a, volume name "system" (extents) (large files)
dumpe2fs system.img (Stock)
dumpe2fs 1.42.13 (17-May-2015)
Filesystem volume name: system
Last mounted on: ...
Filesystem UUID: da594c53-9beb-f85c-85c5-cedf76546f7a
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode filetype extent sparse_super large_file uninit_bg
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Remount read-only
Filesystem OS type: Linux
Inode count: 129280
Block count: 516604
Reserved block count: 0
Free blocks: 17026
Free inodes: 126892
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 127
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8080
Inode blocks per group: 505
Last mount time: Tue Jul 3 12:25:29 2018
Last write time: Tue Jul 3 17:23:26 2018
Mount count: 8
Maximum mount count: -1
Last checked: Thu Jan 1 05:00:00 1970
Check interval: 0 (<none>)
Lifetime writes: 30 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
Default directory hash: tea
Journal backup: inode blocks
Journal features: (none)
Journal size: 31M
Journal length: 8071
Journal sequence: 0x00000018
Journal start: 0
Click to expand...
Click to collapse
dumpe2fs system_new.img (Custom)
dumpe2fs 1.42.13 (17-May-2015)
Filesystem volume name: system
Last mounted on: <not available>
Filesystem UUID: da594c53-9beb-f85c-85c5-cedf76546f7a
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode filetype extent sparse_super large_file uninit_bg
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Remount read-only
Filesystem OS type: Linux
Inode count: 131376
Block count: 524800
Reserved block count: 0
Free blocks: 24913
Free inodes: 128988
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 135
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 7728
Inode blocks per group: 483
Last mount time: n/a
Last write time: Thu Jan 1 05:00:00 1970
Mount count: 0
Maximum mount count: -1
Last checked: Thu Jan 1 05:00:00 1970
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
Default directory hash: tea
Journal backup: inode blocks
Journal features: (none)
Journal size: 32M
Journal length: 8200
Journal sequence: 0x00000001
Journal start: 0
Click to expand...
Click to collapse
I need to build correct system image with which device could boot or may be i can put my apk in another place? Please, any help will be nice!
me too.
my problem also is it.
I don't know who can help me
---------- Post added at 04:30 PM ---------- Previous post was at 04:29 PM ----------
If you have answer.I hope you can share with me

Categories

Resources