Compare commits

...

25 Commits

Author SHA1 Message Date
Mathieu Maret d6b80c2bb4 sdocker: usb access 2022-03-12 23:14:00 +01:00
Mathieu Maret da9cb958ab qcom: add missing deps and pip 2021-12-22 11:58:12 +01:00
Mathieu Maret 418affb7bf docker qcom add cpio 2021-10-07 14:40:11 +02:00
Mathieu Maret 5edfbbed11 docker qcom: add libssl-dev 2021-10-01 11:55:53 +02:00
Mathieu Maret 7636918539 qcom based on 16.04 2021-09-30 15:25:42 +02:00
Mathieu Maret a119cac4f0 Add docker for qcom env 2021-09-28 16:47:44 +02:00
Mathieu Maret f1711c8688 Add rsync 2021-09-15 11:55:47 +02:00
Mathieu Maret f87cb74fe6 Add docker for 18.04 ubuntu 2021-09-14 15:30:40 +02:00
Mathieu Maret 94fdbf6d66 keep env avec using sudo 2017-01-19 14:45:50 +01:00
Mathieu Maret e7b9c77d4a Update documentation 2017-01-19 11:52:46 +01:00
Mathieu Maret c2370f2ce8 [kk] build is 64bits 2017-01-19 11:52:34 +01:00
Mathieu Maret 966f5dfe3d Add dep to build mesa 2017-01-19 11:52:15 +01:00
Mathieu Maret bafd85a5aa Add docker for nougat 2016-11-04 15:56:57 +01:00
Mathieu Maret 6723b54c4b Set shell to bash 2016-08-23 15:31:46 +02:00
Mathieu Maret c0c141797e Add Dockerfile for kitkat 2016-03-03 11:27:03 +01:00
Mathieu Maret 7b2de396f8 Add genisoimage and libswitch-perl 2016-03-03 11:25:51 +01:00
Mathieu Maret 3067dc2cc3 [sdocker] Check nb of args 2015-07-03 14:10:51 +02:00
Mathieu Maret 5e9139f820 Add sdocker command 2015-06-30 16:54:16 +02:00
Mathieu Maret 2a91d8c636 Disable CCACHE 2015-06-29 18:45:05 +02:00
Mathieu Maret ed22ff7582 Relogin to set some env var
e.g. $USER is not set without that
2015-06-11 10:39:48 +02:00
Mathieu Maret 76c79ee5ae Add user to sudo group 2015-06-11 10:39:30 +02:00
Kyle Manna f2cb2e7428 tests: Update script to call bash for lollipop
* Call bash to avoid issue where user didn't `chmod +x` the script.
* Error without chmod:

        exec: "run.sh": executable file not found in $PATH
2015-04-22 10:16:20 -07:00
Kyle Manna bf49b4a69c Merge branch '4.4-kitkat' into 5.0-lollipop 2015-04-22 10:16:00 -07:00
Kyle Manna a4a775650c test: lollipop: Add initial script
* Create a lollipop test script.
2015-03-02 21:17:13 -08:00
Kyle Manna 08e85058e1 lollipop: Update to use OpenJDK 7
* Upstream uses OpenJDK 7, no more Oracle Java!
2015-03-02 14:47:04 -08:00
8 changed files with 316 additions and 3 deletions

44
Dockerfile_18.04 Normal file
View File

@ -0,0 +1,44 @@
#
# 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

47
Dockerfile_5.0-6.0 Normal file
View File

@ -0,0 +1,47 @@
#
# 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

41
Dockerfile_7.0 Normal file
View File

@ -0,0 +1,41 @@
#
# 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

@ -23,14 +23,15 @@ 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 \
pngcrush schedtool xsltproc zip zlib1g-dev && \
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
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
@ -40,9 +41,12 @@ 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
USER aosp
WORKDIR /aosp
#Relogin to set env var such as USER
CMD sudo -E -iu aosp

64
Dockerfile_qcom Normal file
View File

@ -0,0 +1,64 @@
#
# 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,6 +23,16 @@ 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 Normal file
View File

@ -0,0 +1,48 @@
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

55
tests/build-lollipop.sh Executable file
View File

@ -0,0 +1,55 @@
#!/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