Skip to content

Instantly share code, notes, and snippets.

@szepnapot
Created May 10, 2019 09:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szepnapot/77da9537f3fc2789dc528f239d2524f3 to your computer and use it in GitHub Desktop.
Save szepnapot/77da9537f3fc2789dc528f239d2524f3 to your computer and use it in GitHub Desktop.
[How to build Androdi ROMs on Ubuntu 16.04] #aosp #build #ubuntu
# setup repo tool
mkdir -p ~/bin
wget 'https://storage.googleapis.com/git-repo-downloads/repo' -P ~/bin
r
# install dependencies
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk android-tools-adb bc bison build-essential curl flex g++-multilib gcc-multilib gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc yasm zip zlib1g-dev
mkdir -p ~/aosp/pie
# init aosp directory
# get branches and tags from here: https://source.android.com/setup/start/build-numbers
repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r37 --depth=1
# download and sync
repo sync
# create compiler cache to speed up things
# also limit it a bit
export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 20G
# configure Jack
# give it 50% of your server's RAM
export ANDROID_JACK_VM_ARGS="-Xmx8g -Dfile.encoding=UTF-8 -XX:+TieredCompilation"
# prepare the build
source build/envsetup.sh
# run lunch and pass the codename of your device to it, suffixed with a build type
# which can be either `eng`, `userdebug`, or `user`
# `eng` and `userdebug` build types result in ROMs that are best suited for testing purposes
# `user` build type is recommended for production use.
# To run the emulator, you'll need to build for one of the
# - aosp_arm
# - aosp_arm64
# - aosp_x86
# - aosp_x86_64
# - aosp_blueline only works with the real device!
# more on build variants: https://source.android.com/setup/develop/new-device#build-variants
lunch aosp_blueline-userdebug
# should output something like this
# ============================================
# PLATFORM_VERSION_CODENAME=REL
# PLATFORM_VERSION=9
# TARGET_PRODUCT=aosp_blueline
# TARGET_BUILD_VARIANT=userdebug
# TARGET_BUILD_TYPE=release
# TARGET_ARCH=arm64
# TARGET_ARCH_VARIANT=armv8-2a
# TARGET_CPU_VARIANT=cortex-a75
# TARGET_2ND_ARCH=arm
# TARGET_2ND_ARCH_VARIANT=armv8-a
# TARGET_2ND_CPU_VARIANT=cortex-a75
# HOST_ARCH=x86_64
# HOST_2ND_ARCH=x86
# HOST_OS=linux
# HOST_OS_EXTRA=Linux-3.13.0-158-generic-x86_64-Ubuntu-14.04.5-LTS
# HOST_CROSS_OS=windows
# HOST_CROSS_ARCH=x86
# HOST_CROSS_2ND_ARCH=x86_64
# HOST_BUILD_TYPE=release
# BUILD_ID=PQ3A.190505.002
# OUT_DIR=out
# PRODUCT_SOONG_NAMESPACES=device/google/crosshatch hardware/google/av hardware/google/interfaces hardware/qcom/sdm845 vendor/qcom/sdm845
# ============================================
make -j$(nproc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment