[Q] How do I repack an system.img for GT-P7500? - Galaxy Tab 10.1 Q&A, Help & Troubleshooting

Hello people,
I am currently editing and modifying a Samsung-Rom for the P7500, but unfortunately I do not know how must be packed for a flashable system.img.
I use ext4_utils, I have absolutely no problem with it, no matter what firmware I edit.
For the Galaxy S2 I need approximately the following command: sudo ./mkuserimg.sh -s /some/directory/with/files ./factoryfs.img ext4 ./temp 512M
What is the command for the Galaxy Tab 10.1 GT-P7500?
I hope it can help someone of you.
Greetings and thanks already times in advance.
Sorry for my bad English!

this link should answer all your questions bro.
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images

Hello,
Thank you for your link but its not very helpful for me.
The link describes only how do unpack, edit, pack and flash the boot.img
It interested me how to pack the system.img for the Tab 10.1 P7500, in your link its only a guide of Nexus One and some other Smartphone.
Because this command does not seem to work: sudo ./mkuserimg.sh -s /some/directory/with/files ./system.img ext4 ./temp 568M
I am only looking for a correct command to pack the system.img for my P7500
Still many thanks for your help!

Blindi1985 said:
Hello,
Thank you for your link but its not very helpful for me.
The link describes only how do unpack, edit, pack and flash the boot.img
It interested me how to pack the system.img for the Tab 10.1 P7500, in your link its only a guide of Nexus One and some other Smartphone.
Because this command does not seem to work: sudo ./mkuserimg.sh -s /some/directory/with/files ./system.img ext4 ./temp 568M
I am only looking for a correct command to pack the system.img for my P7500
Still many thanks for your help!
Click to expand...
Click to collapse
Did you find your answer?
maybe your error from the command..
im interested too..

Related

[Q] To devs... How to extract System.img

Hi guys..
Sorry If I'm posting this in the wrong section...
But can anyone guide me how to extract System.img from a Stock ROM as I'm planning to cook a custom ROM
If you would like to see some of my previous work for SGS1 look at my signature
You can try unyaffs in a cygwin environment or wunyaffs which is for windows.
For some reason I get access violation errors with stock roms for the Tab.
With HTC roms it was possible to dump the system.img with magiciso. Again with Tab roms this no longer works.
In CWM, after mounting /system:
make_ext4fs -l 568m -s /sdcard/system.img /system
This gives you a sparse system.img which you can turn into a Linux-mountable ext4 image with simg2img
Sorry i writed on wrong thread
In Linux you can do
mkdir tmp
sudo mount -o loop -t ext4 system.img ./tmp && cp -r ./tmp/* ./system/
sudo umount ./tmp
Sent from my Samsung Galaxy Tab 10.1 using Tapatalk
jamezelle said:
In Linux you can do
mkdir tmp
sudo mount -o loop -t ext4 system.img ./tmp && cp -r ./tmp/* ./system/
sudo umount ./tmp
Sent from my Samsung Galaxy Tab 10.1 using Tapatalk
Click to expand...
Click to collapse
I'm getting an error
Code:
sudo mount -o loop -t ext4 system.img ./tmp && cp -r ./tmp/* ./system
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Nokia7Vista said:
I'm getting an error
Code:
sudo mount -o loop -t ext4 system.img ./tmp && cp -r ./tmp/* ./system
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Click to expand...
Click to collapse
See the message I posted up above? You have to run the system.img through simg2img to make it mountable.
Sent from my Samsung Galaxy Tab 10.1
mabalito said:
See the message I posted up above? You have to run the system.img through simg2img to make it mountable.
Sent from my Samsung Galaxy Tab 10.1
Click to expand...
Click to collapse
oh ok,, Thanks
Nokia7Vista said:
oh ok,, Thanks
Click to expand...
Click to collapse
Hope this helps and welcome to the GT10.1 forum
Sent from my Samsung Galaxy Tab 10.1
You could always create a regular (non-sparse) image file using dd then mount it.
Command should be similar to ****, though I'm not sure if the busybox version of dd accepts bs=1M, it may require bs=1048576. (That's MB converted to B) And count is the number of MB you want the image to be.
Code:
dd if=/dev/zero of=squeeze.img bs=1M count=512
Then mount it like this:
Code:
mount -o loop,noatime -t ext4 /sdcard/debian/squeeze.img /data/local/debian/
*Pulled from a thread I wrote awhile back, you may be able to get away without using the "noatime" option.

[Q]How to Unpack/Split Samsung boot.img ?

Maybe a noob question, but how do you guys split and repack SGS3 boot.img ?
The usual perl scripts don't seem to work with any S3 boot.img I came across (neither for the Galaxy Tab 7.7 boot.img's btw).
I keep getting this error :
Android Magic not found in boot.img. Giving Up.
Click to expand...
Click to collapse
Thanks for answering.
To unpack, you can do this:
Code:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames
Of course, that assumes you have abootimg installed. The above will split the zImage and the ramdisk from the boot.img and then proceed to extract the files from the ramdisk. Some ramdisks are not Gzip compressed so in that case use cat instead of zcat. Also: run that as root to make sure you don't mangle the files' permissions. I haven't tried repacking, though. ("find . -print | cpio -o -H newc | gzip > ../initrd.img" followed by "cd .. ; abootimg -u boot.img -r initrd.img" worked for my U8800pro, but I've had no need to try it with GS3 images.) I'd start by looking at the tools that come with the official Samsung source distribution and guides that tell you how to build a Samsung kernel.
Thanks a lot for this thorough answer
Trying this right now.
Couldn't find a specific Samsung kernel-related tutorial, though good idea to go take a look at Samsung's official kernel documentation.
qwerty12 said:
To unpack, you can do this:
Code:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames
Of course, that assumes you have abootimg installed. The above will split the zImage and the ramdisk from the boot.img and then proceed to extract the files from the ramdisk. Some ramdisks are not Gzip compressed so in that case use cat instead of zcat. Also: run that as root to make sure you don't mangle the files' permissions. I haven't tried repacking, though. ("find . -print | cpio -o -H newc | gzip > ../initrd.img" followed by "cd .. ; abootimg -u boot.img -r initrd.img" worked for my U8800pro, but I've had no need to try it with GS3 images.) I'd start by looking at the tools that come with the official Samsung source distribution and guides that tell you how to build a Samsung kernel.
Click to expand...
Click to collapse
Great!! Thanks for your information.
Here is what I use. Inside there are three binaries and two perl scripts,, copy the binaries into /usr/bin/ or you can add them in their own place and add that to the path. Then use this to help you use the files
Thanks for that too, ima try those scripts
Getting this error :
~$ perl unpack-bootimg.pl boot.img
could not find any embeded ramdisk images. Are you sure this is a full boot image?
Click to expand...
Click to collapse
Apparently, from what I have been reading, Samsung uses a different type of kernels than other manufacturers.
Although there's a huge number of custom samsung kernels out there. There might be a way^^
Here is the kernel i'm trying to edit if anyone wanna give a try at unpacking it for me.
That is true up until the S3 boot.img/kernel They have always used a zImage. Now Google has forced them to move over to EXT4 system and change the kernel format.
That file is only 2.88 mb's that is way too small to be a full kernel. Even for stock with no tweaks. That's why you are having an error.
This is the original boot.img from the CM9 for Galaxy Tab 7.7 update.zip
However i get the same error when trying to unpack S3 stock boot.img or even CM10 boot.img, although when i try the same scripts on my Xperia Play's kernels they unpack properly.
Good thing if Google made Samsung do kernels like others
Hi,
Did you manage to unpack/repack the SGS3 boot image? I'm trying to modify init.rc in an international SGS3 (i9300).
I've managed to unpack the boot image (from /dev/block/mmcblk0p5) as per qwerty12's command but how do I repack it?
Thanks!

Stock rom editing

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!!!)

[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

Unpacking boot.img of gt-i8160?

Hi,
has anyone unpacked the boot.img of our ace 2? I created the boot.img with a CWM backup and also with this command:
Code:
su
dd if=dev/block/mmcblk0p15 of=/mnt/sdcard/boot.img
but i can't unpack the file, get the message "Android 'magic' header not found at start of boot.img" or similar. Tried with Android Kitchen and this command:
Code:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames
Can anyone help me?
rs90xda said:
Hi,
has anyone unpacked the boot.img of our ace 2? I created the boot.img with a CWM backup and also with this command:
Code:
su
dd if=dev/block/mmcblk0p15 of=/mnt/sdcard/boot.img
but i can't unpack the file, get the message "Android 'magic' header not found at start of boot.img" or similar. Tried with Android Kitchen and this command:
Code:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames
Can anyone help me?
Click to expand...
Click to collapse
I took boot.img from CWM Recovery during making recovery
boot.img
If you guys can, take my kernel from MX general thread, take out the kernel.bin.md5, remove the md5 extension by removing the hash sum and then rename kernel.bin to zImage. Then inject it into the boot.ing you have
Sent from my GT-I8160 using Tapatalk 2
michal_ag said:
I took boot.img from CWM Recovery during making recovery
boot.img
Click to expand...
Click to collapse
I think OP did the same... So this boot.img is not proper one? because i want to try do do some "digging" (i'm a newbie in android development/linux) and boot.img is crucial
judas1977 said:
I think OP did the same... So this boot.img is not proper one? because i want to try do do some "digging" (i'm a newbie in android development/linux) and boot.img is crucial
Click to expand...
Click to collapse
I'm struggling with the same problem... Did you already found a solution for this?
These tools that you are using doesn't work because for our device there isn't a regular boot.img
kernel.bin.md5 is just gzipped zImage with ramdisk. Note that ramdisk is not compressed (it's raw cpio file). Tomorrow I'll post script to unpack kernel.bin.md5.
But to pack it again the best way is compile kernel with CONFIG_INITRAMFS_SOURCE specified.
Thanks but how could I know that? I have been looking a lot but couldn't find much info about it... Perhaps I was looking at the wrong places...
[Edit] After your explanation I've found the script myself and extracted the kernel.img.md5
Actually, it's quite simple.
For unpacking:
http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
And to be honest, kernel.bin.md5 is nothing but a zImage with MD5 checksum at the end of the file.
bagnz0r said:
Actually, it's quite simple.
For unpacking:
http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
And to be honest, kernel.bin.md5 is nothing but a zImage with MD5 checksum at the end of the file.
Click to expand...
Click to collapse
Don't know why but for me this script didn't work on Arch Linux. I had to remove the part where it's checking if cpio is gzipped.
ccnky said:
Don't know why but for me this script didn't work on Arch Linux. I had to remove the part where it's checking if cpio is gzipped.
Click to expand...
Click to collapse
You might need to get these:
Code:
cpio gzip
And don't remove that gz part.
bagnz0r said:
You might need to get these:
Code:
cpio gzip
And don't remove that gz part.
Click to expand...
Click to collapse
I'm not so much noob
This script created empty files for me. I manually typed commands (without gzip) and worked perfect.
ccnky said:
Don't know why but for me this script didn't work on Arch Linux. I had to remove the part where it's checking if cpio is gzipped.
Click to expand...
Click to collapse
Try the last version in github (see at bottom of page on the link bagnz0r has sent) That one worked for me on cygwin.
Sent from my GT-I8160 using xda app-developers app
h3llrais3r said:
Try the last version in github (see at bottom of page on the link bagnz0r has sent) That one worked for me on cygwin.
Sent from my GT-I8160 using xda app-developers app
Click to expand...
Click to collapse
Thanks for your advice but I unpacked ramdisk once and don't have to do that anymore.

Categories

Resources