How do I download a ROM from a Samsung Galaxy S3? I have two identical Samsung Galaxy S3 (model GT-I9300), one running the stock rom and one running cyanogenmod. I want to download the rom from the one with the stock one and install it on the other one.

How do I download, with Odin or Heimdall, the rom from the stock S3?
You mean to take the Firmware (FW) out from the stock-FW phone and put it into the other one as-is? to have two identical-FW phones?

The confusion is in download/upload words, when you put the phone in bootloader mode it's saying "Download mode". From the phone's point of view, it's going to download stuff from PC.
If you want to take out the FW. It would be upload.

That's why it's safer to say flash and dump. Even though it's not really flashing.



It's somewhat possible to dump the FW, but there is usually no reason for doing so. Download the same version from the Internet and you'll end up with exactly the same system files as on other phones with the same FW version.

How to find specific firmware version on the Internet

On the stock-FW phone, go to Settings -> About Device -> Build number
and take a note of the second part of the number. It'll be something like I9300UBUGOD1
That also includes CSC version. Now search for this version on these two sites:
Samsung-Updates
SamMobile
or put it into Gugl, usually something cames out.
Flash it to target phone from PC using Odin. No root required.


To dump firmware from a phone

There could be a way to dump the phone without rooting, but no one knows how. We can only assume this possibility because there is a disabled option to Dump in Odin program. But I tried, as many others, with factory rooted phone, developer phone or one with unsecured test pre-release firmware version, the dump option is never available in the Odin program.
It's either just for some very special pre-release FW, or it was never implemented in the Odin software, or it was planned and never finished in phone's bootloader, because for no real usability perhaps? Or it must be activated by some special cable, or button combination presses.
Or it was put there by engineers in Korea just to taunt curious hackers.
I believe the latter, as even in new FW, if you dig in bootloader resources, you'll find a graphics showing green Android taunter with words "Upload mode".

So this is a known way to dump FW anyway:

Note that you'll need to root the stock-FW phone, to Dump it.
Firstly we need to find out which files we need to dump and then flash:
Open firmware's TAR or TAR.md5 file of any version of THE SAME model using 7zip and look inside. Note the names of files included.
Later you'll need to rename files you'll dump to the same names as those in this TAR. There is much more partitions that you can dump, than those you can flash. Files which are inside TAR should be enough to fully flash a phone, but not always all partitions are included, sometimes they leave bootoaders out.
In the list on the bottom I marked those which are never included by -
and those which I remember seeing in TAR files by +
Use that list to rename dumped files which you want to flash by Odin from Partition Name to Flash Filename, or get this list from your phone by following method. Be aware that you must not flash PIT and EFS, but you might dump it to have a backup.

To get a list out from your phone:


get Heimdall
connect phone
switch driver to libusb
in Heimdall - Utilities - Download PIT file
switch driver back by removing libusb in Windows Device Manager
alternatively download PIT from the Internet, but you'll need to trust whoever is posting it that it's not from another phone, version, or broken
go back in Heimdall
use printpit to print your PIT file
Note each entry which contains both: "Partition Name" and "Flash Filename"
EXCEPT PIT and EFS partition. Make a backup but DO NOT FLASH PIT or EFS from one phone to another.


Now we have a naming scheme, Partition Name is how the file with partition will be dumped, and Flash Filename how it should be re-named before flashing.
Note that some partitions are not documented and there is no knowledge outside of the factory of what are they for. They might be for storing specific phone's information, or calibration data calculated and flashed once in factory for each phone.
Flash only partitions you'll find in stock TAR files.
Those not-in-TAR-file should be flashed only as last resort, when you know that those on target phone has been damaged. And always backup them before flashing new ones over them.

Make this dumping step on both target and source phones. On target just to have an backup.


root the phone
flash custom recovery TWRP recomended, but not working well on some models
boot into recovery
plug on PC, use adb or qtADB to go to /dev/block/platform/folder_with_different_name_in_each_phone/by-name
dd or use qtADB to copy "files" except USERDATA from that folder to media partition, sdcard, or UFD using USB OTG


Next on PC (or check alternative below):


rename all files according to flash files naming scheme
if you add recovery partition dumped from the rooted source phone, it will change targed status to custom, making KNOX disabled, same as if you just rooted it. If you don't want that either include official recovery from the same version of stock FW, or if there is working partition in the phone just don't include recovery in the TAR flash
on a linux machine or in cygwin Tar those files into TARball using ustar mode
no need to md5 it, as you probably trust yourself that you won't damage the file. but if you must than md5 it and concat hash to the end of TAR, rename to TAR.MD5
flash in Odin, no root required


Alternatively, but only for rooted phones, you can use dd on target phone, or MobileOdin.



be very careful, you must NOT flash PIT and EFS partition, even though they are mentioned in PIT file. For each phone EFS contains specific data, some of which are encrypted using some serial number taken from the phone. So each efs only works in the one phone which it's designed for. By flashing it, you'll loose the original one, that's not easily recoverable.

also no need to care about recovery partition, as it's not stock partition but custom, from the rooting process.



I know the DUMP part of this guide is not extra descriptive, but each step would need a separate post. If you're completely lost in it, consider downloading ready FW from the Internet.



s3 FW list dumped using heimdall. Might change with different FW versions:

+
Partition Name: APNHLOS
Flash Filename: NON-HLOS.bin

+
Partition Name: MDM
Flash Filename: modem.bin

Partition Name: SBL1
Flash Filename: sbl1.mbn

Partition Name: SBL2
Flash Filename: sbl2.mbn

Partition Name: SBL3
Flash Filename: sbl3.mbn

+
Partition Name: ABOOT
Flash Filename: aboot.mbn

Partition Name: RPM
Flash Filename: rpm.mbn

+
Partition Name: TZ
Flash Filename: tz.mbn

-
Partition Name: MODEMST1
Flash Filename: nvrebuild1.bin

-
Partition Name: MODEMST2
Flash Filename: nvrebuild2.bin

-
Partition Name: M9KEFS1
Flash Filename: m9kefs1.bin

-
Partition Name: M9KEFS2
Flash Filename: m9kefs2.bin

-
Partition Name: M9KEFS3
Flash Filename: m9kefs3.bin

+
Partition Name: SYSTEM
Flash Filename: system.img.ext4

+ this is CSC, might be left out
Partition Name: CACHE
Flash Filename: cache.img.ext4

+ only sometimes
Partition Name: PARAM
Flash Filename: param.lfs

+
Partition Name: BOOT
Flash Filename: boot.img

+ but you can't Dumb stock recovery as to dump you need root, to get root recovery is usually overwriten
Partition Name: RECOVERY
Flash Filename: recovery.img

Partition Name: PERSDATA
Flash Filename: persdata.img.ext4

+ but contains only crapware, version is connected with CSC
Partition Name: HIDDEN
Flash Filename: hidden.img.ext4

Partition Name: CARRIER
Flash Filename: carrier.img.ext4

- this is /data and INTERNAL STORAGE, aka sdcard, do not dump it's HUGE and there is no reason
Partition Name: USERDATA
Flash Filename: userdata.img.ext4

Partition Name: PGPT
Flash Filename: pgpt.img

- it is included sometimes but to change layout, NEVER FLASH IT might hard brick phone
Partition Name: PIT
Flash Filename: MSM8960.pit

+
Partition Name: MD5
Flash Filename: md5.img

Partition Name: SGPT
Flash Filename: sgpt.img