1#
2# Defines a docker image that can run Xtensa Qemu
3#
4# Usage:
5# check out sof
6# build docker image:
7# cd scripts/docker_build/sof_qemu
8# ./docker-build.sh
9#
10# run docker image:
11# in sof repo
12# ./scripts/docker-qemu.sh scrpits-or-command-you-want-run
13#
14
15FROM ubuntu:20.04
16ARG UID=1000
17
18ARG host_http_proxy
19ARG host_https_proxy
20ENV http_proxy $host_http_proxy
21ENV https_proxy $host_https_proxy
22
23# for non-interactive package install
24ARG DEBIAN_FRONTEND=noninteractive
25
26RUN apt-get -y update && \
27	    apt-get install -y \
28		vim \
29		jed \
30		dialog \
31		apt-utils \
32		autoconf \
33		build-essential \
34		git \
35		python \
36		zlib1g-dev \
37		libglib2.0-dev \
38		libpixman-1-dev \
39		pkg-config \
40		sudo \
41		bsdmainutils
42
43# Set up sof user
44RUN useradd --create-home -d /home/sof -u $UID -G sudo sof && \
45echo "sof:test0000" | chpasswd && adduser sof sudo
46ENV HOME /home/sof
47
48ARG GITHUB_SOF=https://github.com/thesofproject
49ARG SOF_REPO=$GITHUB_SOF/qemu.git
50ARG CLONE_DEFAULTS="--depth 5"
51# build qemu
52USER sof
53RUN cd /home/sof && git clone $CLONE_DEFAULTS --branch sof-v4.2 $SOF_REPO && \
54	cd qemu && \
55# replace the submodule git repo to github mirror
56	sed -i 's#git://git.qemu.org#https://github.com/qemu#g' .gitmodules && \
57	sed -i 's#git://git.qemu-project.org#https://github.com/qemu#g' .gitmodules && \
58	./configure --prefix=`pwd`/ --target-list=xtensa-softmmu --enable-coroutine-pool && \
59	make
60
61# Create direcroties for the host machines sof directories to be mounted.
62RUN mkdir -p /home/sof/sof.git
63
64WORKDIR /home/sof/qemu/
65