This page explains what happends when you run the the "
$ . build/envsetup.sh" or "
$ source build/envsetup.sh" script from
Parts of this article have been obtained from a blog by Cameron Pickett
At a glance
$ source build/envsetup.sh" or "
$ . build/envsetup.sh" from your shell runs the
envsetup.sh script in the
envsetup.sh adds many functions to the build environment, the most important of which are listed below. For a full list of functions see All commands.
||Builds using SCHED_BATCH on all processors|
||tapas [<App1> <App2> ...] [arm|x86|mips] [eng|userdebug|user]|
||Changes directory to the top of the tree|
||Makes from the top of the tree|
||Builds all of the modules in the current directory|
||Builds all of the modules in the current directory and pushes them to the device|
||Builds all of the modules in the supplied directories|
||Builds all of the modules in the supplied directories and pushes them to the device|
||Greps on all local C/C++ files|
||Greps on all local Java files|
||Greps on all local res/*.xml files|
||Go to the directory containing a file|
||Add git remote for CM Gerrit Review|
||A Git wrapper that fetches/pushes patch from/to CM Gerrit Review|
||Rebase a Gerrit change and push it again|
||Add git remote for matching AOSP repository|
||Builds the module(s) using mka and pushes them to the device|
||Cleans and builds using mka|
||Parallel repo sync using ionice and SCHED_BATCH|
||Installs a boot.img to the connected device|
||Installs a recovery.img to the connected device|
We will look at a few important functions that "
$ . build/envsetup.sh" adds to the build environment in detail below.
see also Doc:_Building_Basics
This little gem of a command is basically equivalent to a super-charged version of
make is the program that gets called to build our source, choosing the correct compiler for each part of the Android OS that we are making. Problem is, make is SLOW in its default configuration. It can take hours longer depending on your hardware. So what did they do? They mated
make with a cheetah, and took their child
mka improves upon
make by using the program
sched_tool to make full use of all the threads available on your machine (For AMD, this is equivalent to the number of cores your processor has; For Intel, this is usually equivalent to twice the number of cores your processor has, due to HyperThreading). What this means is that ALL of your processor is working, not just one small part of it.
You may not ever use this command, but in order to explain brunch, we have to explain breakfast first. Breakfast is a function used to configure your build. It keeps track of a list of officially-supported devices to build for, and allows you to choose one. You can do this two ways,
$ breakfast [device name]
$ breakfast (no device name)
The first method is like a shortcut to select your device. If you do not put a device, the script will output a list of available devices to build for (limited to those CM builds nightlies for, which isn't necessarily complete), and you can then choose yours.
breakfast then goes on to configure your build environment with the correct variables to create your device-specific rom.
brunch is equivalent to
$ breakfast [device name] && mka bacon
This means that it sets up your build environment to be configured for your device, and then commences the build process.
mka bacon is just CyanogenMods’s way of saying build the code for your device. It’s generally only used for officially supported devices (those for which a public CyanogenMod-maintained device repository exists).
This ones also pretty simple to explain. It’s used EXACTLY like
breakfast, the only difference being the choices you have to build with it, and how it configures the device. Using lunch, you can choose non-official or non-standard builds for your device. This includes special debug versions and also allows you to build CyanogenMod for use on the Android Emulator. Unlike
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