2018-04-26 00:48:41 +08:00
|
|
|
# Copyright 2018 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
#
|
|
|
|
# Defines a docker image that can build sound open firmware
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# check out sof
|
|
|
|
# build docker image:
|
|
|
|
# docker build --build-arg UID=$(id -u) -t sof .
|
2019-01-03 17:09:12 +08:00
|
|
|
# docker run -it -v <insert sof dir here>:/home/sof/workdir --user `id -u` sof
|
2018-04-26 00:48:41 +08:00
|
|
|
#
|
|
|
|
# For incremental builds:
|
2019-01-03 17:09:12 +08:00
|
|
|
# docker run -it -v <insert sof dir here>:/home/sof/work/sof.git --user `id -u` sof ./incremental.sh
|
2018-04-26 00:48:41 +08:00
|
|
|
#
|
|
|
|
|
2021-05-12 04:01:42 +08:00
|
|
|
FROM ubuntu:20.04
|
2018-04-26 00:48:41 +08:00
|
|
|
ARG UID=1000
|
|
|
|
|
2018-06-05 18:43:26 +08:00
|
|
|
ARG host_http_proxy
|
|
|
|
ARG host_https_proxy
|
|
|
|
ENV http_proxy $host_http_proxy
|
|
|
|
ENV https_proxy $host_https_proxy
|
|
|
|
|
2021-05-12 04:01:42 +08:00
|
|
|
# for non-interactive package install
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2018-04-26 00:48:41 +08:00
|
|
|
RUN apt-get -y update && \
|
|
|
|
apt-get install -y \
|
2021-05-12 04:01:42 +08:00
|
|
|
dialog \
|
|
|
|
apt-utils \
|
2021-05-12 02:23:25 +08:00
|
|
|
vim \
|
|
|
|
jed \
|
2021-05-12 02:11:14 +08:00
|
|
|
autoconf \
|
2018-04-26 00:48:41 +08:00
|
|
|
bison \
|
|
|
|
build-essential \
|
2021-03-30 07:06:21 +08:00
|
|
|
python3-pyelftools \
|
2018-04-26 00:48:41 +08:00
|
|
|
flex \
|
|
|
|
gawk \
|
|
|
|
gettext \
|
|
|
|
git \
|
|
|
|
gperf \
|
|
|
|
help2man \
|
|
|
|
libncurses5-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libtool \
|
|
|
|
libtool-bin \
|
|
|
|
pkg-config \
|
|
|
|
software-properties-common \
|
|
|
|
sudo \
|
|
|
|
texinfo \
|
2021-03-12 05:31:16 +08:00
|
|
|
tree \
|
2018-04-26 00:48:41 +08:00
|
|
|
udev \
|
2018-08-07 14:09:59 +08:00
|
|
|
wget \
|
2019-01-16 18:42:18 +08:00
|
|
|
unzip \
|
|
|
|
cmake \
|
2019-07-30 23:37:39 +08:00
|
|
|
python3 \
|
|
|
|
libglib2.0-dev
|
2018-08-07 14:09:59 +08:00
|
|
|
|
2020-04-22 11:58:26 +08:00
|
|
|
ARG CLONE_DEFAULTS="--depth 5"
|
2018-04-26 00:48:41 +08:00
|
|
|
|
2018-06-12 00:01:48 +08:00
|
|
|
# Set up sof user
|
|
|
|
RUN useradd --create-home -d /home/sof -u $UID -G sudo sof && \
|
|
|
|
echo "sof:test0000" | chpasswd && adduser sof sudo
|
2018-04-26 00:48:41 +08:00
|
|
|
ENV HOME /home/sof
|
|
|
|
|
2020-07-23 21:35:34 +08:00
|
|
|
# Use ToT alsa utils for the latest topology patches.
|
2021-05-12 04:01:42 +08:00
|
|
|
# Note: For alsa-lib, set default library directory to /usr/lib/x86_64-linux-gnu.
|
|
|
|
# By default it goes to /usr/lib64, but Ubuntu 20.04's default shared library
|
|
|
|
# path does not have this. Typical build error is like,
|
|
|
|
# alsatplg: error while loading shared libraries: libatopology.so.2: cannot open shared object file: No such file or directory
|
2020-07-23 21:35:34 +08:00
|
|
|
RUN mkdir -p /home/sof/work/alsa && cd /home/sof/work/alsa && \
|
|
|
|
git clone $CLONE_DEFAULTS https://github.com/thesofproject/alsa-lib.git && \
|
|
|
|
git clone $CLONE_DEFAULTS https://github.com/thesofproject/alsa-utils.git && \
|
2021-05-12 04:01:42 +08:00
|
|
|
cd /home/sof/work/alsa/alsa-lib && ./gitcompile --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu/ && make install && \
|
2020-07-23 21:35:34 +08:00
|
|
|
cd /home/sof/work/alsa/alsa-utils && ./gitcompile && make install &&\
|
|
|
|
chown -R sof:sof /home/sof
|
|
|
|
|
2020-04-22 11:58:26 +08:00
|
|
|
ARG GITHUB_SOF=https://github.com/thesofproject
|
|
|
|
ARG XT_OVERLAY_REPO=$GITHUB_SOF/xtensa-overlay.git
|
|
|
|
ARG CT_NG_REPO=$GITHUB_SOF/crosstool-ng.git
|
2018-06-12 00:01:50 +08:00
|
|
|
# build cross compiler
|
2018-04-26 00:48:41 +08:00
|
|
|
USER sof
|
2020-04-22 11:58:26 +08:00
|
|
|
RUN cd /home/sof && \
|
2021-02-16 20:49:11 +08:00
|
|
|
git clone $CLONE_DEFAULTS --branch sof-gcc10.2 $XT_OVERLAY_REPO && \
|
2020-04-22 11:58:26 +08:00
|
|
|
cd xtensa-overlay && cd ../ && \
|
2021-02-16 20:49:11 +08:00
|
|
|
git clone $CLONE_DEFAULTS --branch sof-gcc10x $CT_NG_REPO && \
|
2018-06-12 17:12:39 +08:00
|
|
|
mkdir -p /home/sof/work/ && \
|
2020-04-22 11:58:26 +08:00
|
|
|
cd crosstool-ng && \
|
2018-08-07 14:09:59 +08:00
|
|
|
./bootstrap && ./configure --prefix=`pwd` && make && make install && \
|
2021-08-04 21:23:33 +08:00
|
|
|
for arch in byt hsw apl cnl imx imx8m imx8ulp; do \
|
2021-02-16 20:49:11 +08:00
|
|
|
cp config-${arch}-gcc10.2-gdb9 .config && \
|
2018-08-07 14:09:59 +08:00
|
|
|
# replace the build dist to save space
|
2018-06-12 17:12:39 +08:00
|
|
|
sed -i 's#${CT_TOP_DIR}\/builds#\/home\/sof\/work#g' .config && \
|
2018-08-07 14:09:59 +08:00
|
|
|
# gl_cv_func_getcwd_path_max=yes is used to avoid too-long confdir3/confdir3/...
|
|
|
|
gl_cv_func_getcwd_path_max=yes ./ct-ng build && \
|
2018-06-12 17:12:39 +08:00
|
|
|
./ct-ng distclean ; \
|
2018-06-12 00:01:50 +08:00
|
|
|
done && \
|
2018-08-07 14:09:59 +08:00
|
|
|
cd /home/sof/ && rm -rf xtensa-overlay && rm -rf crosstool-ng
|
2018-04-26 00:48:41 +08:00
|
|
|
|
2018-06-12 00:01:50 +08:00
|
|
|
ENV PATH="/home/sof/work/xtensa-byt-elf/bin:${PATH}"
|
|
|
|
ENV PATH="/home/sof/work/xtensa-hsw-elf/bin:${PATH}"
|
2018-08-07 14:09:59 +08:00
|
|
|
ENV PATH="/home/sof/work/xtensa-apl-elf/bin:${PATH}"
|
2018-06-12 00:01:50 +08:00
|
|
|
ENV PATH="/home/sof/work/xtensa-cnl-elf/bin:${PATH}"
|
2019-05-30 15:34:24 +08:00
|
|
|
ENV PATH="/home/sof/work/xtensa-imx-elf/bin:${PATH}"
|
2020-02-20 22:46:20 +08:00
|
|
|
ENV PATH="/home/sof/work/xtensa-imx8m-elf/bin:${PATH}"
|
2021-08-04 21:23:33 +08:00
|
|
|
ENV PATH="/home/sof/work/xtensa-imx8ulp-elf/bin:${PATH}"
|
2018-04-26 00:48:41 +08:00
|
|
|
|
2020-04-22 11:58:26 +08:00
|
|
|
ARG NEWLIB_REPO=https://github.com/jcmvbkbc/newlib-xtensa.git
|
|
|
|
RUN cd /home/sof && \
|
|
|
|
git clone $CLONE_DEFAULTS --branch xtensa $NEWLIB_REPO && \
|
|
|
|
cd newlib-xtensa && \
|
2021-08-04 21:23:33 +08:00
|
|
|
for arch in byt hsw apl cnl imx imx8m imx8ulp; do \
|
2018-06-12 00:01:50 +08:00
|
|
|
./configure --target=xtensa-${arch}-elf \
|
2018-04-26 00:48:41 +08:00
|
|
|
--prefix=/home/sof/work/xtensa-root && \
|
2018-06-12 00:01:50 +08:00
|
|
|
make && \
|
|
|
|
make install && \
|
2019-05-30 15:32:15 +08:00
|
|
|
rm -rf etc/config.cache; \
|
2018-06-12 00:01:50 +08:00
|
|
|
done && \
|
2018-06-12 17:12:39 +08:00
|
|
|
cd /home/sof/ && rm -rf newlib-xtensa.git
|
2018-04-26 00:48:41 +08:00
|
|
|
|
|
|
|
|
2019-01-03 17:09:12 +08:00
|
|
|
# Create direcroties for the host machines sof directories to be mounted.
|
|
|
|
RUN mkdir -p /home/sof/work/sof.git
|
2018-04-26 00:48:41 +08:00
|
|
|
|
|
|
|
USER sof
|
|
|
|
WORKDIR /home/sof/work/sof.git/
|