Skip to content

Commit

Permalink
Heimdall 1.4 RC1:
Browse files Browse the repository at this point in the history
    - Massive refactoring.
    - Support for Qualcomm based devices.
    - Print PIT from file.
    - Use partition names as arguments e.g. --HIDDEN, --KERNEL, --MOVINAND etc.
    - Heimdall Frontend UI improvements.
    - And much more...
  • Loading branch information
Benjamin-Dobell committed Oct 1, 2012
1 parent 66f1e84 commit 6cd6b35
Show file tree
Hide file tree
Showing 90 changed files with 21,766 additions and 13,637 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -1,2 +1,10 @@
.DS_Store .DS_Store
._* ._*
Debug/
Release/
GeneratedFiles/
*.vcxproj.user
*.suo
*.sdf
heimdall-frontend/Qt4VSPropertySheet.props
*.opensdf
88 changes: 49 additions & 39 deletions Linux/README
@@ -1,4 +1,4 @@
Heimdall (c) 2010-2011 Benjamin Dobell, Glass Echidna Heimdall (c) 2010-2012 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/products/heimdall/ http://www.glassechidna.com.au/products/heimdall/


DISCLAIMER: DISCLAIMER:
Expand Down Expand Up @@ -84,11 +84,12 @@ Performing a Custom Flash with Heimdall Frontend:
This is the advanced means of flashing firmware to your device. This is the advanced means of flashing firmware to your device.


If you're not an advanced user or a developer, in the event that a Heimdall If you're not an advanced user or a developer, in the event that a Heimdall
Firmware Package doesn't exist for the particular firmware (or files) that Firmware Package doesn't exist for the particular firmware (or files) that
you wish to flash, then I strongly recommend you get in touch with developer you wish to flash, then I strongly recommend you get in touch with the
of the firmware (or files) and politely ask them to create a Heimdall developer of the firmware (or files) and politely ask them to create a
Firmware Package for you. In doing so then you don't have to worry about Heimdall Firmware Package for you. In doing so, you avoid the risk of
making mistakes due to inexperience. making mistakes due to inexperience.



If you're looking to customise an existing Heimdall Firmware Package then If you're looking to customise an existing Heimdall Firmware Package then
follow steps 1-8 of "Flashing Heimdall Firmware Package with Heimdall follow steps 1-8 of "Flashing Heimdall Firmware Package with Heimdall
Expand All @@ -104,7 +105,8 @@ Performing a Custom Flash with Heimdall Frontend:
as multiple archives (nested or otherwise), extract them all to the same as multiple archives (nested or otherwise), extract them all to the same
location. location.


NOTE: If you want to use the CSC then extract it last. NOTE: If you want to use the CSC then extract it last. If you're asked
to overwrite files then do so.


3. Open the a terminal and run Heimdall Frontend by typing: 3. Open the a terminal and run Heimdall Frontend by typing:


Expand All @@ -116,14 +118,14 @@ Performing a Custom Flash with Heimdall Frontend:
5. Before you can chose which partitions you want to flash with particular 5. Before you can chose which partitions you want to flash with particular
files you MUST first select a PIT file. To do this click the "Browse" files you MUST first select a PIT file. To do this click the "Browse"
button in the "PIT" section. This will open a dialogue allowing you to button in the "PIT" section. This will open a dialogue allowing you to
navigate to and select a valid PIT (.pit) file. navigate to and select a valid PIT (.pit) file.


If you do not already have a valid PIT file stored on your computer you If you do not already have a valid PIT file stored on your computer you
can download your device's PIT file from the "Utilities" tab. can download your device's PIT file from the "Utilities" tab.

6. If a valid PIT file has been selected then "Add" button below the 6. If a valid PIT file has been selected then the "Add" button below the
"Partitions (Files)" list-box will become enabled. Press this button to "Partitions (Files)" list-box will be enabled. Press this button to add
add a partition to your flash. a partition to your flash.


7. When you first add a partition you will see the "Partition Name" and 7. When you first add a partition you will see the "Partition Name" and
"Partition ID" be populated with information. Use the "Partition Name" "Partition ID" be populated with information. Use the "Partition Name"
Expand Down Expand Up @@ -229,8 +231,7 @@ How to Create a Heimdall Firmware Package:
create a package from scratch, or you can load an existing package, apply create a package from scratch, or you can load an existing package, apply
modifications and then save the package. Creating a package from scratch modifications and then save the package. Creating a package from scratch
is the preferred approach, by taking this approach you're far less likely is the preferred approach, by taking this approach you're far less likely
to run into file name length limitations. These are not Heimdall's own to run into file name length limitations.
limitation but rather a limitation of the TAR archive format.


Before you can access Heimdall Frontend's firmware creation functionality Before you can access Heimdall Frontend's firmware creation functionality
(available from the "Create Package" tab) you must first specify which (available from the "Create Package" tab) you must first specify which
Expand All @@ -254,14 +255,14 @@ How to Create a Heimdall Firmware Package:
Firmware Name - This is the name of your particular firmware. An Firmware Name - This is the name of your particular firmware. An
example would be "Cyanogenmod". example would be "Cyanogenmod".


Firmware Version - This is the version identifier for your package. Any Firmware Version - This is the version identifier for your package. Any
valid string will be accepted although a the inclusion of decimal valid string will be accepted, although the inclusion of decimal
point version number is preferred i.e. "7.1". If it makes sense point version number is preferred i.e. "7.1". If it makes sense
then feel free to append a text string like "RC1" or "Beta 1" to then feel free to append a text string like "RC1" or "Beta 1" to
the decimal point version. the decimal point version.


Platform Name - This is the name of the platform (or operating system) Platform Name - This is the name of platform (or operating system) that
that your firmware is based on. In most cases this will simply be your firmware is based on. In most cases this will simply be
"Android". "Android".


Platform Version - This is the operating system version that your Platform Version - This is the operating system version that your
Expand Down Expand Up @@ -295,8 +296,8 @@ How to Create a Heimdall Firmware Package:
team name. Click "Add" and the developer will be added to the list team name. Click "Add" and the developer will be added to the list
on the right. If you make a mistake you can select a developer from on the right. If you make a mistake you can select a developer from
the list and click "Remove". You can list as many developers as you the list and click "Remove". You can list as many developers as you
like however visual constraints of the "Load Package" tab means like, however visual constraints of the "Load Package" tab means
only a few names will be visible. Where possible you may want to only a few names will be visible. Where possible you may want to
opt for team names over listing individual team members. opt for team names over listing individual team members.




Expand Down Expand Up @@ -359,8 +360,9 @@ for the format in their own software.




All Heimdall Firmware Packages must contain a file called firmware.xml. This All Heimdall Firmware Packages must contain a file called firmware.xml. This
file stores flash information and meta-data for the package as well as file stores flash information and meta-data for the package as well as
information about other files contained within the package. information about other files contained within the package.



The format is fairly straight-forward so it won't be explained in great detail. The format is fairly straight-forward so it won't be explained in great detail.
Nonetheless the following is an example of a valid firmware.xml file. Nonetheless the following is an example of a valid firmware.xml file.
Expand Down Expand Up @@ -458,20 +460,28 @@ be included.







Appendix B - Installing Heimdall from Source: Appendix B - Installing Heimdall from Source:


1. First make sure you have installed build-tools, pkgconfig, zlib-dev and 1. First make sure you have installed build-tools, pkgconfig, zlib-dev and
libusb-1.0-dev (v1.0.8 or newer). libusb-1.0-dev (v1.0.8 or newer).

NOTE: Package names may not be absolutely identical to those above. NOTE: Package names may not be absolutely identical to those above.


2. Open a terminal and navigate to the directory you downloaded, 2. Open a terminal and navigate to the directory you downloaded,
or extracted, Heimdall to. or extracted, Heimdall to.


3. Enter the following commands to compile libpit. 3. Enter the following commands to compile libpit:


cd libpit cd libpit
./configure
make
cd ..

If you have problems please consult http://www.libusb.org/

4. Enter the following commands to compile libpit.

cd libusb-1.0
./configure ./configure
make make
cd .. cd ..
Expand All @@ -486,11 +496,11 @@ Appendix B - Installing Heimdall from Source:
sudo make install sudo make install
cd .. cd ..


NOTE: As an alternative to "sudo make install" you may chose to generate NOTE: As an alternative to "sudo make install" you may chose to generate
a package by typing the following: a package by typing the following:

sudo checkinstall --pkgversion <version> sudo checkinstall --pkgversion <version>

Where <version> is the current Heimdall release e.g. 1.3.0 Where <version> is the current Heimdall release e.g. 1.3.0


5. Done 5. Done
Expand All @@ -510,9 +520,9 @@ Appendix C - Installing Heimdall Frontend from Source:
4. Enter the following commands to compile and install Heimdall Frontend: 4. Enter the following commands to compile and install Heimdall Frontend:


cd heimdall-frontend cd heimdall-frontend
qmake heimdall-frontend.pro qmake-qt4 heimdall-frontend.pro
make make
sudo make install sudo make install


NOTE: As an alternative to "sudo make install" you may chose to generate NOTE: As an alternative to "sudo make install" you may chose to generate
a package by typing the following: a package by typing the following:
Expand Down
2 changes: 1 addition & 1 deletion README
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Heimdall (c) 2010-2011 Benjamin Dobell, Glass Echidna Heimdall (c) 2010-2012 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/products/heimdall/ http://www.glassechidna.com.au/products/heimdall/


DISCLAIMER: DISCLAIMER:
Expand Down
15 changes: 0 additions & 15 deletions heimdall-frontend/Qt4VSPropertySheet.props

This file was deleted.

2 changes: 2 additions & 0 deletions heimdall-frontend/Source/FirmwareInfo.cpp
Expand Up @@ -772,7 +772,9 @@ void FirmwareInfo::WriteXml(QXmlStreamWriter& xml) const
xml.writeStartElement("files"); xml.writeStartElement("files");


for (int i = 0; i < fileInfos.length(); i++) for (int i = 0; i < fileInfos.length(); i++)
{
fileInfos[i].WriteXml(xml, Packaging::ClashlessFilename(fileInfos, i)); fileInfos[i].WriteXml(xml, Packaging::ClashlessFilename(fileInfos, i));
}


xml.writeEndElement(); xml.writeEndElement();


Expand Down
25 changes: 22 additions & 3 deletions heimdall-frontend/Source/Packaging.cpp
Expand Up @@ -301,7 +301,7 @@ bool Packaging::WriteTarEntry(const QString& filePath, QTemporaryFile *tarFile,


// Note: We don't support base-256 encoding. Support could be added later. // Note: We don't support base-256 encoding. Support could be added later.
sprintf(tarHeader.fields.size, "%011llo", file.size()); sprintf(tarHeader.fields.size, "%011llo", file.size());
sprintf(tarHeader.fields.modifiedTime, "%011llo", qtFileInfo.lastModified().toMSecsSinceEpoch() / 1000); sprintf(tarHeader.fields.modifiedTime, "%011llo", qtFileInfo.lastModified().toTime_t());


// Regular File // Regular File
tarHeader.fields.typeFlag = '0'; tarHeader.fields.typeFlag = '0';
Expand Down Expand Up @@ -381,6 +381,24 @@ bool Packaging::CreateTar(const FirmwareInfo& firmwareInfo, QTemporaryFile *tarF


for (int i = 0; i < fileInfos.length(); i++) for (int i = 0; i < fileInfos.length(); i++)
{ {
// If the file was already compressed we don't compress it again.
bool skip = false;

for (int j = 0; j < i; j++)
{
if (fileInfos[i].GetFilename() == fileInfos[j].GetFilename())
{
skip = true;
break;
}
}

if (skip)
{
progressDialog.setValue(i);
continue;
}

QString filename = ClashlessFilename(fileInfos, i); QString filename = ClashlessFilename(fileInfos, i);


if (filename == "firmware.xml") if (filename == "firmware.xml")
Expand All @@ -389,7 +407,7 @@ bool Packaging::CreateTar(const FirmwareInfo& firmwareInfo, QTemporaryFile *tarF
return (false); return (false);
} }


if (!WriteTarEntry(fileInfos[i].GetFilename(), tarFile, ClashlessFilename(fileInfos, i))) if (!WriteTarEntry(fileInfos[i].GetFilename(), tarFile, filename))
{ {
tarFile->resize(0); tarFile->resize(0);
tarFile->close(); tarFile->close();
Expand Down Expand Up @@ -666,7 +684,8 @@ QString Packaging::ClashlessFilename(const QList<FileInfo>& fileInfos, int fileI


QString otherFilename = fileInfos[i].GetFilename().mid(lastSlash + 1); QString otherFilename = fileInfos[i].GetFilename().mid(lastSlash + 1);


if (filename == otherFilename) // If the filenames are the same, but the files themselves aren't the same (i.e. not the same path), then rename.
if (filename == otherFilename && fileInfos[i].GetFilename() != fileInfos[fileInfoIndex].GetFilename())
renameIndex++; renameIndex++;
} }


Expand Down
95 changes: 95 additions & 0 deletions heimdall-frontend/Source/aboutform.cpp
Expand Up @@ -18,12 +18,107 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/ THE SOFTWARE.*/


// Qt
#include <QDir>
#include <QProcess>

// Heimdall Frontend // Heimdall Frontend
#include "aboutform.h" #include "aboutform.h"


#define UNUSED(x) (void)(x)

using namespace HeimdallFrontend; using namespace HeimdallFrontend;


AboutForm::AboutForm(QWidget *parent) : QWidget(parent) AboutForm::AboutForm(QWidget *parent) : QWidget(parent)
{ {
setupUi(this); setupUi(this);

// Heimdall Command Line
QObject::connect(&heimdallProcess, SIGNAL(readyRead()), this, SLOT(HandleHeimdallStdout()));
QObject::connect(&heimdallProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(HandleHeimdallReturned(int, QProcess::ExitStatus)));
QObject::connect(&heimdallProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(HandleHeimdallError(QProcess::ProcessError)));

heimdallFailed = false;

RetrieveHeimdallVersion();
}

void AboutForm::RetrieveHeimdallVersion(void)
{
heimdallProcess.setReadChannel(QProcess::StandardOutput);

heimdallProcess.start("heimdall", QStringList("version"));
heimdallProcess.waitForFinished(350);

// OS X was playing up and not finding heimdall, so we're manually checking the PATH.
if (heimdallFailed)
{
QStringList environment = QProcess::systemEnvironment();

QStringList paths;

// Ensure /usr/bin is in PATH
for (int i = 0; i < environment.length(); i++)
{
if (environment[i].left(5) == "PATH=")
{
paths = environment[i].mid(5).split(':');
paths.prepend("/usr/bin");
break;
}
}

int pathIndex = -1;

while (heimdallFailed && ++pathIndex < paths.length())
{
QString heimdallPath = paths[pathIndex];

if (heimdallPath.length() > 0)
{
heimdallFailed = false;

if (heimdallPath[heimdallPath.length() - 1] != QDir::separator())
heimdallPath += QDir::separator();

heimdallPath += "heimdall";

heimdallProcess.start(heimdallPath, QStringList("version"));
heimdallProcess.waitForFinished(350);
}
}

if (heimdallFailed)
versionCopyrightLabel->setText(versionCopyrightLabel->text().replace("%HEIMDALL-VERSION%", ""));
}
}

void AboutForm::HandleHeimdallStdout(void)
{
QString version = heimdallProcess.readAll();

if (version.length() > 0)
{
if (version.at(0) == QChar('v'))
version = version.mid(1);

versionCopyrightLabel->setText(versionCopyrightLabel->text().replace("%HEIMDALL-VERSION%", "Version " + version + "<br />"));
}
}

void AboutForm::HandleHeimdallReturned(int exitCode, QProcess::ExitStatus exitStatus)
{
UNUSED(exitCode);
UNUSED(exitStatus);

// If for some reason %HEIMDALL-VERSION% hasn't been replaced yet, we'll replace it with an empty string.
versionCopyrightLabel->setText(versionCopyrightLabel->text().replace("%HEIMDALL-VERSION%", ""));
} }

void AboutForm::HandleHeimdallError(QProcess::ProcessError error)
{
UNUSED(error);

heimdallFailed = true;
}

0 comments on commit 6cd6b35

Please sign in to comment.