Compare commits

..

2 Commits

Author SHA1 Message Date
Mathieu Maret
2a6c558040 Relogin to set some env var
e.g. $USER is not set without that
2015-06-11 10:42:17 +02:00
Mathieu Maret
3aae115d61 Add user to sudo group 2015-06-11 10:42:08 +02:00
8 changed files with 4 additions and 314 deletions

View File

@ -23,15 +23,14 @@ RUN apt-get update && \
lib32readline-gplv2-dev lib32z1-dev libesd0-dev libncurses5-dev \
libsdl1.2-dev libwxgtk2.8-dev libxml2-utils lzop \
oracle-java6-installer oracle-java6-set-default \
genisoimage yasm\
pngcrush schedtool xsltproc zip zlib1g-dev libswitch-perl && \
pngcrush schedtool xsltproc zip zlib1g-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD https://commondatastorage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
# All builds will be done by user aosp
RUN useradd --create-home aosp -s /bin/bash && echo "aosp:aosp" | chpasswd && adduser aosp sudo
RUN useradd --create-home aosp && echo "aosp:aosp" | chpasswd && adduser aosp sudo
ADD gitconfig /home/aosp/.gitconfig
ADD ssh_config /home/aosp/.ssh/config
RUN chown aosp:aosp /home/aosp/.gitconfig
@ -41,7 +40,7 @@ RUN chown aosp:aosp /home/aosp/.gitconfig
VOLUME ["/tmp/ccache", "/aosp"]
# Improve rebuild performance by enabling compiler cache
#ENV USE_CCACHE 1
ENV USE_CCACHE 1
ENV CCACHE_DIR /tmp/ccache
# Work in the build directory, repo is expected to be init'd here
@ -49,4 +48,4 @@ USER aosp
WORKDIR /aosp
#Relogin to set env var such as USER
CMD sudo -E -iu aosp
CMD sudo -i -u aosp

View File

@ -1,44 +0,0 @@
#
# Minimum Docker image to build Android AOSP
#
FROM ubuntu:18.04
ARG USER_ID=1001
ARG GROUP_ID=1001
# Keep the dependency list as short as reasonable
RUN apt-get update && \
apt-get install -y bc bison bsdmainutils build-essential curl \
flex g++-multilib gcc-multilib git gnupg gperf lib32ncurses5-dev \
lib32z1-dev libncurses5-dev \
libsdl1.2-dev libxml2-utils lzop \
openjdk-8-jdk \
genisoimage sudo \
gettext \
python-mako \
rsync \
pngcrush schedtool xsltproc zip zlib1g-dev libswitch-perl git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD https://commondatastorage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
# All builds will be done by user aosp
RUN groupadd -g ${GROUP_ID} aosp && useradd --create-home aosp -u ${USER_ID} -g ${GROUP_ID} -s /bin/bash && echo "aosp:aosp" | chpasswd && adduser aosp sudo
ADD gitconfig /home/aosp/.gitconfig
ADD ssh_config /home/aosp/.ssh/config
RUN chown aosp:aosp /home/aosp/.gitconfig
# The persistent data will be in these two directories, everything else is
# considered to be ephemeral
VOLUME ["/tmp/ccache", "/aosp"]
# Improve rebuild performance by enabling compiler cache
ENV USE_CCACHE 1
ENV CCACHE_DIR /tmp/ccache
# Work in the build directory, repo is expected to be init'd here
USER aosp
WORKDIR /aosp
#Relogin to set env var such as USER
CMD sudo -E -iu aosp

View File

@ -1,47 +0,0 @@
#
# Minimum Docker image to build Android AOSP
#
FROM ubuntu:14.04
MAINTAINER Kyle Manna <kyle@kylemanna.com>
# /bin/sh points to Dash by default, reconfigure to use bash until Android
# build becomes POSIX compliant
RUN echo "dash dash/sh boolean false" | debconf-set-selections && \
dpkg-reconfigure -p critical dash
# Keep the dependency list as short as reasonable
RUN apt-get update && \
apt-get install -y bc bison bsdmainutils build-essential curl \
flex g++-multilib gcc-multilib git gnupg gperf lib32ncurses5-dev \
lib32readline-gplv2-dev lib32z1-dev libesd0-dev libncurses5-dev \
libsdl1.2-dev libwxgtk2.8-dev libxml2-utils lzop \
openjdk-7-jdk \
genisoimage \
gettext python-mako\
pngcrush schedtool xsltproc zip zlib1g-dev libswitch-perl && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD https://commondatastorage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
# All builds will be done by user aosp
RUN useradd --create-home aosp -s /bin/bash && echo "aosp:aosp" | chpasswd && adduser aosp sudo
ADD gitconfig /home/aosp/.gitconfig
ADD ssh_config /home/aosp/.ssh/config
RUN chown aosp:aosp /home/aosp/.gitconfig
# The persistent data will be in these two directories, everything else is
# considered to be ephemeral
#VOLUME ["/tmp/ccache", "/aosp"]
# Improve rebuild performance by enabling compiler cache
#ENV USE_CCACHE 1
ENV CCACHE_DIR /tmp/ccache
# Work in the build directory, repo is expected to be init'd here
USER aosp
WORKDIR /aosp
#Relogin to set env var such as USER
CMD sudo -E -iu aosp

View File

@ -1,41 +0,0 @@
#
# Minimum Docker image to build Android AOSP
#
FROM ubuntu:16.04
# Keep the dependency list as short as reasonable
RUN apt-get update && \
apt-get install -y bc bison bsdmainutils build-essential curl \
flex g++-multilib gcc-multilib git gnupg gperf lib32ncurses5-dev \
lib32z1-dev libesd0-dev libncurses5-dev \
libsdl1.2-dev libxml2-utils lzop \
openjdk-8-jdk \
genisoimage sudo \
gettext \
python-mako \
pngcrush schedtool xsltproc zip zlib1g-dev libswitch-perl && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD https://commondatastorage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
# All builds will be done by user aosp
RUN useradd --create-home aosp -s /bin/bash && echo "aosp:aosp" | chpasswd && adduser aosp sudo
ADD gitconfig /home/aosp/.gitconfig
ADD ssh_config /home/aosp/.ssh/config
RUN chown aosp:aosp /home/aosp/.gitconfig
# The persistent data will be in these two directories, everything else is
# considered to be ephemeral
#VOLUME ["/tmp/ccache", "/aosp"]
# Improve rebuild performance by enabling compiler cache
#ENV USE_CCACHE 1
ENV CCACHE_DIR /tmp/ccache
# Work in the build directory, repo is expected to be init'd here
USER aosp
WORKDIR /aosp
#Relogin to set env var such as USER
CMD sudo -E -iu aosp

View File

@ -1,64 +0,0 @@
#
# Minimum Docker image to build Android AOSP
#
FROM ubuntu:16.04
ARG USER_ID=1001
ARG GROUP_ID=1001
# Keep the dependency list as short as reasonable
# Need vim-common for stuff like xxd need by BS
RUN apt-get update && \
apt-get install -y bc bison bsdmainutils build-essential curl \
flex g++-multilib gcc-multilib git gnupg gperf lib32ncurses5-dev \
lib32z1-dev libncurses5-dev \
libsdl1.2-dev libxml2-utils lzop \
openjdk-8-jdk \
genisoimage sudo \
gettext \
python-mako \
rsync \
libssl-dev \
cpio \
vim-common \
pngcrush schedtool xsltproc zip zlib1g-dev libswitch-perl git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev libc6-dev-i386 libncurses5-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig tofrodos python-markdown uuid-dev samba system-config-samba xmlstarlet libxml-simple-perl && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#ADD https://commondatastorage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
ADD https://source.codeaurora.org/quic/la/tools/repo/plain/repo?h=caf-stable /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
# All builds will be done by user aosp
RUN groupadd -g ${GROUP_ID} aosp && useradd --create-home aosp -u ${USER_ID} -g ${GROUP_ID} -s /bin/bash && echo "aosp:aosp" | chpasswd && adduser aosp sudo
RUN adduser aosp dialout && adduser aosp plugdev
#ADD gitconfig /home/aosp/.gitconfig
RUN sudo -u aosp -H git config --global user.name "AOSP Docker"
RUN sudo -u aosp -H git config --global user.email "aosp@docker.local"
RUN sudo -u aosp -H git config --global color.ui auto
RUN sudo -u aosp -H git config --global http.'https://chipmaster2.qti.qualcomm.com'.followRedirects "true"
ADD ssh_config /home/aosp/.ssh/config
RUN chown aosp:aosp /home/aosp/.gitconfig
# No Dash
RUN sudo rm /bin/sh && sudo ln -s /bin/bash /bin/sh
# Using an old python version -> need specific pip
curl -fsSL -o- https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3.5
#Init gpg key for repo
RUN sudo -u aosp -H mkdir -p ~aosp/.repoconfig/gnupg
RUN sudo -u aosp -H GNUPGHOME=~/.repoconfig/gnupg gpg --keyserver keyserver.ubuntu.com --recv-key 67B7E448692B382C
# The persistent data will be in these two directories, everything else is
# considered to be ephemeral
VOLUME ["/tmp/ccache", "/aosp"]
# Improve rebuild performance by enabling compiler cache
# Not supported by AOSP anymore
ENV USE_CCACHE 1
ENV CCACHE_DIR /tmp/ccache
# Work in the build directory, repo is expected to be init'd here
USER aosp
WORKDIR /aosp
#Relogin to set env var such as USER
CMD sudo -E -iu aosp

View File

@ -23,16 +23,6 @@ For *Mac OS X* and *Windows* users, consider
[kylemanna/vagrant-aosp](https://github.com/kylemanna/vagrant-aosp) as a good
virtual machine to enable development.
Build Dockers
-------------
* For Nougat
`docker build -t nougat -f Dockerfile_7.0 .`
* For Marshmallow and Lollipop
`docker build -t lollipop -f Dockerfile_5.0-6.0 .`
* For kitkat
`docker build -t kitkat -f Dockerfile_kitkat .`
Quickstart
----------

48
sdocker
View File

@ -1,48 +0,0 @@
sdocker (){
DOCKER_SSH_AUTH=$HOME/docker_ssh_auth
AOSP_IMAGE=${AOSP_IMAGE:-$HOME/Project}
if [ $# -eq 0 ]; then
echo "Usage: $0 DOCKER_IMAGE_NAME"
return
fi
if [ -n "$SSH_AUTH_SOCK" ]; then
$(ls -l $HOME/docker_ssh_auth 2> /dev/null | grep $SSH_AUTH_SOCK > /dev/null)
if [ $? ];
then
unlink $DOCKER_SSH_AUTH > /dev/null
ln -s $SSH_AUTH_SOCK $DOCKER_SSH_AUTH
fi
SSH_AUTH_ARGS="-v $DOCKER_SSH_AUTH:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
fi
AOSP_ARGS=${AOSP_ARGS:--it}
img=$(docker ps | grep $1 | awk '{print $1}');
if [ -z $img ]; then
img=$(docker ps -a | grep $1 | awk '{print $1}' | head -1);
if [ -z $img ]; then
echo "Running a new container"
# Instead of using --privileged for accessing a device you can use --device-cgroup-rule
# For giving access to /dev/ttyS0
# ls -la /dev/ttyS0
# crw-rw---- 1 root uucp 4, 64 12 mars 22:53 /dev/ttyS0 # Char dev with major number 4. Check /proc/devices for more device
# use --device-cgroup-rule='c 4:* rmw' with r: read, m: mknod, w: write. and bind -v /dev:/dev
docker run ${AOSP_ARGS} ${=SSH_AUTH_ARGS} -h $(hostname) -e DISPLAY=${DISPLAY} --privileged -v /dev/bus/usb:/dev/bus/usb -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v ${AOSP_IMAGE}:/aosp/Project -v $HOME/Sources/:/aosp/Sources/ --user="$(id -u):$(id -g)" $1
else
echo "Starting $img"
docker start -i -a $img
fi
else
echo "Attach to $img"
eval docker exec ${DOCKER_EXEC_ARGS} -it $img /bin/bash
fi
}
_sdocker () {
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "$(docker images | tail -n +2 | grep -v "<none>" | awk '{print $1}')" -- ${cur} ) )
}
complete -o default -F _sdocker sdocker
complete -o default -F _sdocker sudocker

View File

@ -1,55 +0,0 @@
#!/bin/bash
#
# Test script file that maps itself into a docker container and runs
#
# Example invocation:
#
# $ AOSP_VOL=$PWD/build ./build-lollipop.sh
#
set -ex
if [ "$1" = "docker" ]; then
TEST_BRANCH=${TEST_BRANCH:-android-5.0.2_r1}
TEST_URL=${TEST_URL:-https://android.googlesource.com/platform/manifest}
cpus=$(grep ^processor /proc/cpuinfo | wc -l)
repo init --depth 1 -u "$TEST_URL" -b "$TEST_BRANCH"
# Use default sync '-j' value embedded in manifest file to be polite
repo sync
prebuilts/misc/linux-x86/ccache/ccache -M 10G
source build/envsetup.sh
lunch aosp_arm-eng
make -j $cpus
else
aosp_url="https://raw.githubusercontent.com/kylemanna/docker-aosp/master/utils/aosp"
args="bash run.sh docker"
export AOSP_EXTRA_ARGS="-v $(cd $(dirname $0) && pwd -P)/$(basename $0):/usr/local/bin/run.sh:ro"
export AOSP_IMAGE="kylemanna/aosp:5.0-lollipop"
#
# Try to invoke the aosp wrapper with the following priority:
#
# 1. If AOSP_BIN is set, use that
# 2. If aosp is found in the shell $PATH
# 3. Grab it from the web
#
if [ -n "$AOSP_BIN" ]; then
$AOSP_BIN $args
elif [ -x "../utils/aosp" ]; then
../utils/aosp $args
elif [ -n "$(type -P aosp)" ]; then
aosp $args
else
if [ -n "$(type -P curl)" ]; then
bash <(curl -s $aosp_url) $args
elif [ -n "$(type -P wget)" ]; then
bash <(wget -q $aosp_url -O -) $args
else
echo "Unable to run the aosp binary"
fi
fi
fi