Doc: About Edify

From CyanogenMod
Jump to: navigation, search
Other languages:German 9% • ‎English 100% • ‎Chinese (China) 100%

What is "edify"?

edify is a simple scripting language that is used to install CyanogenMod and other software from a .zip file. The edify script does not necessarily need to be used to flash firmware. It can be used to replace/add/delete specific files, or even format partitions. Typically, an edify script is run in recovery mode when the user chooses to "flash a zip".

Note: Trivia

The edify language is Google's replacement of another scripting language, called "Amend". True story.

edify files

There are two primary files for edify. These files are found within the .zip file in the META-INF/com/google/android directory. They are:

  • update-binary -- the binary interpreter that is executed when the user selects the .zip to be flashed, typically from recovery mode. This binary loads the updater-script into memory and follows the instructions contained within.
  • updater-script -- the installation script, which is a text file.

Learning edify syntax

Play with existing scripts

One way to learn about edify is by examining and modifying existing edify scripts. Unpack a flashable .zip file and pay attention to the directory structure. Examine the script in META-INF/com/google/android; you should be able to figure out it works. Then, try your hand at creating a very minimal installation package, for instance something that installs a small text file to /data/local/tmp/ and test it on your device.

Read the edify source code

Because the source code to edify is open and available, anyone can view how the interpreter works. This gives you a clear understanding of the proper syntax and available commands.

CyanogenMod's source code is available on Github. Build instructions, including how to download the full source code, is available for official supported devices on the device build guides page.

The main tool used to generate the edify scripts is edify_generator.py and the source for the language interpreter is in the android_bootable_recovery repository.

Note:

An overview of edify's syntax can be found in the README within the source.

Helpful Tip

Even if you don't understand how to program, you can probably glean a lot of good information by scanning the source code and reading the comments in the code.

Additional resources

There are a few online resources that discuss the edify language. These may be out of date, however. So the source code (discussed above) should be the final authority about which commands are available to you, and how to use them.