[GUIDE] How To Convert ODIN Tars to System.imgs for CWM (and vice versa)

Search This thread

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
This will probably get moved, but I do believe it is development related because it is important to everyone who flashes ROMs but can't use ODIN for whatever reason (ie Linux/Mac users).

Seeing all the ROM cookers get asked so much to make system.imgs or update.zips to cater to the Linux/Mac users, I decided it was time to tell people how to just convert an ODIN Tar.

I will tell people how to do it on Ubuntu seeing that is what I have (in a VM), but once I have the patience to install Mac OS in a VM, I shall make a guide for that.

Please note that if the factoryfs.rfs is in RFS format (ie it's a stock ROM or it's a ROM by someone who doesn't like EXT4 for whatever reason), you will not be able to do this. The format the factoryfs.rfs is in (EXT2, 4, JFS, whatever) needs to be supported by your Linux kernel. You can check that by doing cat /proc/filesystems

After a lot of investigating, I have learnt that RFS is a broken version of FAT. You could poke around with it and try mounting it as vfat but I don't guarantee success.

ODIN TAR -> System.img
  1. Download your TAR and save it to your Desktop (I will use Kyorarom Ascendency Beta)
  2. Open the TAR with Archive Manager (or whatever you use) and extract the factoryfs.rfs from it to your desktop. You don't need anything else
  3. Open Terminal (under Applications > Accessories)
  4. Go into superuser mode:
    Code:
    sudo -s
  5. Make a mountpoint for the system:
    Code:
    mkdir /mnt/system
  6. Mount the image
    Code:
    mount -o loop ~/Desktop/factoryfs.rfs /mnt/system
  7. Change directory to /mnt and make the tarball for the system.img
    Code:
    cd /mnt
    tar cvf system.img system
  8. Unmount and clean up
    Code:
    umount /mnt/system
    rm -rf /mnt/system
  9. Copy the system.img to your phone

System.img -> ODIN TAR
  1. Download a TAR from another ROM, and the system.img to your desktop.
  2. Open the TAR with Archive Manager (or whatever you use) and extract the factoryfs.rfs from it to your desktop. You don't need anything else
  3. Open Terminal (under Applications > Accessories)
  4. Go into superuser mode:
    Code:
    sudo -s
  5. Make a mountpoint for the system:
    Code:
    mkdir /mnt/system
  6. Mount the image
    Code:
    mount -o loop ~/Desktop/factoryfs.rfs /mnt/system
  7. Change directory to /mnt and make the tarball for the system.img
    Code:
    cd /mnt
    rm -rf system/*
    tar xvf ~/Desktop/system.img
  8. Unmount and clean up
    Code:
    umount /mnt/system
    rm -rf /mnt/system
  9. Put the factory.rfs into a TAR and flash it with ODIN.



Done! Hopefully this should all work nicely for everyone.
 
Last edited:

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
Can u pls explain tht furthur.

Pretty much do the same thing but from in ADB shell, and instead of the command:

Code:
sudo -s

with

Code:
su

and

Code:
tar cvf system.img system

gets changed to

Code:
tar cvf /sdcard/system.img system

Also I'm pretty sure on the phone, /dev/loop0 is called /dev/block/loop0.
 
  • Like
Reactions: vsoft11

TearsDontFalls

Senior Member
Sep 28, 2011
285
140
Wouldnt it be easier if you run this commands?
Code:
mount -o loop factoryfs.rfs ~/Desktop/system
tar cvf system.img system
the mount command mounted it succesfully for me
 

harkan89

Senior Member
May 18, 2011
398
74
35
Dubai
As MacOS is basically Unix you should be able to do the same with/on/in a mac when you open a Terminal/Console (forgot how it's called exactly)....

Wait a sec.. I have to use adb for this? Cuz I tried the commands as mark mentioned but it didnt turn up any results.. I do recognize some of these commands, so probably it should run on the mac Terminal..
 

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
Wouldnt it be easier if you run this commands?
Code:
mount -o loop factoryfs.rfs ~/Desktop/system
tar cvf system.img system
the mount command mounted it succesfully for me

Because I am foolish. I shall improve the guide later today.

Wait a sec.. I have to use adb for this? Cuz I tried the commands as mark mentioned but it didnt turn up any results.. I do recognize some of these commands, so probably it should run on the mac Terminal..

I got my Mac VM working so I will use that and make a Mac guide.
 

cdesai

Inactive Recognized Developer
Jan 16, 2011
2,296
4,088
IN YOUR HEAD
Wait a sec.. I have to use adb for this? Cuz I tried the commands as mark mentioned but it didnt turn up any results.. I do recognize some of these commands, so probably it should run on the mac Terminal..
You can use adb too (but these commands should work on a Mac too, as Mac | Linux -- UNIX (based on)

Or you can always use cwm!
 

harkan89

Senior Member
May 18, 2011
398
74
35
Dubai
You can use adb too (but these commands should work on a Mac too, as Mac | Linux -- UNIX (based on)

Or you can always use cwm!

I have superuser enabled on mac.. WHen I try the first command.. mkdir /mnt/system.. it says no such file or directory found.. and losetup is apparently not a command recognized by mac terminal.. :(
 

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
is there also a way to convert system.img to tar files...

Yes, I shall make a guide for that after Christmas.

I have superuser enabled on mac.. WHen I try the first command.. mkdir /mnt/system.. it says no such file or directory found.. and losetup is apparently not a command recognized by mac terminal.. :(

Macs don't use a /mnt directory. They use /Volumes, just like how Ubuntu is moving over to /media.

And I don't think the mach kernel supports losetup type stuff. I will make a Mac guide after Christmas.
 
  • Like
Reactions: harkan89

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    This will probably get moved, but I do believe it is development related because it is important to everyone who flashes ROMs but can't use ODIN for whatever reason (ie Linux/Mac users).

    Seeing all the ROM cookers get asked so much to make system.imgs or update.zips to cater to the Linux/Mac users, I decided it was time to tell people how to just convert an ODIN Tar.

    I will tell people how to do it on Ubuntu seeing that is what I have (in a VM), but once I have the patience to install Mac OS in a VM, I shall make a guide for that.

    Please note that if the factoryfs.rfs is in RFS format (ie it's a stock ROM or it's a ROM by someone who doesn't like EXT4 for whatever reason), you will not be able to do this. The format the factoryfs.rfs is in (EXT2, 4, JFS, whatever) needs to be supported by your Linux kernel. You can check that by doing cat /proc/filesystems

    After a lot of investigating, I have learnt that RFS is a broken version of FAT. You could poke around with it and try mounting it as vfat but I don't guarantee success.

    ODIN TAR -> System.img
    1. Download your TAR and save it to your Desktop (I will use Kyorarom Ascendency Beta)
    2. Open the TAR with Archive Manager (or whatever you use) and extract the factoryfs.rfs from it to your desktop. You don't need anything else
    3. Open Terminal (under Applications > Accessories)
    4. Go into superuser mode:
      Code:
      sudo -s
    5. Make a mountpoint for the system:
      Code:
      mkdir /mnt/system
    6. Mount the image
      Code:
      mount -o loop ~/Desktop/factoryfs.rfs /mnt/system
    7. Change directory to /mnt and make the tarball for the system.img
      Code:
      cd /mnt
      tar cvf system.img system
    8. Unmount and clean up
      Code:
      umount /mnt/system
      rm -rf /mnt/system
    9. Copy the system.img to your phone

    System.img -> ODIN TAR
    1. Download a TAR from another ROM, and the system.img to your desktop.
    2. Open the TAR with Archive Manager (or whatever you use) and extract the factoryfs.rfs from it to your desktop. You don't need anything else
    3. Open Terminal (under Applications > Accessories)
    4. Go into superuser mode:
      Code:
      sudo -s
    5. Make a mountpoint for the system:
      Code:
      mkdir /mnt/system
    6. Mount the image
      Code:
      mount -o loop ~/Desktop/factoryfs.rfs /mnt/system
    7. Change directory to /mnt and make the tarball for the system.img
      Code:
      cd /mnt
      rm -rf system/*
      tar xvf ~/Desktop/system.img
    8. Unmount and clean up
      Code:
      umount /mnt/system
      rm -rf /mnt/system
    9. Put the factory.rfs into a TAR and flash it with ODIN.



    Done! Hopefully this should all work nicely for everyone.
    2
    Wouldnt it be easier if you run this commands?
    Code:
    mount -o loop factoryfs.rfs ~/Desktop/system
    tar cvf system.img system
    the mount command mounted it succesfully for me

    Because I am foolish. I shall improve the guide later today.

    Wait a sec.. I have to use adb for this? Cuz I tried the commands as mark mentioned but it didnt turn up any results.. I do recognize some of these commands, so probably it should run on the mac Terminal..

    I got my Mac VM working so I will use that and make a Mac guide.
    1
    Nice One... :) Should be helpful for ROM Developers to provide system.img for their ROM's... :)
    1
    Can u pls explain tht furthur.

    Pretty much do the same thing but from in ADB shell, and instead of the command:

    Code:
    sudo -s

    with

    Code:
    su

    and

    Code:
    tar cvf system.img system

    gets changed to

    Code:
    tar cvf /sdcard/system.img system

    Also I'm pretty sure on the phone, /dev/loop0 is called /dev/block/loop0.
    1
    is there also a way to convert system.img to tar files...

    Yes, I shall make a guide for that after Christmas.

    I have superuser enabled on mac.. WHen I try the first command.. mkdir /mnt/system.. it says no such file or directory found.. and losetup is apparently not a command recognized by mac terminal.. :(

    Macs don't use a /mnt directory. They use /Volumes, just like how Ubuntu is moving over to /media.

    And I don't think the mach kernel supports losetup type stuff. I will make a Mac guide after Christmas.