Stock rom editing - Galaxy S III Q&A, Help & Troubleshooting

Can anybody tell me how i can mount a system.img (under the linux)?
I would like to change any files and repack to odin flashable file.
Is this possible or not??
Thx

TiBiSMART said:
Can anybody tell me how i can mount a system.img (under the linux)?
I would like to change any files and repack to odin flashable file.
Is this possible or not??
Thx
Click to expand...
Click to collapse
I hope this will help you..
http://www.freeyourandroid.com/guide/building_roms_for_odin

TiBiSMART said:
Can anybody tell me how i can mount a system.img (under the linux)?
I would like to change any files and repack to odin flashable file.
Is this possible or not??
Thx
Click to expand...
Click to collapse
i helped myself (and http://andwise.net/?p=403)...
mkdir sys
./simg2img system.img sys.raw
mount -t ext4 -o loop sys.raw sys/
change what you want...
./make_ext4fs -s -l 1610612736 -a system new_system.img sys/
put the system.img to the odin flashable tar (extension only .tar not tar.md5!!!)

Related

[Q] The problem of Unpacking and repacking stock rom .img files

http://forum.xda-developers.com/showthread.php?t=1081239
I had take this way to Unpacking and repacking the 9100 rom,but the output.img is size 512M。
who can hlep me to make it size ok。and the error is:
[email protected]:~# /root/ext4_utils/simg2img factoryfs.img output.img
[email protected]:~# mkdir tempdir; mount -o loop output.img tempdir
[email protected]:~# /root/ext4_utils/mkuserimg.sh -s /some/directory/with/foles ./factoryfs_custom.img ext4 ./temp 512M
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Can not find directory /some/directory/with/foles!
[email protected]:~#
/some/directory/with/foles
Click to expand...
Click to collapse
This should be the name of the directory where you want the img file being made of. In your case tempdir, I presume.
NitroOnTheRocks said:
This should be the name of the directory where you want the img file being made of. In your case tempdir, I presume.
Click to expand...
Click to collapse
thanks i will try again
NitroOnTheRocks said:
This should be the name of the directory where you want the img file being made of. In your case tempdir, I presume.
Click to expand...
Click to collapse
thanks i will try it again
NitroOnTheRocks said:
This should be the name of the directory where you want the img file being made of. In your case tempdir, I presume.
Click to expand...
Click to collapse
by the end ,the"/some/directory/with/foles"is output.img's mount files
thanks
Can someone please advise me why I am getting mount: unknown filesystem type ext4 when I try to mount the output.img.
Thanks
ronlkh said:
Can someone please advise me why I am getting mount: unknown filesystem type ext4 when I try to mount the output.img.
Thanks
Click to expand...
Click to collapse
Does your system has ext4 support? What are you using?

[Q] mounting system.img... What's wrong?

I've tried to edit content of system.img
Instruction:
[email protected]:/home/user# cd android
[email protected]:/home/user/android# ./sin2img.py system.sin system.img
[email protected]:/home/user/android# mkdir system; mount -o loop system.img system
download Superuser.apk and su
[email protected]:/home/user/android# cp Superuser.apk system/app/
[email protected]:/home/user/android# cp su /system/bin/
[email protected]:/home/user/android# chmod 644 system/app/Superuser.apk
[email protected]:/home/user/android# chmod 06755 system/bin/su
[email protected]:/home/user/android# ./mkuserimg.sh -s /system ./system2.img ext4 ./temp 1024M
Click to expand...
Click to collapse
on "mount -o loop system.img system" i've got a message that I need to define filesystem type
$ mount -o loop -t ext4 system.img system
mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
$ dmesg -c
[160126.975391] EXT4-fs (loop1): VFS: Can't find ext4 filesystem
$ mount -o loop -t yaffs2 system.img system
mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
$ dmesg -c
[160228.951512] yaffs: dev is 7340033 name is "loop1" rw
[160228.951518] yaffs: passed flags ""
[160228.951523] yaffs: yaffs: Attempting MTD mount of 7.1,"loop1"
Click to expand...
Click to collapse
OS - Ubuntu 11.10 x64
Question is - What's wrong? )))
that is because that system.img is not well decripted.
i got that message just when rooting the italian firmware
Yakandu said:
that is because that system.img is not well decripted.
i got that message just when rooting the italian firmware
Click to expand...
Click to collapse
I'm rooting russian firmware. Did you resolve ths problem with italian?
nope, i dont know why some system.img are corrupted or not ext4
Yakandu said:
nope, i dont know why some system.img are corrupted or not ext4
Click to expand...
Click to collapse
Ok, thank you.
The only way to have root on the italian rom is to put on the modified kernel "DoomKernel" then flash back the kernel.elf inside the ftf... doom kernel is a self rooting kernel so it will do the magic
NightSky256 said:
The only way to have root on the italian rom is to put on the modified kernel "DoomKernel" then flash back the kernel.elf inside the ftf... doom kernel is a self rooting kernel so it will do the magic
Click to expand...
Click to collapse
why would they be corrupted? could it be they are encrypted somehow?
Have you tried extracting the system.sin using flashtool? It extracts a system.ext4 file.
Sent from my LT22i using xda app-developers app

[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

Advice : Porting Indian ROM to Chinese ROM on Samsung Galaxy A8 8000 Model (China)

hi
I purchased a Samsung Galaxy A8 A8000 from China. I did not like its ROM since it lacked Google Apps and other stuff. So i decided to port system apps (apps+priv-app) from an indian rom. I am totall new to ROM stuff and to linux as well but i decided to go with virtual box and learn few things along the way.
For this,
first i extracted indian rom, it contained following
boot.img, cache.img, hidden.img, modem.bin, recovery.img, sboot.bin and system.img
then i extracted chinese rom, it contained different files as below
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
Since i donot want to mess with partitions and modem and other stuff so i decided to port only apps from indian rom and built an odin flashable tar file
For this i navigated various forum, i even dont exactly remember all but i am thankful to all who wrote useful stuff that helped me decide what to do, well most important of these were
http://forum.xda-developers.com/showthread.php?t=1974014
http://forum.xda-developers.com/showthread.php?t=1941239
http://rwilco12.com/forum/showthread.php?tid=92
first of all i converted indian rom system.img to system.raw using following command in linux virtualbox ubuntu 15.04
simg2img indsystem.img indsystem.raw
then i mounted this raw image using this command
mkdir indsystem
mount -o loop indsystem.raw indsystem/
then i converted chinese rom system.img to system.raw using same command as above
simg2img chcsystem.img chcsystem.raw
then i mounted this chinese raw image using this command
mkdir chcsystem
mount -o loop chcsystem.raw chcsystem/
then i created a system_new.img.ext4 file of 3.1GB size with this command
dd if=/dev/zero of=system_new.img.ext4 bs=4k count=775000
then i formated new image with ext4
mkfs.ext4 system_new.img.ext4
then probably i override the file system check and then mounted new ext4 image
tune2fs -c0 -i0 system_new.img.ext4
mkdir system_new
mount -o loop system_new.img.ext4 system_new
here i had a problem, i could not copy files from both indian and raw mounted images to my new ext4 image since i did not have permission to copy to the destination folder. then i made use of superuser access
gksu nautilus /path/to/image/folder
then i had full access and copied chinese rom to my new ext4 image.
cp -v -r -p chcsystem/* system_new/
then i deleted app, priv-app, font, framework, media, etc/permissions/allfiles-starting-with-android.-and-com.-and-allshare_library.xml from ext4 image.
then i manually copied these folders and permission files from indian system raw image file to my new ext4 image file
next i copy /system/lib/libandroid_runtime.so from chinese rom to the system/lib/ directory of indian rom and then deleted lib folder from chinese rom and replaced it with indian rom
then i sync files with "sync" command
then unmounted all partitions.
I then replaced system.img.ext4 file in my original rom with one that i have just made.
Now i need to compile these files back into flashable tar files with md5sum check with
tar -H ustar -c image_1 image_2 > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
1. but before i do so I need some advance developer to please help me out and give some confidence as to the approach that i have used. is that correct.
2. Secondly, if someone can tell me tar ball flashing order for my rom since i heard it is important while compiling odin flashable tar file.
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
3. Also Is it possible that i convert system.img.ext4 into flashable odin tar file with above commands and flash only system image with Odin without messing with anyother settings.
Thank you
No one would like to help me out here.
Hi. I plan to do the same for my SM-A7000. did you get your to work?
waqasjeral said:
hi
I purchased a Samsung Galaxy A8 A8000 from China. I did not like its ROM since it lacked Google Apps and other stuff. So i decided to port system apps (apps+priv-app) from an indian rom. I am totall new to ROM stuff and to linux as well but i decided to go with virtual box and learn few things along the way.
For this,
first i extracted indian rom, it contained following
boot.img, cache.img, hidden.img, modem.bin, recovery.img, sboot.bin and system.img
then i extracted chinese rom, it contained different files as below
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
Since i donot want to mess with partitions and modem and other stuff so i decided to port only apps from indian rom and built an odin flashable tar file
For this i navigated various forum, i even dont exactly remember all but i am thankful to all who wrote useful stuff that helped me decide what to do, well most important of these were
http://forum.xda-developers.com/showthread.php?t=1974014
http://forum.xda-developers.com/showthread.php?t=1941239
http://rwilco12.com/forum/showthread.php?tid=92
first of all i converted indian rom system.img to system.raw using following command in linux virtualbox ubuntu 15.04
simg2img indsystem.img indsystem.raw
then i mounted this raw image using this command
mkdir indsystem
mount -o loop indsystem.raw indsystem/
then i converted chinese rom system.img to system.raw using same command as above
simg2img chcsystem.img chcsystem.raw
then i mounted this chinese raw image using this command
mkdir chcsystem
mount -o loop chcsystem.raw chcsystem/
then i created a system_new.img.ext4 file of 3.1GB size with this command
dd if=/dev/zero of=system_new.img.ext4 bs=4k count=775000
then i formated new image with ext4
mkfs.ext4 system_new.img.ext4
then probably i override the file system check and then mounted new ext4 image
tune2fs -c0 -i0 system_new.img.ext4
mkdir system_new
mount -o loop system_new.img.ext4 system_new
here i had a problem, i could not copy files from both indian and raw mounted images to my new ext4 image since i did not have permission to copy to the destination folder. then i made use of superuser access
gksu nautilus /path/to/image/folder
then i had full access and copied chinese rom to my new ext4 image.
cp -v -r -p chcsystem/* system_new/
then i deleted app, priv-app, font, framework, media, etc/permissions/allfiles-starting-with-android.-and-com.-and-allshare_library.xml from ext4 image.
then i manually copied these folders and permission files from indian system raw image file to my new ext4 image file
next i copy /system/lib/libandroid_runtime.so from chinese rom to the system/lib/ directory of indian rom and then deleted lib folder from chinese rom and replaced it with indian rom
then i sync files with "sync" command
then unmounted all partitions.
I then replaced system.img.ext4 file in my original rom with one that i have just made.
Now i need to compile these files back into flashable tar files with md5sum check with
tar -H ustar -c image_1 image_2 > your_odin_package.tar
md5sum -t your_odin_package.tar >> your_odin_package.tar
mv your_odin_package.tar your_odin_package.tar.md5
1. but before i do so I need some advance developer to please help me out and give some confidence as to the approach that i have used. is that correct.
2. Secondly, if someone can tell me tar ball flashing order for my rom since i heard it is important while compiling odin flashable tar file.
aboot.mbn, boot.img, cache.img.ext4, hyp.mbn, modem.bin, NON-HLOS.bin, recovery.img, rpm.mbn, sbl1.mbn, sec.dat, system.img.ext4 and tz.mbn
3. Also Is it possible that i convert system.img.ext4 into flashable odin tar file with above commands and flash only system image with Odin without messing with anyother settings.
Thank you
Click to expand...
Click to collapse
Hi waqasjeral. Have you already ported the Indian rom to the a8000?

Help needed to unpack/repack Android boot.img & system.img

Hello
I am working with a Nanopi Fire3 board. I need to change the boot logo and boot animation.
With this Android Lollipop :
112.124.9.243/dvdfiles/S5P6818/images-for-eflasher/android-lollipop-images.tgz
Click to expand...
Click to collapse
If I unpack with the following method, the new image has a completely different size and does not boot.
Code:
apt install android-tools-fsutils
simg2img rootfs.img r.img
mount -t ext4 -o loop r.img /mnt
… To Change Something …
umount /mnt
img2simg r.img rootfs.img
I have tried to root the device, no tool found online works.
I have tried to unpack/repack, no tool found online works.
Tools like mkbootimg just copies the img file (it doesn't extract anything)
I am also trying to compile android completely, and it fails in the middle of the build process.
Would you have any advice please? I have run out of options
Thank you :good:

Categories

Resources