Brillo - Building from Source Code

Building Brillo from Source Code:

Need 40GB VM diskspace (ubuntu, tools, code, build), 2GB swap, 2GB RAM.
Took 4+hrs. More RAM should make it much much faster.

Follow Android build/environment steps:

https://source.android.com/source/building.html
# Update Ubuntu 10.04
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
# for lunch
sudo apt-get install python-lunch
# for java and javac
sudo apt-get install openjdk-7-jre-headless
sudo apt-get install openjdk-7-jdk


ccache is a compiler cache for C and C++ that can help make builds faster. In the root of the source tree, do the following:
export USE_CCACHE=1
export CCACHE_DIR=$HOME/.ccache # /<path_of_your_choice>/.ccache
prebuilts/misc/linux-x86/ccache/ccache -M 50G
# The suggested cache size is 50-100G.
# watch ccache being used by doing the following:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s




error: ro.build.fingerprint cannot exceed 91 bytes:

Example:
Brillo/brilloemulator_x86_64/brilloemulator_x86_64:6.0.60/MASTER/shreekant02040032:eng/test-keys (96)
To avoid this error, use suitable shorter user login name such that fingerprint doesn't exceed 91 bytes.


For instance, above becomes 89 char fingerprint for user "sk":
Brillo/brilloemulator_x86_64/brilloemulator_x86_64:6.0.60/MASTER/sk02040032:eng/test-keys


Building From Official (Stable) Release:

# Ref https://developers.google.com/brillo/docs/reference/downloads
wget https://dl.google.com/dl/brillo/bdk/latest/bdk-latest.tar.gz
tar -xzf bdk-latest.tar.gz
{BDK_PATH}/tools/bdk/brunch/brunch bsp list
{BDK_PATH}/tools/bdk/brunch/brunch bsp download <bsp-name>

bdk$ source build/envsetup.sh && lunch
selected 9. brilloemulator_x86_64-eng
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.60
TARGET_PRODUCT=brilloemulator_x86_64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_CPU_VARIANT=
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_BUILD_TYPE=release
BUILD_ID=MASTER
OUT_DIR=out

bdk$ make -j
TARGET_DEVICE brilloemulator_x86_64 (build-brilloemulator_x86_64.ninja??)

? /home/sk/brillo/bdk/hardware/bsp/kernel/common/android-3.18
? /home/sk/brillo/bdk/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin

[100% 10445/10445] Install system fs image: out...target/product/brilloemulator_x86_64/system.img
out/target/product/brilloemulator_x86_64/system.img+out/target/product/brilloemulator_x86_64/recovery.img maxsize=802897920 blocksize=2112 total=793860096 reserve=8110080




# Brillo emulator - Runtime setup

export PATH=\
/usr/lib/jvm/java-7-openjdk-amd64/bin:/home/sk/brillo/bdk/out/host/linux-x86/bin:/home/sk/brillo/bdk/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin:/home/sk/brillo/bdk/prebuilts/gcc/linux-x86/:/home/sk/brillo/bdk/development/scripts:/home/sk/brillo/bdk/prebuilts/devtools/tools:/home/sk/brillo/bdk/external/selinux/prebuilts/bin:/home/sk/brillo/bdk/prebuilts/android-emulator/linux-x86_64:$PATH

export ANDROID_BUILD_TOP=/home/sk/brillo/bdk

# Start brillo emulator
./out/host/linux-x86/bin/brilloemulator-x86_64


Building from Latest Development Branch: (Just for info; Not actually tried/tested)

# Ref http://www.cnx-software.com/2015/11/23/how-to-build-and-run-brillo-operating-system-from-source-code/
mkdir brillo-master
cd brillo-master
# for repo
sudo apt-get install phablet-tools
repo init -u https://android.googlesource.com/brillo/manifest -b master
many more commands & useful fixes in Ref.
https://android.googlesource.com/device/generic/brillo/
https://android.googlesource.com/brillo/manifest/




No comments:

Post a Comment