IOT – Compiling Brillo Easily
Google published the first version of Brillo, and as IoT researchers, the first thing that we want to do is to quickly compile and run it in order to get a feel for it, investigate it and learn as much as possible about the system…
At the beginning of our work we made some assumptions, which we found to have been correct:
- Instead of installing a new environment, it will be easier to install it on our AppUse VM which already has a lot of stuff on it.
- Google probably built it similarly to Android (both are Unix-based), so we took the Android compilation guide (links below).
Despite these shortcuts, we still came across a lot of trouble… I know for sure that you don’t want to waste your time to find and fix some stupid errors, so let me give you the shortest way to install it in a few steps and one script 🙂
Install Brillo
- Download AppUse (links below), unzip it and open it in vmware workstation/vmware player.
- This is an important step – in the VM settings, increase the number of the CPUs to 4, otherwise you won’t understand why it doesn’t work, and a workaround will take you a few days minimum. This is a tip coming from sad experience…
- Verify that the partition you installed AppUse on has 40 GB free.
- Run AppUse, open the terminal, press sudo -I and run the following script (it will take a few hours, be patient):
#install required packages
apt-get update
apt-get install openjdk-7-jdk
apt-get -y -qq 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
#download the source
cd /
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
mkdir brillo
cd brillo
git config –global user.name ‘appuse user’
git config –global user.email ‘anony@appsec-labs.com’
git config –global color.ui false
repo init -q -u https://android.googlesource.com/brillo/manifest
repo sync -q
#compile it
cd /brillo
source build/envsetup.sh
lunch brilloemulator_x86-eng
make -j4
- Now it is compiled, you just need to run it, use the following commands:
cd /brillo
export ANDROID_BUILD_TOP=/brillo/
/brillo/out/host/linux-x86/bin/brilloemulator-x86
- Inside Brillo, if you want to see where you are all the time, use the command:
export PS1=’$(whoami)@$(hostname):$(pwd)> ‘
Now it’s your time to explore! 🙂 You can find the weaved service, and adbd service. Adb should run for you as usual and will be detected by AppUse with the adb devices, adb pull/push commands etc.
Links
Download AppUse VM – https://appsec-labs.com/appuse/
Android download & compilation guide – http://source.android.com/source/downloading.html
Brillo source – https://android.googlesource.com/brillo/manifest
Avahi service – https://en.wikipedia.org/wiki/Avahi_(software)
i want to run some c++ exe on emulator. can you tell me how to push the exe in emulator running on ubuntu terminal.
can u tell me the various method to connect the emulator to HDD/pen drive or other flash device.
i am running brillo on virtual machine running on window host.
thanks in advanced
Running exe on unix OS:
http://askubuntu.com/a/262123
Pushing files to an emulator:
http://stackoverflow.com/a/20834609
About attaching a flash drive/device to an emulator, read the comments on the following answer:
http://stackoverflow.com/a/10927210