[HOW-TO]Heimdall One-Click - ROM Packaging and Distribution System
Introduction
Heimdall One-Click is a open-source stack of software intended to eliminate our dependence on Odin and provide an unrivaled safe method to perform a complete flash of a device. Heimdall One-Click will work on any device which Heimdall covers. Heimdall One-click and Heimdall One-Click Packager can be used to distribute custom or stock firmware upgrades or downgrades currently on most Samsung devices. Each of the sections in this post could be an entire post on its own. I want to consolodate this information into a single area here on XDA.
Heimdall One-Click is a project which I have been perfecting for months. After 147 revisions I feel it is time to release. It is my hope that the use of this software will enable users to safely flash and understand what is going on while they are flashing firmware. Heimdall One-Click is based on Heimdall by Benjamin Dobell.
The basic outline goes like this...
Obtain firmware
Use Heimdall frontend to package a tar.gz
Select your tar.gz file with Heimdall One-Click. Your final package will be a executable cross-platform JAR file for redistribution which will deploy everything needed to flash your ROM.
It's really that simple. See the Downloads and Source section. I will now discuss how everything works in depth.
Warning
You have the power to damage your device and others! Several times during the development cycle I had asked myself if it was ethical to release a packager. A lack of skill can easily brick a device. Building a flashable package is a skill and I do not want to see any One-Click Nukes released into the public. So I want to set some rules-of-thumb:
1. If you are unsure, do not package bootloaders into a distribution.
2. If you are going to package bootloaders, include boot.bin, Params.lfs, Sbl.bin and repartitioning option should be checked.
3. Always flash the firmware from Heimdall-Frontend before creating a one-click. Never assume it will work.
4. Please watch this video in its entirety before attempting to package a one-click.
Heimdall One-Click Packager
Heimdall One-Click packager is a tool which will take a Heimdall tar.gz file and package it into a Heimdall One-Click. Heimdall One-Click Packager is an open-source cross-platform(win/linux/mac) program with no dependencies. After execution, the user selects a tar.gz package for one-click and the program:
1. Decompresses firmware.xml from tar.gz
2. Deploys an empty one-click java jar.
3. Writes the Tar.gz and firmware.xml into the one-click jar thereby creating a new one-click executable firmware package.
Heimdall One-Click
Heimdall One-Click's job is simple; it deploys firmware with one click while keeping the user informed. Heimdall One-Click is an open-source cross-platform(win/linux/mac), dependency installing, easy-to-use, automation tool which can install firmware onto a device in download mode. Heimdall One-Click's operation is very simple from the outside, but the operation is very complex inside. See source code for more information. Heimdall One-Click has several safety features built in which make it the safest method of deploying firmware to any compatible device.
Why use Heimdall One-Click over Odin or other methods of software distribution?
Heimdall is Open-Source software. Without Open-Source software we would not have android or custom ROMs. Open-Source developers should support and expand the work of other Open-Source developers.
Odin is closed source and propritary. Not only is the application proprietary, but the drivers are also proprietary. Open-Source developers do not support Closed-Source work as it is a hindrance to development.
Heimdall supports Open-Source Tar.GZ compression which ensures file integrity and provides higher compression than zip formats. A 500 megabyte ROM can compress to less than 200 megabytes.
Heimdall can restore operation to a device which does not even have access to recovery mode. Heimdall does not require the kernel to be operational, it works at a higher level in the Secondary Bootloader.
A Heimdall One-Click is a single executable file which contains everything needed to flash a ROM.
A Heimdall One-Click works on Windows, Linux or Mac OS-X.
A Heimdall One-Click is not a final output format. Once you make a One-Click, the contents are not lost forever. The ROM package contained within can be unzipped using your favorite archive program, modified and redistributed.
Easiest, most portable, and foolproof method of flashing
Heimdall One-Click has been designed to be the easiest, most portable and foolproof method of flashing. The requirements are that the user knows how to put their device into "Download Mode" and that the user has Java installed on their computer.
Heimdall One-Click contains:
A deployable and unpackable firmware located in /com/adamoutler/heimdalloneclick/
Installer routines
Windows Drivers
Windows C++ Redistributable Package
Windows Heimdall binary
Linux32 Debian package
Linux64 Debian package
Mac OS-X Installation package
You can find a repository of prepackaged ROMs here at the Team Komin website: http://files.teamkomin.com/ Please note, some of these were packaged during beta testing so not all of them are high quality builds.
Obtaining firmware
Before you can package a ROM for distribution, you must have firmware to package. Here are two methods of obtaining firmware.
Obtaining firmware from a live device
The following commands can be used on most Samsung Android devices to make a backup of everything but bootloaders. Bootloaders must be obtained from official builds and cannot be pulled off a working device after you have finished developing. This may not work on devices designed for RFS filesystems if the filesystems have been converted
Open a terminal to your device (terminal emulator or QuickSSHD, or adb shell)
Enter the following commands into the terminal
Code:
su
#Remove the target folder if it is present
rm -r -f /sdcard/firmwarepackage
#Write all zeros to data partition to zero flash memory until the partition is full
dd if=/dev/zero of=/data/big_zero bs=1048576
#Remove the zerod out dummy file
rm -r -f /data/big_zero
#Mount The /system folder as RW so we can read and write to it
mount -o remount,rw /system /system
#Drop all zeros into a file on the /system partition until it is full
dd if=/dev/zero of=/system/big_zero bs=1048576
#Remove the zerod out dummy file
rm /system/big_zero
#Make our folder to write the firmware package onto the SDCard
mkdir /sdcard/firmwarepackage
#Begin transfer of all relevant blocks to sdcard
dd if=/dev/block/stl9 of=/sdcard/firmwarepackage/factoryfs.img bs=4096
dd if=/dev/block/bml7 of=/sdcard/firmwarepackage/zImage bs=4096
dd if=/dev/block/stl10 of=/sdcard/firmwarepackage/dbdata.img bs=4096
dd if=/dev/block/stl11 of=/sdcard/firmwarepackage/cache.img bs=4096
dd if=/dev/block/bml12 of=/sdcard/firmwarepackage/modem.bin bs=4096
#Done
echo done
copy the files from your sdcard in the firmwarepackage folder to your desktop/laptop computer. Never mount an RFS filesystem to your computer Your computer is not equipped to handle the RFS filesystem. All permissions data will be lost and the filesystem will be rendered useless.
Using Heimdall Frontend, you can download the part.pit from the options tab to obtain the partition tables for custom ROM use.
Use Heimdall frontend to package a tar.gz
Use Heimdall One-Click Packager to make a One-Click
Obtaining firmware from Odin packages
You will need a base firmware package to obtain bootloaders for your device. Firmware can be obtained from several sites. Some of the more common are:
It is important that these firmwares be verified on your own device before distribution.
Totally decompress the entire firmware package down to its individual files
Use heimdall-frontend to create a package
Use One-Click Packager to generate a one-click.
Recommended Distribution Instructions
Once you have verified that your package has been made correctly, you will want to distribute it. Here is a recommended blurb which I have found to be effective from multiple tests. Replace "MY ROM" with your ROM name and MYROM.COM with your download link.
[ list=1]
[ *]You will need Java installed on your computer Do you have java?
[ *]right click and open with Java
[ *]Put your device in "Download Mode" and click the flash button
[ *]Problems? Enter "Recovery Mode" and select "factory reset"[/list][ size=4][ url=MYROM.COM]Click here to Download My ROM![/url][/size]
Conclusion and Disclaimer
The source and applications are released under the MIT License. I have provided these resources at no cost to you without warranty. I will not be held liable. It is up to you to use these programs responsibly.
Forward
We are looking to expand Heimdall to work on more devices. We need devices to work with. Please see http://www.glassechidna.com.au/open for more information
I ignore PMs with questions that could be answered by searching. If you PM me, I probly won't respond.
Check out my developer pages. Add me to your circles on Google Plus.
RFS is full of bugs, you cannot read/write RFS filesystems on any computer.
RFS is prone to corruption (in many more ways you can expect)
RFS doesn't have a "packer" that zeroes empty portions in order to get filesystem images with good compressibility (IE: free space will be by default full of junk)
Also, compared to the well established update.zip format: this method doesn't provide a clean method to execute post-flashing scripts.
Why I advice not using the method described here to distribute custom ROMs as RFS.
However, distributing official firmwares in this format could be nice, but I'm not sure it's worth the hassle of re-packaging.
Note: for Ext4 based ROMs and devices like Galaxy S II or Galaxy Tab 10.1, this tool can make sense (ext4 fs packing tools are available in AOSP)
Come here to chat: #project-voodoo on IRC/freenode network - 50% general, 50% dev
Supercurio, your notes on RFS are appreciated, but irrelevant if the guide I've provided is followed.
As a precaution, never mount an RFS Filesystem to your computer directly. It will corrupt the filesystem and Voodoo Lagfix will fail and bootloop. Apply Voodoo Lagfix after pulling the partitions. Flash a kernel, reboot, then pull partitions. This way you can mount it on your computer.
why to use this? using this method you will be able to ensure what is on your device is on your user's device. Rather than expecting that they are running a certain version of a certain firmware prior to applying an update.zip Heimdall One-Click also provides the easiest method to installing a custom kernel in order to get ClockWork Mod on a stock device.
As Supercurio mentioned, repackaging an odin file as a Heimdall One-Click may be a hassel, but Heimdall One-Clicks work on Linux, Windows or Mac OS-X.
I'm not going to go through all methods of development nor the functions of each file. However, if you wish to perform a factory reset, use a params.lfs from an official firmware package. If not, use the params from an active device.
There's downfalls to each method of distribution.
Update.zip requires that the user have a specific version of a specific firmware on their device. Heimdall One-Click does not require this.
Update.zip allows modification of firmware on a device. Heimdall One-Click will obliterate all firmware.
Update.zip is exactly as it says, it is an update. Heimdall One-Click is an entire firmware package.
Update.zip requires knowledge of a proprietery scripting format. Heimdall One-Click requires knowledge of Android filesystems only.
For this reason, packaging as a Heimdall One-Click makes your firmware package immortal rather than having a lifespan/dependency. A properly packaged Heimdall One-Click will always work without any expectation of the firmware on a user's device. It's a very clean way to distribute firmware.
I ignore PMs with questions that could be answered by searching. If you PM me, I probly won't respond.
Check out my developer pages. Add me to your circles on Google Plus.
I have a 1007 Captivate and Odin / Keis were unreliable at best.
I'd love to see some Odin 1-Click repackaging for this. I could use them!!!
Downloads / upgrades with the Heimdall method have been easy to monitor and and
part that failed could easily be retried.
Without the Odin 1-click to stock being available (or failing, leaving me in an unknown state), I found the ability to use PIT, and target each section of the ROM to be critical in booting a new ROM if there is any reason the upgrade went awry from within Android.
Stock ROMs repackaged will help Odinphobes!
Erbid
Captivate 1007 / at&t
Fasty III, KI2 1.3
One Happy Cappy!
Adam,
Does Heimdall frontend know which cache and dbdata file to use from a stock package, or do i need to manually select them? I've noticed that in a full package, there is a cache and dbdata file in two different places, but I do not know which one should be used. Also, should the param.lfs file be used only if flashing bootloaders, or should it always be included?
Adam,
Does Heimdall frontend know which cache and dbdata file to use from a stock package, or do i need to manually select them? I've noticed that in a full package, there is a cache and dbdata file in two different places, but I do not know which one should be used. Also, should the param.lfs file be used only if flashing bootloaders, or should it always be included?
Edit
I am using stock firmware for a Captivate.
Dbdata goes in dbdata. Cache goes in cache. Paramaribo is a bootloaders. Watch the video.
I ignore PMs with questions that could be answered by searching. If you PM me, I probly won't respond.
Check out my developer pages. Add me to your circles on Google Plus.
Ok, I watched the video (great tutorial,btw), but I still don't know what to do about my problem. In a stock captivate package, there is a dbdata and cache file in the pda package, and another dbdata and cache file in the csc package. Which one gets used and which one gets tossed?
Ok, I watched the video (great tutorial,btw), but I still don't know what to do about my problem. In a stock captivate package, there is a dbdata and cache file in the pda package, and another dbdata and cache file in the csc package. Which one gets used and which one gets tossed?
Just use one or the other.
I ignore PMs with questions that could be answered by searching. If you PM me, I probly won't respond.
Check out my developer pages. Add me to your circles on Google Plus.
Given the amount of coverage that Android receives around here, you could almost be … more
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?