Author Topic: Convert *.IMG to *.TAR for use with ODIN  (Read 1917 times)

empulse

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Convert *.IMG to *.TAR for use with ODIN
« on: May 07, 2015, 09:36:16 AM »
img2tar


Program I setup to change your *.IMG file to *.TAR for use with Odin.   It should handle Odin v1 - v3.
Make sure to BACK-UP everything first.

As of now, it simply handles Recovery images, others to come.

I AM NOT RESPONSIBLE FOR YOU BREAKING ANYTHING.
USE AT OWN RISK.

http://www.mediafire.com/download/fb7hl7lzcjuscax/img2tar.rar

1. Place recovery image in folder with App
2. make sure it is named recovery.img
3. Open App
4. Select Odin Output
5. Convert



Any issues?  let me know...

empulse

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Re: Convert *.IMG to *.TAR for use with ODIN
« Reply #1 on: May 07, 2015, 09:39:24 AM »
Source [VB]:
Code: [Select]
Imports System.Globalization
Imports System.IO
Imports System
Imports System.Diagnostics
Imports System.ComponentModel

Public Class Form1

    Private Results As String
    Private Delegate Sub delUpdate()
    Private Finished As New delUpdate(AddressOf UpdateText)

    Private Sub UpdateText()
        txtResults.Text = Results
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        If verBox.SelectedIndex = -1 Then
            Button1.Enabled = False

        End If
    End Sub

    Private Sub verBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles verBox.SelectedIndexChanged

        If verBox.SelectedIndex = 0 Or 1 Or 2 Then
            Button1.Enabled = True

        End If
    End Sub

    Private Sub CMDAutomate()
        Dim myprocess As New Process
        Dim StartInfo As New System.Diagnostics.ProcessStartInfo
        StartInfo.FileName = "cmd" 'starts cmd window
        StartInfo.RedirectStandardInput = True
        StartInfo.RedirectStandardOutput = True
        StartInfo.UseShellExecute = False 'required to redirect
        StartInfo.CreateNoWindow = True 'creates no cmd window
        myprocess.StartInfo = StartInfo
        myprocess.Start()
        Dim SR As System.IO.StreamReader = myprocess.StandardOutput
        Dim SW As System.IO.StreamWriter = myprocess.StandardInput

        If verBox.SelectedIndex = 0 Then

            SW.WriteLine("copy \recovery.img \xrecovery.img") '
            SW.WriteLine("data\mv.exe \xrecovery.img zImage") '
            SW.WriteLine("data\tar.exe -cf \Recovery[Odin-Flashable].tar zImage") '
            SW.WriteLine("del zImage") '
            SW.WriteLine("exit") 'exits command prompt window
            Results = SR.ReadToEnd 'returns results of the command window
            SW.Close()
            SR.Close()
            'invokes Finished delegate, which updates textbox with the results text
            Invoke(Finished)

        ElseIf verBox.SelectedIndex = 1 Then

            SW.WriteLine("data\tar.exe -cf \recovery.tar \recovery.img") '
            SW.WriteLine("data\md5sum.exe -t \recovery.tar >> \recovery.tar") '
            SW.WriteLine("data\mv.exe \recovery.tar \Recovery[Odin-Flashable].tar") '
            SW.WriteLine("exit") 'exits command prompt window
            Results = SR.ReadToEnd 'returns results of the command window
            SW.Close()
            SR.Close()
            'invokes Finished delegate, which updates textbox with the results text
            Invoke(Finished)

        ElseIf verBox.SelectedIndex = 2 Then

            SW.WriteLine("data\tar.exe -cf \recovery.tar \recovery.img") '
            SW.WriteLine("data\md5sum.exe -t \recovery.tar >> \recovery.tar") '
            SW.WriteLine("data\mv.exe \recovery.tar \Recovery[Odin-Flashable].tar.md5") '
            SW.WriteLine("exit") 'exits command prompt window
            Results = SR.ReadToEnd 'returns results of the command window
            SW.Close()
            SR.Close()
            'invokes Finished delegate, which updates textbox with the results text
            Invoke(Finished)

        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        If Not File.Exists(Application.StartupPath & "\recovery.img") Then
            MessageBox.Show("Please place recovery image renamed to RECOVERY.IMG in the same folder as this program...")
            Exit Sub

        Else

            Dim CMDThread As New Threading.Thread(AddressOf CMDAutomate)
            CMDThread.Start()

        End If
    End Sub
End Class