Compare commits

..

1 Commits

Author SHA1 Message Date
Mathieu Maret f232a32c7f Relogin to set some env var
e.g. $USER is not set without that
2015-06-29 18:46:05 +02:00
7 changed files with 5 additions and 266 deletions

View File

@ -17,26 +17,24 @@ RUN apt-get update && \
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 && \
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
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"]
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
@ -44,4 +42,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,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,52 +0,0 @@
#
# Minimum Docker image to build Android AOSP
#
FROM ubuntu:14.04
MAINTAINER Kyle Manna <kyle@kylemanna.com>
# Setup for Java
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" \
>> /etc/apt/sources.list.d/webupd8.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
echo oracle-java6-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
# /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 \
oracle-java6-installer oracle-java6-set-default \
genisoimage yasm\
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