diff --git a/scripts/docker-qemu.sh b/scripts/docker-qemu.sh new file mode 100755 index 000000000..372062eb1 --- /dev/null +++ b/scripts/docker-qemu.sh @@ -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 $@ diff --git a/scripts/docker_build/sof_qemu/Dockerfile b/scripts/docker_build/sof_qemu/Dockerfile new file mode 100644 index 000000000..1a92b5eb5 --- /dev/null +++ b/scripts/docker_build/sof_qemu/Dockerfile @@ -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/ diff --git a/scripts/docker_build/sof_qemu/docker-build.sh b/scripts/docker_build/sof_qemu/docker-build.sh new file mode 100755 index 000000000..63174bd83 --- /dev/null +++ b/scripts/docker_build/sof_qemu/docker-build.sh @@ -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 .