Social Networking Security Adam C. Champion and Dong Xuan CSE 4471: Information Security.
Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.
-
Upload
lauren-preston -
Category
Documents
-
view
222 -
download
8
Transcript of Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.
![Page 1: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/1.jpg)
1
Building Your Own Android Systems from Source
Adam C. Champion
CSE 5236: Mobile App Development
![Page 2: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/2.jpg)
2
Outline
• Motivation• Preparing a Build Environment• Obtaining Source Code• Building Systems
![Page 3: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/3.jpg)
3
Motivation
• Why build your own system?– Full control over device software (remove “bloat,” address
security and privacy)– Extend device lifetime beyond “official” OS support– Research (e.g., wireless networking, mobile systems, etc.)– Customize device (e.g., themes, lockscreens)
• Disclaimers:– This will definitely void your warranty – system building is at
your own risk! I am not responsible if you “brick” your device!– Using a custom Android system on a cellular network may
violate your network operator’s terms of service– We’ll only cover building Android Open Source Project (AOSP);
Google services are proprietary
![Page 4: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/4.jpg)
4
Preparing a Build Environment (1)
• What you’ll need: [1]– 64-bit Mac OS X or Linux
(Ubuntu LTS, Debian)*– ≥ 16 GB RAM– ≥ 150 GB disk space to build
Android system; ≥ 200 GB for multiple builds
– JDK version 5–7 (see table)– Python 2.6–2.7– GNU Make 3.81–3.82– Git– A few hours …
JDK Version Android Version to be Compiled
5 1.5–2.2
6 2.3–4.4
7 5+
* MS Windows users need to create Linux VM (e.g., using VirtualBox [2]).The above system requirements are minimum for building (plus VM overhead).
![Page 5: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/5.jpg)
5
Preparing a Build Environment (2)
• Install prerequisites [3]:– OS X: Xcode, command-line utilities (Mac App Store);
GNU make, git, ccache from MacPorts, Homebrew– Linux: Software updates, needed packages [3]– ccache is strongly recommended to speed up build
process [3]
• Linux users need to enable USB access: [4]wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
![Page 6: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/6.jpg)
6
Preparing a Build Environment (3)
• Install repo, create a working directory. Run the following in a shell: [4]$ mkdir ~/bin$ PATH=~/bin:$PATH$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo$ mkdir WORKING_DIRECTORY$ cd WORKING_DIRECTORY$ repo init -u https://android.googlesource.com/platform/manifest
$ repo sync
– Be prepared to wait a few hours, especially with the last command!
![Page 7: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/7.jpg)
7
Building the System
• Run the following in a shell: [4]$ . build/envsetup.sh$ lunch$ # Pick an option. Make sure to select a “*-userdebug” or “*-eng” build
$ export USE_CCACHE=1$ export CCACHE_DIR=/<path_of_choice>/.ccache$ prebuilts/misc/linux-x86/ccache/ccache -M 50G$ make -j4
On OS X, replace linux-x86 with darwin-x86
• This process takes several hours.An SSD greatly decreases compile time…
![Page 8: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/8.jpg)
8
Installing System on Device
• Prerequisites:– Unlock device bootloader (voids warranty)– Get root access on your device (varies for device, voids warranty)
• Google Nexus devices (up to Nexus 6) strongly recommended for system building
• Ensure you download the proprietary binaries for your (Nexus) device from [5], device manufacturer
• Then run tar xvzf <driver> at a shell for each downloaded driver <driver> (may vary for devices)
• Now run at a shell:$ adb reboot bootloader$ fastboot flashall -w
![Page 9: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/9.jpg)
9
More to Explore
• Build CyanogenMod (a custom Android ROM) via similar process as AOSP [6]
• Xposed: JAR file loaded into each Android executable for customization [7]
• Bluetooth: Swap Linux BlueZ stack with Android’s “BlueDroid” on Nexus devices [8]
• F-Droid: Free/open-source Android software repository alternative to Google Play [9]
• The rest is up to you!
![Page 10: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/10.jpg)
10
Thank You
Questions and comments?
![Page 11: Building Your Own Android Systems from Source Adam C. Champion CSE 5236: Mobile App Development 1.](https://reader036.fdocuments.us/reader036/viewer/2022082613/5697bfdf1a28abf838cb27bc/html5/thumbnails/11.jpg)
11
References
1. AOSP, https://source.android.com/source/requirements.html
2. Oracle, VirtualBox, http://www.virtualbox.org
3. AOSP, https://source.android.com/source/initializing.html
4. AOSP, https://source.android.com/source/downloading.html
5. Google Inc., https://developers.google.com/android/nexus/drivers
6. CyanogenMod, https://wiki.cyanogenmod.org/w/Main_Page
7. XDA-Developers, http://forum.xda-developers.com/xposed/xposed-installer-versions-changelog-t2714053
8. AOSP-BlueZ, https://code.google.com/p/aosp-bluez/
9. F-Droid, http://f-droid.org