scripts: docker: add qmeu docker

Add a docker contains sof xtensa qemu

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
This commit is contained in:
Pan Xiuli 2018-10-12 13:19:48 +08:00
parent 779d6bce35
commit b3c64f499a
3 changed files with 77 additions and 0 deletions

13
scripts/docker-qemu.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Runs a given script in the docker container you can generate from the
# docker_build directory.
# Example:
# To build sof for baytrail:
# ./scripts/docker-run.sh ./scripts/xtensa-build-all.sh byt
# To build topology:
# ./scripts/docker-run.sh ./scripts/build_soft.sh
docker run -it --privileged -v `pwd`:/home/sof/sof.git \
-v `pwd`/../soft.git:/home/sof/soft.git \
--user `id -u` sofqemu $@

View File

@ -0,0 +1,57 @@
#
# Defines a docker image that can run Xtensa Qemu
#
# Usage:
# check out sof
# build docker image:
# cd scripts/docker_build/sof_qemu
# ./docker-build.sh
#
# run docker image:
# in sof repo
# ./scripts/docker-qemu.sh scrpits-or-command-you-want-run
#
FROM ubuntu:18.04
ARG UID=1000
# Set up proxy from host
COPY apt.conf /etc/apt/
ARG host_http_proxy
ARG host_https_proxy
ENV http_proxy $host_http_proxy
ENV https_proxy $host_https_proxy
RUN apt-get -y update && \
apt-get install -y \
autoconf \
build-essential \
git \
python \
zlib1g-dev \
libglib2.0-dev \
libpixman-1-dev \
pkg-config \
sudo
# Set up sof user
RUN useradd --create-home -d /home/sof -u $UID -G sudo sof && \
echo "sof:test0000" | chpasswd && adduser sof sudo
ENV HOME /home/sof
# build qemu
USER sof
RUN cd /home/sof && git clone https://github.com/thesofproject/qemu.git && \
cd qemu && git checkout sof-stable && \
# replace the submodule git repo to github mirror
sed -i 's#git://git.qemu.org#https://github.com/qemu#g' .gitmodules && \
sed -i 's#git://git.qemu-project.org#https://github.com/qemu#g' .gitmodules && \
./configure --prefix=`pwd`/ --target-list=xtensa-softmmu --enable-coroutine-pool && \
make
# Create direcroties for the host machines sof/soft directories to be mounted.
RUN mkdir -p /home/sof/sof.git && \
mkdir -p /home/sof/soft.git
WORKDIR /home/sof/qemu/

View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ -f "/etc/apt/apt.conf" ]; then
cp /etc/apt/apt.conf ./
else
touch apt.conf
fi
docker build --build-arg UID=$(id -u) --build-arg host_http_proxy=$http_proxy --build-arg host_https_proxy=$https_proxy -t sofqemu .