Skip to content

Commit b3c64f4

Browse files
committed
scripts: docker: add qmeu docker
Add a docker contains sof xtensa qemu Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
1 parent 779d6bc commit b3c64f4

3 files changed

Lines changed: 77 additions & 0 deletions

File tree

scripts/docker-qemu.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# Runs a given script in the docker container you can generate from the
4+
# docker_build directory.
5+
# Example:
6+
# To build sof for baytrail:
7+
# ./scripts/docker-run.sh ./scripts/xtensa-build-all.sh byt
8+
# To build topology:
9+
# ./scripts/docker-run.sh ./scripts/build_soft.sh
10+
11+
docker run -it --privileged -v `pwd`:/home/sof/sof.git \
12+
-v `pwd`/../soft.git:/home/sof/soft.git \
13+
--user `id -u` sofqemu $@
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
15+
FROM ubuntu:18.04
16+
ARG UID=1000
17+
18+
# Set up proxy from host
19+
COPY apt.conf /etc/apt/
20+
ARG host_http_proxy
21+
ARG host_https_proxy
22+
ENV http_proxy $host_http_proxy
23+
ENV https_proxy $host_https_proxy
24+
25+
RUN apt-get -y update && \
26+
apt-get install -y \
27+
autoconf \
28+
build-essential \
29+
git \
30+
python \
31+
zlib1g-dev \
32+
libglib2.0-dev \
33+
libpixman-1-dev \
34+
pkg-config \
35+
sudo
36+
37+
38+
# Set up sof user
39+
RUN useradd --create-home -d /home/sof -u $UID -G sudo sof && \
40+
echo "sof:test0000" | chpasswd && adduser sof sudo
41+
ENV HOME /home/sof
42+
43+
# build qemu
44+
USER sof
45+
RUN cd /home/sof && git clone https://github.com/thesofproject/qemu.git && \
46+
cd qemu && git checkout sof-stable && \
47+
# replace the submodule git repo to github mirror
48+
sed -i 's#git://git.qemu.org#https://github.com/qemu#g' .gitmodules && \
49+
sed -i 's#git://git.qemu-project.org#https://github.com/qemu#g' .gitmodules && \
50+
./configure --prefix=`pwd`/ --target-list=xtensa-softmmu --enable-coroutine-pool && \
51+
make
52+
53+
# Create direcroties for the host machines sof/soft directories to be mounted.
54+
RUN mkdir -p /home/sof/sof.git && \
55+
mkdir -p /home/sof/soft.git
56+
57+
WORKDIR /home/sof/qemu/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
if [ -f "/etc/apt/apt.conf" ]; then
3+
cp /etc/apt/apt.conf ./
4+
else
5+
touch apt.conf
6+
fi
7+
docker build --build-arg UID=$(id -u) --build-arg host_http_proxy=$http_proxy --build-arg host_https_proxy=$https_proxy -t sofqemu .

0 commit comments

Comments
 (0)