Sign inSign up

andreascian/aosp

By andreascian

Updated about 8 years ago

Android Open Source Project build container

Image
0

94

andreascian/aosp repository overview

You'll need the AOSP script taken from https://github.com/kylemanna/docker-aosp

#!/bin/bash
#
# Simple AOSP wrapper to run commands in an AOSP docker container
#
# Author: Kyle Manna <[email protected]>
#

set -e

# Override from environment

AOSP_IMAGE=${AOSP_IMAGE:-kylemanna/aosp}
AOSP_ARGS=${AOSP_ARGS:---rm -it}

AOSP_VOL=${AOSP_VOL:-~/aosp-root}
AOSP_VOL=${AOSP_VOL%/} # Trim trailing slash if needed
AOSP_VOL_AOSP=${AOSP_VOL_AOSP:-$AOSP_VOL/aosp}
AOSP_VOL_AOSP=${AOSP_VOL_AOSP%/} # Trim trailing slash if needed
AOSP_VOL_CCACHE=${AOSP_VOL_CCACHE:-$AOSP_VOL/ccache}
AOSP_VOL_CCACHE=${AOSP_VOL_CCACHE%/} # Trim trailing slash if needed

# Convenience function
function aosp_create_dir_if_needed {
  directory=$1
  msg="aosp: Checking if $directory exists"
  echo "$msg"
  if [ ! -d "$directory" ]; then
    echo "$msg - unexistent"
    msg="Creating $directory"
    echo "$msg"
    mkdir -p $directory
  fi
  echo "$msg - ok"
}

# Create AOSP_VOL_AOSP
aosp_create_dir_if_needed $AOSP_VOL_AOSP
aosp_create_dir_if_needed $AOSP_VOL_CCACHE

uid=$(id -u)

# Set uid and gid to match host current user as long as NOT root
if [ $uid -ne "0" ]; then
    AOSP_HOST_ID_ARGS="-e USER_ID=$uid -e GROUP_ID=$(id -g)"
fi

if [ -n "$SSH_AUTH_SOCK" ]; then
    SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
fi

echo ""

docker run $AOSP_ARGS $AOSP_HOST_ID_ARGS $SSH_AUTH_ARGS $AOSP_EXTRA_ARGS \
    -v "$AOSP_VOL_AOSP:/aosp" -v "$AOSP_VOL_CCACHE:/tmp/ccache" \
    $AOSP_IMAGE $@

Configure the environment as

export AOSP_IMAGE=andreascian/aosp:m6.2
export AOSP_MIRROR=/opt/aosp/mirror
export AOSP_VOL=/opt/aosp/m6-test/
export AOSP_VOL_AOSP=${AOSP_VOL}/aosp

and then run aosp command to jump into the container (where you can run repo init/sync and lunch/make as you should already know)

Tag summary

Content type

Image

Digest

Size

315 MB

Last updated

about 8 years ago

docker pull andreascian/aosp:m6.2