[Q] Galaxy S4 Odin Package Invalid MD5 Hash - Galaxy S 4 Q&A, Help & Troubleshooting

Hi XDA!
I managed to bebloat and odex some extra system apps on my Stock Touchwiz ROM, and wanted to make a backup in case something goes wrong again. I tried to follow this guide: http://forum.xda-developers.com/showthread.php?t=2277127, however, Odin always throws an error 'MD5 hash value is invalid'. I suspect there is something wrong with my image, as the developer that started that thread said his packages worked perfectly. I used the make_ext4fs binary from this link: http://web.djodjo.org/dwn.php?ff=211260&a=download/android/tools/x86_linux/ext4tools:make_ext4fs, and copied it to my device. Is the binary supposed to be for Android? Somehow when I used other images(boot.img, for example) using the same method to package into an Odin flashable, Odin do not give the error. I have managed to create a working package of the system.img.ext4 before, but could not remember how I did it. Can someone point out what I did wrong?
This is what I did to dump the system.img.ext4(it's only 2400M because I have debloated the ROM, is this the problem?):
Code:
su
make_ext4fs -s -l 2400M -a system /storage/extSdCard/system.img.ext4 /system
This is what I did to create the Odin package:
Code:
tar -H ustar -c boot.img recovery.img system.img.ext4 > test.tar
md5sum -t test.tar >> test.tar
mv test.tar test.tar.md5
I also tried this when creating Odin package:
Code:
tar -c boot.img recovery.img system.img.ext4 > test.tar
md5sum -t test.tar >> test.tar
mv test.tar test.tar.md5
But both doesn't work. I realized when I only include boot.img or recovery.img or both(without system.img.ext4) and package these files the package passes Odin's MD5 check. Does anyone know what is the issue? Thank you very much!

Related

Question on .tar

Perhaps a dumb question, but my brain is hurting from all the learning here:
I have modified my phone as I want it, including rooted deodexed stock eb01, swapping .apks, running all the mods through cwm, removing apps,etc. (I guess I themed it the hard way).
Question: Can I create a .tar file from the device while it is running, basically a 'snapshot' of the system exactly as it is ? That way I can odin to current setup if I dork up my phone.
my apologies if this is a stupid question
Sent from my SCH-I500 using XDA App
THAT IS TOTALLY NOT A STUPID QUESTION...I actually believe its a great idea right now.
Well, the long answer is, you shell into the phone and make images of the various sectors of the phone, name them properly, and heimdall them. If you use odin, take an extra step to tar it together.
Here its a guide for doing that on a continuum:
http://androidforums.com/continuum-all-things-root/263953-how-make-custom-odin-images.html
Note it glosses over dividing out the kernel binaries and RAMdisk, mentioned in the more comprehensive guide for the Behold:
http://androidforums.com/behold-2-all-things-root/54424-creating-custom-roms- odin.html
I haven't seen anyone post a cute little listing of the actual partitions and cutoffs specific to the fascinate, but I haven't looked very hard either.
UPDATE #2: (it is L: bml7, not bm17 & not bmI7)
So theoretically it's really simple (from an adb shell):
dd if=/dev/block/bml7 of=/sdcard/zImage bs=4096
dd if=/dev/block/stl9 of=/sdcard/factoryfs.rfs bs=4096
dd if=/dev/block/stl10 of=/sdcard/dbdata.rfs bs=4096
dd if=/dev/block/stl11 of=/sdcard/cache.rfs bs=4096​(copy zImage and factoryfs.rfs to your local computer)
tar -H ustar -c zImage factoryfs.rfs dbdata.rfs cache.rfs > odinTAR.tar​These two commands append an md5 checksum to your package, and then rename the file. This finishes the process.
md5sum -t odinTAR.tar >> odinTAR.tar
mv odinTAR.tar odin_package.tar.md5​NOTE: I did not include the modem, but you can flash that separately. This tar includes your personal data, so consider this before distributing any file you make this way. I haven't tested these instructions myself in any way.
Short answer:
Backup (everything but kernel) with nandroid and use that to restore. So long as you have a happy recovery setup, that is the path of least effort.
Swyped w/ XDA App. A clean tie attracts the soup of the day.
thanks for the response; certainly more involved than just a " create .tar" option somewhere. (Though that would be cool to develop for CWM or something)
Looks like some more learning for me. Always appreciate the info.
The next time there is a worthwhile update from VZW, I'd like to put together a not-stock, stripped-down-as-possible (small file) odin tar that is just enough to be a launchpad for flashing ROMs on whatever the next official modem is. So I'm doing my reading ahead of time.
Actually this looks like a great "What is where" link:
http://forum.xda-developers.com/showthread.php?t=850359
To paraphrase the link I posted above:
These are found in /dev/block. BML stands for Block Management Layer. STL is Sector Translation Layer. RFS is Samsung's Robust File System.
bml7 zImage (kernel)
stl9 factoryfs.rfs (system)
modem:
bml12 modem.bin
personal data:
stl10 dbdata.rfs
stl11 cache.rfs
other:
stl6 param.lfs
bml2 pit.pit
bml3 efs.rfs
NEVER:
bml1 boot.bin
bml4 Sbl.bin
unknown:
bml8 recovery.bin
You may use dd (and apparertly cat) to copy these partitions to your SD card:
adb shell su -c "dd if=/dev/block/bml7 of=/sdcard/zImage bs=4096"
adb shell cat /dev/block/stl9 > /sdcard/factoryfs.rfs
You may reflash them individually with heimdall, or tar to flash as a group in Odin.

[Q] SM-G900F build custom boot.img

Hi
I am used to rebuild boot images with unkmbootimg/mkbootimg on my S4 mini. When I repack a G900F a working stock boot.img and flash it with Odin, the device boots into download mode. I didn't made any changes in the ramfs, the sources are binary the same, but when I repack it to the boot.img it's different to the stock.
Is my bootloader locked? Do I need a special mkbootimg to enable SEAndroid enforcing? It does not matter if I disable it in the ramfs. Do I have to modify the kernel too?
Regards
It seems, that not the boot image is the problem but the cpio initramfs.
I can use the command
Code:
abootimg -u boot.img -r initrd.img
to replace the ramdisk in a working boot image. This works only if a replace the current initramfs with the original initramfs. If I unpack the initramfs too and repack the exact same sources, it won't boot. The sources are binary the same, but the packed initramfs is totally different.
I use the following command to repack my initramfs:
Code:
find . | cpio -o -H newc | gzip > ../initrd.img
cloooned said:
It seems, that not the boot image is the problem but the cpio initramfs.
I can use the command
Code:
abootimg -u boot.img -r initrd.img
to replace the ramdisk in a working boot image. This works only if a replace the current initramfs with the original initramfs. If I unpack the initramfs too and repack the exact same sources, it won't boot. The sources are binary the same, but the packed initramfs is totally different.
I use the following command to repack my initramfs:
Code:
find . | cpio -o -H newc | gzip > ../initrd.img
Click to expand...
Click to collapse
I don't know if this is still relevant to you, but I have found that so far the only tool that repacks s5 kernel properly is the Osm0sis kernel kitchen. I am working on linux and I was able to pack my compiled zimage and modified ramdisk using his tool. You can read more on his original thread here .
I hope thos help you.

[GUIDE][HOW-TO] Create custom Odin-flashable packages

Create custom Odin-flashable packages
Hello guys, today I show you how to create custom Odin-flashable packages.
The basic guide that I always used for any Samsung Android device comes from here.
First of all, this is an explanation of basic partitions which we can use to make a Odin package, what they are and filenames:​
System: is the partition where the ROM is installed, stock filename is system.img.md5
[*]Cache: is the partition where temporary data is stored, like ART/dalvik cache of system apps, in stock (Samsung) ROM contains CSC too. Stock filename is cache.img.md5
[*]Data: is the partition where user's data, apps and Android settings are stored, stock filename is userdata.img.md5
[*]Hidden: is the /preload partition where the stock ROM has some other system apps, unneeded/useless on custom ROMs. Stock filename is hidden.img.md5
[*]Kernel: is the partition that, as name says, contains kernel. Stock filename is kernel.bin.md5
[*]Modem: is the partition that contains baseband firmware. Stock filename is modem.bin.md5
[*]ModemFS: is the partition that contains baseband firmware data. Stock filename is modemfs.img.md5
[*]IPL: another baseband's partition. Stock filename is ipl.bin.md5
Instead of *.md5 extension, you can use *.img as well!! For example, system.img, cache.img...
Note for Kernel: sometimes Odin has problems while flashing this device if you use boot.img instead of kernel.bin!!
I tried the same on my S4 and boot.img doesn't cause any issue, since in the firmware its kernel is called boot.img instead of kernel.bin.md5 as Galaxy S Advance!
Basic commands to make a Odin package on a Linux distro or on Windows through Cygwin are these:
Code:
tar -H ustar -c "INSERT .IMG OR .MD5 FILE/S HERE" > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
We want to make a flashable kernel:
Code:
tar -H ustar -c kernel.bin.md5 > kernel.tar
md5sum -t kernel.tar >> kernel.tar
mv kernel.tar kernel.tar.md5
We want to make a flashable modem (baseband FW) package:
Code:
tar -H ustar -c modem.bin.md5 modemfs.img (where available, also ipl.bin.md5) > modem.tar
md5sum -t modem.tar >> modem.tar
mv modem.tar modem.tar.md5
You can make any kind of package. Kernel, system... There's no limit!​
Dump your current ROM
If you want to backup your current ROM in a Odin package to share or to be restored later.
You can backup with or without user data, apps and Android settings, let's see how!
Things needed:
Brain
Fingers
Rooted device
Terminal Emulator app
USB cable or MicroSD adapter
Dump ROM without personal data/apps/settings:
Do this in Terminal Emulator
Code:
su (to enable superuser)
dd if=/dev/block/mmcblk0p3 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/system.img bs=4096
dd if=/dev/block/mmcblk0p15 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/kernel.bin bs=4096
# This backups into MicroSD card, if you want to backup to internal storage, change [COLOR="Red"]sdcard1[/COLOR] with [COLOR="Red"]sdcard0[/COLOR]
# If you are dumping a stock or stock-based ROM (that uses /preload), add also:
dd if=/dev/block/mmcblk0p9 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/hidden.img bs=4096
Dump ROM with personal data/apps/settings:
Do this in Terminal Emulator
Code:
su (to enable superuser)
dd if=/dev/block/mmcblk0p3 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/system.img bs=4096
dd if=/dev/block/mmcblk0p4 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/cache.img bs=4096
dd if=/dev/block/mmcblk0p5 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/userdata.img bs=4096
dd if=/dev/block/mmcblk0p15 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/kernel.bin bs=4096
# This backups into MicroSD card, if you want to backup to internal storage, change [COLOR="Red"]sdcard1[/COLOR] with [COLOR="Red"]sdcard0[/COLOR]
# If you are dumping a stock or stock-based ROM (that uses /preload), add also:
dd if=/dev/block/mmcblk0p9 of=/storage/[COLOR="Red"]sdcard1[/COLOR]/hidden.img bs=4096
Now transfer dumped files on PC.
Create Odin ROM package without personal data/apps/settings:
Code:
tar -H ustar -c system.img [COLOR="Red"]*hidden.img*[/COLOR] kernel.bin > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
*Only on stock/stock-based ROM
Create Odin ROM package with personal data/apps/settings:
Code:
tar -H ustar -c system.img cache.img userdata.img [COLOR="Red"]*hidden.img*[/COLOR] kernel.bin > package_name.tar
md5sum -t package_name.tar >> package_name.tar
mv package_name.tar package_name.tar.md5
​
That's all guys!!
If you have any question or trouble, feel free to ask
First....... Thank you so much i was just searching for something like that.
You made my day bro
I think that the sdcard1 should change to extSdCard? , that's the correct path for stock based ROM only i guess
LATEST EDIT: I tried to make a Harshjelly odin package, everything is fine until i start to flash it, it says NAND write failed @AntaresOne, any idea why?
[email protected] said:
I think that the sdcard1 should change to extSdCard? , that's the correct path for stock based ROM only i guess
LATEST EDIT: I tried to make a Harshjelly odin package, everything is fine until i start to flash it, it says NAND write failed @AntaresOne, any idea why?
Click to expand...
Click to collapse
Have you used kernel.bin.md5 as kernel?
AntaresOne said:
Have you used kernel.bin.md5 as kernel?
Click to expand...
Click to collapse
No, I just pull the kernel from the device which is the stock kernel, so in this case meaning that I should get cocore kernel which is already in .md5 extension?
[email protected] said:
No, I just pull the kernel from the device which is the stock kernel, so in this case meaning that I should get cocore kernel which is already in .md5 extension?
Click to expand...
Click to collapse
Yeah, CoCore is ok. I suggest to try some times with single components, in this way you can take confidence with the system

[Q] [Help] Problem with the .tar.md5

Hi! First, excuse me for my bad english, I'm making my best but I'm not very good at it
So I made a few ROMs for MTK phones in the past, where the ROM inside looks like this : http://img11.hostingpics.net/pics/96413520130823185012.jpg
But actually, I have some hard times with the samsung format, .tar.md5.
I downloaded the stock ROM as a base, and there's just one file inside. If I open it with 7-Zip, there are many .img etc, like thaht : http://i1056.photobucket.com/albums/t375/danielblasko67/Capture_zpsdfb0af1e.png
Also, if I try to use the stock ROM with kitchen, it says no system files found...
I downloaded a custom ROM for GS4, and it's in the good format like the first image.
If someone would help me, I'd be very graceful, thanks!
GhostReDo said:
Hi! First, excuse me for my bad english, I'm making my best but I'm not very good at it
So I made a few ROMs for MTK phones in the past, where the ROM inside looks like this : http://img11.hostingpics.net/pics/96413520130823185012.jpg
But actually, I have some hard times with the samsung format, .tar.md5.
I downloaded the stock ROM as a base, and there's just one file inside. If I open it with 7-Zip, there are many .img etc, like thaht : http://i1056.photobucket.com/albums/t375/danielblasko67/Capture_zpsdfb0af1e.png
Also, if I try to use the stock ROM with kitchen, it says no system files found...
I downloaded a custom ROM for GS4, and it's in the good format like the first image.
If someone would help me, I'd be very graceful, thanks!
Click to expand...
Click to collapse
I'm cooking a rom with linux... all works fine but after the flash with odin don't boot.
My commands are:
Code:
===============
===============
rm -fR /home/csh/models/android/
===============
rm -fR /home/csh/models/output/*
===============
mkdir /home/csh/models/android/
===============
tar -xvf /home/csh/Desktop/I9505XXUGNG8_I9505WINGNF2_I9505XXUGNG8_HOME.tar.md5 -C /home/csh/models/android/
sbl1.mbn
sbl2.mbn
sbl3.mbn
rpm.mbn
aboot.mbn
tz.mbn
boot.img
recovery.img
system.img.ext4
modem.bin
NON-HLOS.bin
cache.img.ext4
hidden.img.ext4
===============
simg2img /home/csh/models/android/system.img.ext4 /home/csh/models/android/system_extract.img
===============
mkdir /home/csh/models/android/mount_point/
===============
mount -o loop /home/csh/models/android/system_extract.img /home/csh/models/android/mount_point
===============
===============
/home/csh/ext4android/extras-build/ext4_utils/make_ext4fs -s -l $(ls -l --block-size=M /home/csh/models/android/system_extract.img | awk {'print $5'}| tr -d '\n') -a system /home/csh/models/android/system_changed.img /home/csh/models/android/mount_point/
Creating filesystem with parameters:
Size: 2894069760
Block size: 4096
Blocks per group: 32768
Inodes per group: 8032
Inode size: 256
Journal blocks: 11040
Label:
Blocks: 706560
Block groups: 22
Reserved block group size: 175
Created filesystem with 3478/176704 inodes and 607307/706560 blocks
===============
umount /home/csh/models/android/mount_point/
===============
rm -fR /home/csh/models/android/mount_point/
===============
rm -f /home/csh/models/android/system.img.ext4
===============
rm -f /home/csh/models/android/system_extract.img
===============
mv /home/csh/models/android/system_changed.img /home/csh/models/android/system.img.ext4
===============
cd /home/csh/models/android/ && tar -H ustar -c * > /home/csh/models/output/OUT.tar
===============
cd /home/csh/models/output/ && md5sum -t OUT.tar >> OUT.tar
===============
mv /home/csh/models/output/OUT.tar /home/csh/models/output/OUT.tar.md5
===============
rm -fR /home/csh/models/android/
You can use them and skip automate tools ...

GUIDE: Extract vendor from stock firmware

Hello guys, Here I bring a guide for setting up stock dump folder, which could be used to extract propietary from stock firmware.
**IMPORTANT!! THIS GUIDE IS TARGET TO MAPLE WHICH DOESN'T HAVE SEPARATE VENDOR PARTITION
For XZ1/XZ1C and all newer phones which comes with Android 8+ need to unsin, mount & copy vendor at same time.
OK, let's start
1.Download the latest stock firmware by using [TOOL] XperiFirm ~ Xperia Firmware Downloader [v5.4.0]
2. UnSin System and Kernel sin files from stock firmware.
Code:
./path/to/unsin /path/to/Kernel*.sin
./path/to/unsin /path/to/System*sin
Then you will get Kernel image and System ext4 file. In case your UnSin doesn't have execute permission, run chmod +x /path/to/unsin
3.Unpack the Kernel image by using AIK Android Image Kitchen
/path/to/AIK-Linux/unpackimg.sh /path/to/kernel*.img
You will get a ramdisk folder for your stock dump, which would be the root of your dump folder.
4.Change the ramdisk folder owner to yourself
chown -R $USER:$USER ramdisk
5, Mount the System image on somewhere, (e.g. /mnt/system) and change its owner to yourself
Code:
sudo mkdir /mnt/system
sudo mount -o loop /path/to/system*.ext4 /mnt/system/
sudo chown -R $USER:$USER /mnt/system
6, Copy system to your ramdisk folder
cp -r /mnt/system/* /path/to/ramdisk/system/
Then you are ready to extract vendor from stock now, just run the extract script in your device tree and you're all done:
/path/to/extract-files.sh /path/to/ramdisk
ENJOY!!!
Give me like if it helped to you

Categories

Resources