Envsetup help

At a glance

Invoking $ source build/envsetup.sh from your shell adds several functions to the build environment. These are listed below with short descriptions. Reference build/envsetup.sh for the most recent list of commands.

mka Builds using SCHED_BATCH on all processors
lunch lunch <vendor_name>_<product_name>-<build_variant>
breakfast breakfast <product_name>
brunch brunch <product_name>
omnom omnom <product_name>
tapas tapas [<App1> <App2> …] [arm|x86|mips] [eng|userdebug|user]
croot Changes directory to the top of the tree
m Makes from the top of the tree
mm Builds all of the modules in the current directory
mmp Builds all of the modules in the current directory and pushes them to the device
mmm Builds all of the modules in the supplied directories
mmmp Builds all of the modules in the supplied directories and pushes them to the device
cgrep Greps on all local C/C++ files
jgrep Greps on all local Java files
resgrep Greps on all local res/*.xml files
godir Go to the directory containing a file
cmremote Add git remote for CM Gerrit Review
cmgerrit A git wrapper that fetches/pushes patch from/to CM Gerrit Review
cmrebase Rebase a Gerrit change and push it again
aospremote Add git remote for matching AOSP repository
mkap Builds the module(s) using mka and pushes them to the device
cmka Cleans and builds using mka
reposync Parallel repo sync using ionice and SCHED_BATCH
repopick Utility to fetch changes from Gerrit.
installboot Installs a boot.img to the connected device
installrecovery Installs a recovery.img to the connected device

Helpful Tip

See also Building Basics

Commands in greater detail

A few important functions that $ source build/envsetup.sh adds to the build environment are detailed below.


mka improves upon make by using sched_tool to make full use of all the CPU threads available on your machine. This is usually equal to the number of cores in your CPU, unless you have HyperThreading, in which case it is twice the number of cores in your processor.


Breakfast is used to prepare the build environment for a specific device. You can use it in one of two ways:

$ breakfast [device name]


$ breakfast

The first method prepares a device for building. If the device tree is not found locally, roomservice fetches the device tree and its dependencies from CyanogenMod’s GitHub repository (only officially supported CyanogenMod devices, of course). If you do not specify a device, a list of available devices that can be built is output.


brunch is equivalent to

$ breakfast [device name] && mka bacon

brunch sets up your build environment for a device and commences the build process of a full CyanogenMod (unofficial) release that can be installed through recovery.


lunch is used like breakfast, except you can specify non-official devices or non-standard builds for your device. If building for an unofficial device, you must already have the device tree and all of its dependencies synced locally. The non-standard builds include special debug versions (e.g. eng) and also allows you to build CyanogenMod for use on the Android Emulator. Unlike breakfast, lunch makes no assumptions with regard to device configuration locations and formats, so it will scan the entire tree for matching options (depending on the number of locally available devices, this may take a significant amount of time). To build after running lunch, simply issue the command mka. No bacon hereā€¦ sorry.

List of all commands in envsetup.sh

  • addcompletions
  • add_lunch_combo
  • aospremote
  • breakfast
  • brunch
  • cgrep
  • check_product
  • check_variant
  • choosecombo
  • chooseproduct
  • choosetype
  • choosevariant
  • cmgerrit
  • cmka
  • cmrebase
  • cmremote
  • cproj
  • croot
  • dopush
  • eat
  • findmakefile
  • gdbclient
  • get_abs_build_var
  • getbugreports
  • get_build_var
  • getlastscreenshot
  • getprebuilt
  • getscreenshotpath
  • getsdcardpath
  • gettargetarch
  • gettop
  • godir
  • hmm
  • installboot
  • installrecovery
  • isviewserverstarted
  • jgrep
  • key_back
  • key_home
  • key_menu
  • lunch
  • _lunch
  • m
  • makerecipe
  • mka
  • mm
  • mmm
  • omnom
  • pid
  • printconfig
  • print_lunch_menu
  • repodiff
  • repolastsync
  • reposync
  • repopick
  • resgrep
  • runhat
  • runtest
  • set_java_home
  • setpaths
  • set_sequence_number
  • set_stuff_for_environment
  • settitle
  • smoketest
  • startviewserver
  • stopviewserver
  • systemstack
  • tapas
  • tracedmdump

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.