Cells: Environment Reference


While it is not necessary, you may find it useful to define the following variables in your shell environment. They are used by the source-me.sh shell script and during development and compilation. The source-me.sh file will prompt you for values, but defining them in your environment will avoid this step 😉

Name Description
ANDROID_ROOT Root of the Cells Android source tree
ANDROID_IMGS Path where compiled system images will be copied with the cpimgs command (see below).
ANDORID_KERNEL_DIR Directory containing the Android kernel source. By default this is $ANDROID_ROOT/kernel.


The source-me.sh file in the Cells source repository defines several useful shell functions to aid in the development process.

Function Usage
Kernel Compilation
kbuild Primary kernel cross-compilation / configuration command used by the others. This command invokes the Linux kernel build system, keeping the object-file output in the Android target intermediates directory, and ensuring proper cross-compilation by automatically detecting the target architecture and toolchain paths. You may pass any standard make arguments such as -j4. In general, you should be able to use this without arguments.

kbuild [make options / variables]

kconfig Configure the Android Linux kernel via the ncurses menuconfig.


kmodules Builds Linux kernel modules and installs them into the /system/lib/modules directory in the target output filesystem.


kheaders Installs sanitized Linux kernel headers into an target-specific intermediate directory where they can be included in other Android programs. The directory is put into the include path by the POSER build system.


kboot Boots a compiled kernel on the target device.


Flashing / File Pushing
aflash Flash a set of images onto a device. NOTE when used without any options, aflash will reboot your phone and flash the most recently compiled images.

aflash [options]
            -b                      : flash only the boot partition
            -nb                     : SKIP flashing the boot partition
            -nr                     : SKIP the automatic device reboot after flashing
            -k                      : Flash the kernel built in $ANDROID_KERNEL_DIR
            -kk [/path/to/kernel]   : path to the kernel image (or directory)
            -imgs [/path/to/imgdir] : path to a directory containing compiled
                                      Android images (defaults to $ANDROID_PRODUCT_OUT)
apush Copy files from the Android intermediate output directory onto a device (using adb) NOTE: this function is deprecated. You can use adb sync to instead!

apush [-h] [sysdir] [path-glob] {dst_dir}
            -h          : show this help screen
            [sysdir]    : directory under $TOP/out/target/product/$TARGET_PRODUCT/
                          to search for [path-glob]
                          e.g. system/bin
            [path-glob] : path(s) to file(s) to push
                          e.g. "*cell*"
            {dst_dir}   : optional parameter to specify the directory on
                          the device into which [path-glob] will be placed
    To push all files in $TOP/out/target/product/$TARGET_PRODUCT/system/bin
    whose file names contain 'ril' (e.g. libril.so) onto the sdcard of the device
    you would do:
        apush system/bin "*ril*" /sdcard
cpimgs Copy / archive compiled Android system, userdata and kernel images.

cpimgs [Options] [path/to/destination] [android_product_name]
               -f          Force overwriting of destination images
               -h|--help   Display help text
               path/to/destination      Path where images are copied. Can be absolute or
                                        relative to $ANDROID_IMGS
               android_product_name     Target product name - defaults to TheRightThing(tm)
emu Run the Android emulator... not fully supported at this time
rfa This function is a utility wrapper around the Android-provided repo forall command. It will echo (in color) the name of each repository before performing the specified command.

rfa [command [arg1 [arg2 [arg3 …]]]]

Columbia University Department of Computer Science