Doc: About Edify

From CyanogenMod
Jump to: navigation, search

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 a firmware however. It can be used to do lots of different things, such as simply replace specific files or format entire partitions, depending on what instructions the script contains.

Note: Useless Trivia

The edify language is Google's replacement for the previous scripting language, which was called "Amend". True story.

Typically, the edify script is run in recovery mode when the user chooses to "flash a zip".

edify files

There are typically two parts to an edify script. These two files are usually found within the .zip file in the /META-INF/com/google/android directory. Note that both the script and the code that interprets the script are together within the .zip.

The files 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 script itself, 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. By looking at the scripts themselves, you may be able to figure out how they work. Then, by modifying the code right on the .zip and flashing it to your device, you can test your custom scripts.

Read the edify source code

Because the source code to edify is open and available, anyone can view how the interpreter works, including proper syntax and available commands.

CyanogenMod's source is currently available on Github (and build instructions, including how to download the full source code, are available on this wiki for building a .zip from scratch.)

The main tool used to generate the edify scripts is here and the source for the language interpreter is here.

Note:

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

Additional resources

There are a few online resources that discuss the edify language.

Helpful Tip

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

Take a look at the following links. These may be out of date, however. So the source code should be the final authority about which commands are available to you, and how to use them.