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
Related
RA Recovery image has an option Nandroid back + ext back up..if i wipe my extension..does anyone know how to restore your extension after full wipe?? Is that even possible??
You can back up your ext partition yourself:
mkdir /sdcard/ext
cp /system/sd/* /sdcard/ext/
and to restore (do this in the recovery console btw..)
mount -o rw /dev/block/mmcblk0p2 /system/sd
rm -r /system/sd/*
mount /sdcard
cp /sdcard/ext/* /system/sd/
Then all you need to do is reboot
Thanks for the help
BTW the "*"..what would i put in to replace the *
big_d093 said:
BTW the "*"..what would i put in to replace the *
Click to expand...
Click to collapse
The asterisk (*) is used as a wildcard in Unix/Linux (Android was built on Linux), so in this case it means "Anything"
Code:
cp /source/directory/* /destination/directory/
This command would simply copy "Anything" within the source directory to the destination directory.
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.tarThese 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.md5NOTE: 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.
Hello.
I have several troubles with my phone (adb not working, phone don't remeber usb connection mode after reboot, etc). And I cannot fix them with simple flashing. I want to try to fix them by writing data from fully working phone.
For this I need all partitions from I9001 except /system, /data, /boot, /recovery, /cache., /sdcard
Does anyone can share /dev/block/mmcblk0p1 - /dev/block/mmcblk0p27 except mmcblk0p8, mmcblk0p13, mmcblk0p15, mmcblk0p16, mmcblk0p17?
You could make parition images with
Code:
dd if=/dev/block/mmcblk0p1 of=/sdcard/1
dd if=/dev/block/mmcblk0p2 of=/sdcard/2
...
dd if=/dev/block/mmcblk0p27 of=/sdcard/27
I know it risky but I really need it.
this should do the tick
Code:
adb shell
su
mount -o remount rw /system
dd if=/dev/block/mmcblk0p12 of=/sdcard/persist.img bs=4096
dd if=/dev/block/mmcblk0p13 of=/sdcard/recovery.img bs=4096
dd if=/dev/block/mmcblk0p18 of=/sdcard/preload.img.ext4 bs=4096
dd if=/dev/block/mmcblk0p27 of=/sdcard/efs.img.ext4 bs=4096
o btw now I see that you need the working files, you could extract them from the odin one package and push em directly to your phone
broodplank1337 said:
o btw now I see that you need the working files, you could extract them from the odin one package and push em directly to your phone
Click to expand...
Click to collapse
But there is only
Code:
adsp.mbn
amss.mbn
boot.img
cache.img.ext4
recovery.img
system.img.ext4
I tried to flash other versions and this don't help.
Shtsh said:
But there is only
Code:
adsp.mbn
amss.mbn
boot.img
cache.img.ext4
recovery.img
system.img.ext4
I tried to flash other versions and this don't help.
Click to expand...
Click to collapse
Then i recommend you to boot in recovery (CWM) and format all partitions, then put phone in download mode and flash xxkps/xxkpu
broodplank1337 said:
Then i recommend you to boot in recovery (CWM) and format all partitions, then put phone in download mode and flash xxkps/xxkpu
Click to expand...
Click to collapse
I'm tried this Didn't help.
Those ODIN stock roms usually have modem binaries. I don't know if it is a good idea to dd different boot loaders to your phone. I would not do it in any case. Your phone is not that old. Reflash stock and claim warranty if it behaves badly.
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!
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