[Sound-open-firmware] [PATCH V2 1/2] scripts: docker: Add proxy settings
From: Pan Xiuli xiuli.pan@linux.intel.com
Modify Dockerfile to copy apt.conf from host and set host proxy to environment. Also modify some git url to http url in order to use the proxy.
Also add a docker-build.sh to help docker build
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com --- V2: Add selection to use git url when no proxy is used --- scripts/README.docker | 3 ++- scripts/docker_build/Dockerfile | 23 ++++++++++++++++++----- scripts/docker_build/docker-build.sh | 7 +++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100755 scripts/docker_build/docker-build.sh
diff --git a/scripts/README.docker b/scripts/README.docker index 82558b1..e2f189f 100644 --- a/scripts/README.docker +++ b/scripts/README.docker @@ -16,7 +16,8 @@ First, build the docker container. This step needs to be done initially and when the toolchain or alsa dependencies are updated.
cd scripts/docker_build -docker build --build-arg UID=$(id -u) -t sof . + +./docker-build.sh
After the container is built, it can be used to run the scripts.
diff --git a/scripts/docker_build/Dockerfile b/scripts/docker_build/Dockerfile index 7ee0a45..8dede3c 100644 --- a/scripts/docker_build/Dockerfile +++ b/scripts/docker_build/Dockerfile @@ -17,6 +17,13 @@ FROM ubuntu:16.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 \ @@ -49,11 +56,17 @@ RUN apt-get clean RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
# Use ToT alsa utils for the latest topology patches. -RUN mkdir -p /root/alsa-build -RUN cd /root/alsa-build && git clone git://git.alsa-project.org/alsa-lib.git -RUN cd /root/alsa-build && git clone git://git.alsa-project.org/alsa-utils.git -RUN cd /root/alsa-build/alsa-lib && ./gitcompile && make install -RUN cd /root/alsa-build/alsa-utils && ./gitcompile && make install +RUN mkdir -p /root/alsa-build && cd /root/alsa-build && \ + if [ "x$http_proxy" = "x" ]; then \ + git clone git://git.alsa-project.org/alsa-lib.git && \ + git clone git://git.alsa-project.org/alsa-utils.git ; \ + else \ + git clone http://git.alsa-project.org/http/alsa-lib.git && \ + git clone http://git.alsa-project.org/http/alsa-utils.git; \ + fi && \ +cd /root/alsa-build/alsa-lib && ./gitcompile && make install && \ +cd /root/alsa-build/alsa-utils && ./gitcompile && make install && \ +cd /root/ && rm -rf alsa-build
RUN useradd --create-home -d /home/sof -u $UID -G sudo sof RUN echo "sof:test0000" | chpasswd diff --git a/scripts/docker_build/docker-build.sh b/scripts/docker_build/docker-build.sh new file mode 100755 index 0000000..1090f15 --- /dev/null +++ b/scripts/docker_build/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 sof .
From: Pan Xiuli xiuli.pan@linux.intel.com
Use Ubuntu 18.04 as base, gcc-7 is the default version.
SOFT is no longer needed to be installed on host builder machine. rimage build is included in the build all scripts. No longer build the rimage for the first time.
Remove some unused folder.
Merge some build command to reduce docker image size. Set the docker user sudo need no passwd.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com --- V2: Remove some duplicate apt install object Add some new functions --- scripts/docker_build/Dockerfile | 99 +++++++++++++---------------------------- 1 file changed, 32 insertions(+), 67 deletions(-)
diff --git a/scripts/docker_build/Dockerfile b/scripts/docker_build/Dockerfile index 8dede3c..66338cc 100644 --- a/scripts/docker_build/Dockerfile +++ b/scripts/docker_build/Dockerfile @@ -14,7 +14,7 @@ # docker run -it -v <insert sof dir here>:/home/sof/work/sof.git -v <soft git dir>:/home/sof/work/soft.git --user `id -u` sof ./incremental.sh #
-FROM ubuntu:16.04 +FROM ubuntu:18.04 ARG UID=1000
# Set up proxy from host @@ -36,10 +36,8 @@ RUN apt-get -y update && \ gperf \ help2man \ libncurses5-dev \ - libncurses5-dev \ libssl-dev \ libtool \ - libtool \ libtool-bin \ pkg-config \ software-properties-common \ @@ -48,13 +46,6 @@ RUN apt-get -y update && \ udev \ wget
-# Use gcc/g++ 7. -RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y -RUN apt-get -y update -RUN apt-get install -y gcc-7 g++-7 -RUN apt-get clean -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 - # Use ToT alsa utils for the latest topology patches. RUN mkdir -p /root/alsa-build && cd /root/alsa-build && \ if [ "x$http_proxy" = "x" ]; then \ @@ -68,71 +59,45 @@ cd /root/alsa-build/alsa-lib && ./gitcompile && make install && \ cd /root/alsa-build/alsa-utils && ./gitcompile && make install && \ cd /root/ && rm -rf alsa-build
-RUN useradd --create-home -d /home/sof -u $UID -G sudo sof -RUN echo "sof:test0000" | chpasswd -RUN adduser sof sudo +# Set up sof user +RUN useradd --create-home -d /home/sof -u $UID -G sudo sof && \ +echo "sof:test0000" | chpasswd && adduser sof sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ENV HOME /home/sof
-# pull all sof repositories that are needed -USER sof -RUN git clone git://git.alsa-project.org/sound-open-firmware.git /home/sof/sof.git -RUN git clone git://git.alsa-project.org/sound-open-firmware-tools.git /home/sof/soft.git -RUN git clone https://github.com/01org/osadsp-crosstool-ng.git /home/sof/ct-ng.git -RUN git clone https://github.com/jcmvbkbc/newlib-xtensa.git /home/sof/newlib-xtensa.git - -USER sof -RUN mkdir -p /home/sof/bin -WORKDIR /home/sof/soft.git -RUN ./autogen.sh -RUN ./configure --prefix=/home/sof/bin -RUN make -RUN make install - -ENV PATH="/home/sof/bin/bin:${PATH}" - +# build cross compiler USER sof -WORKDIR /home/sof/ct-ng.git -RUN for arch in byt hsw bxt cnl; do \ - ./bootstrap && \ - ./configure --prefix=`pwd` && \ - make && \ - make install && \ - ./ct-ng xtensa-${arch}-elf && \ - ./ct-ng build && \ - make distclean; \ -done - -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-byt-elf/bin:${PATH}" -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-hsw-elf/bin:${PATH}" -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-bxt-elf/bin:${PATH}" -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-cnl-elf/bin:${PATH}"
-USER sof -WORKDIR /home/sof/newlib-xtensa.git -RUN git checkout -b xtensa origin/xtensa -RUN for arch in byt hsw bxt cnl; do \ - ./configure --target=xtensa-${arch}-elf \ +RUN cd /home/sof && git clone https://github.com/01org/osadsp-crosstool-ng.git /home/sof/ct-ng.git && \ +cd ct-ng.git && ./bootstrap && ./configure --prefix=`pwd` && \ + make && make install && \ + for arch in byt hsw bxt cnl; do \ + ./ct-ng xtensa-${arch}-elf && \ + ./ct-ng build ; \ + done && \ + mkdir -p /home/sof/work/ && \ + cp -r builds/xtensa-*-elf /home/sof/work/ && cd /home/sof/ && sudo rm -rf ct-ng.git + +ENV PATH="/home/sof/work/xtensa-byt-elf/bin:${PATH}" +ENV PATH="/home/sof/work/xtensa-hsw-elf/bin:${PATH}" +ENV PATH="/home/sof/work/xtensa-bxt-elf/bin:${PATH}" +ENV PATH="/home/sof/work/xtensa-cnl-elf/bin:${PATH}" + +RUN cd /home/sof && git clone https://github.com/jcmvbkbc/newlib-xtensa.git newlib-xtensa.git && \ + cd newlib-xtensa.git && git checkout -b xtensa origin/xtensa && \ + for arch in byt hsw bxt cnl; do \ + ./configure --target=xtensa-${arch}-elf \ --prefix=/home/sof/work/xtensa-root && \ - make && \ - make install && \ - make distclean; \ -done + make && \ + make install && \ + make distclean; \ + done && \ + cd /home/sof/ && sudo rm -rf newlib-xtensa.git
-USER sof -WORKDIR /home/sof/sof.git -RUN ./autogen.sh -RUN ./configure --enable-rimage -RUN make -USER root -RUN make install
# Create direcroties for the host machines sof/soft directories to be mounted. -USER sof -RUN mkdir -p /home/sof/work/sof -RUN mkdir -p /home/sof/work/soft +RUN mkdir -p /home/sof/work/sof.git && \ + mkdir -p /home/sof/work/soft.git +
USER sof WORKDIR /home/sof/work/sof.git/ - -# Default to building all. -CMD ./scripts/xtensa-build-all.sh
On 6/5/2018 18:43, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Use Ubuntu 18.04 as base, gcc-7 is the default version.
SOFT is no longer needed to be installed on host builder machine. rimage build is included in the build all scripts. No longer build the rimage for the first time.
Remove some unused folder.
Merge some build command to reduce docker image size.
docker image size reduce to 500MB+ with this patch set.
Set the docker user sudo need no passwd.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
V2: Remove some duplicate apt install object Add some new functions
scripts/docker_build/Dockerfile | 99 +++++++++++++---------------------------- 1 file changed, 32 insertions(+), 67 deletions(-)
diff --git a/scripts/docker_build/Dockerfile b/scripts/docker_build/Dockerfile index 8dede3c..66338cc 100644 --- a/scripts/docker_build/Dockerfile +++ b/scripts/docker_build/Dockerfile @@ -14,7 +14,7 @@ # docker run -it -v <insert sof dir here>:/home/sof/work/sof.git -v <soft git dir>:/home/sof/work/soft.git --user `id -u` sof ./incremental.sh #
-FROM ubuntu:16.04 +FROM ubuntu:18.04 ARG UID=1000
# Set up proxy from host @@ -36,10 +36,8 @@ RUN apt-get -y update && \ gperf \ help2man \ libncurses5-dev \
libssl-dev \ libtool \libncurses5-dev \
libtool-bin \ pkg-config \ software-properties-common \libtool \
@@ -48,13 +46,6 @@ RUN apt-get -y update && \ udev \ wget
-# Use gcc/g++ 7. -RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y -RUN apt-get -y update -RUN apt-get install -y gcc-7 g++-7 -RUN apt-get clean -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
- # Use ToT alsa utils for the latest topology patches. RUN mkdir -p /root/alsa-build && cd /root/alsa-build && \ if [ "x$http_proxy" = "x" ]; then \
@@ -68,71 +59,45 @@ cd /root/alsa-build/alsa-lib && ./gitcompile && make install && \ cd /root/alsa-build/alsa-utils && ./gitcompile && make install && \ cd /root/ && rm -rf alsa-build
-RUN useradd --create-home -d /home/sof -u $UID -G sudo sof -RUN echo "sof:test0000" | chpasswd -RUN adduser sof sudo +# Set up sof user +RUN useradd --create-home -d /home/sof -u $UID -G sudo sof && \ +echo "sof:test0000" | chpasswd && adduser sof sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ENV HOME /home/sof
-# pull all sof repositories that are needed -USER sof -RUN git clone git://git.alsa-project.org/sound-open-firmware.git /home/sof/sof.git -RUN git clone git://git.alsa-project.org/sound-open-firmware-tools.git /home/sof/soft.git -RUN git clone https://github.com/01org/osadsp-crosstool-ng.git /home/sof/ct-ng.git -RUN git clone https://github.com/jcmvbkbc/newlib-xtensa.git /home/sof/newlib-xtensa.git
-USER sof -RUN mkdir -p /home/sof/bin -WORKDIR /home/sof/soft.git -RUN ./autogen.sh -RUN ./configure --prefix=/home/sof/bin -RUN make -RUN make install
-ENV PATH="/home/sof/bin/bin:${PATH}"
+# build cross compiler USER sof -WORKDIR /home/sof/ct-ng.git -RUN for arch in byt hsw bxt cnl; do \
- ./bootstrap && \
- ./configure --prefix=`pwd` && \
- make && \
- make install && \
- ./ct-ng xtensa-${arch}-elf && \
- ./ct-ng build && \
- make distclean; \
-done
-ENV PATH="/home/sof/ct-ng.git/builds/xtensa-byt-elf/bin:${PATH}" -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-hsw-elf/bin:${PATH}" -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-bxt-elf/bin:${PATH}" -ENV PATH="/home/sof/ct-ng.git/builds/xtensa-cnl-elf/bin:${PATH}"
-USER sof -WORKDIR /home/sof/newlib-xtensa.git -RUN git checkout -b xtensa origin/xtensa -RUN for arch in byt hsw bxt cnl; do \
- ./configure --target=xtensa-${arch}-elf \
+RUN cd /home/sof && git clone https://github.com/01org/osadsp-crosstool-ng.git /home/sof/ct-ng.git && \ +cd ct-ng.git && ./bootstrap && ./configure --prefix=`pwd` && \
- make && make install && \
- for arch in byt hsw bxt cnl; do \
./ct-ng xtensa-${arch}-elf && \
./ct-ng build ; \
- done && \
- mkdir -p /home/sof/work/ && \
- cp -r builds/xtensa-*-elf /home/sof/work/ && cd /home/sof/ && sudo rm -rf ct-ng.git
+ENV PATH="/home/sof/work/xtensa-byt-elf/bin:${PATH}" +ENV PATH="/home/sof/work/xtensa-hsw-elf/bin:${PATH}" +ENV PATH="/home/sof/work/xtensa-bxt-elf/bin:${PATH}" +ENV PATH="/home/sof/work/xtensa-cnl-elf/bin:${PATH}"
+RUN cd /home/sof && git clone https://github.com/jcmvbkbc/newlib-xtensa.git newlib-xtensa.git && \
- cd newlib-xtensa.git && git checkout -b xtensa origin/xtensa && \
- for arch in byt hsw bxt cnl; do \
--prefix=/home/sof/work/xtensa-root && \./configure --target=xtensa-${arch}-elf \
- make && \
- make install && \
- make distclean; \
-done
make && \
make install && \
make distclean; \
- done && \
- cd /home/sof/ && sudo rm -rf newlib-xtensa.git
-USER sof -WORKDIR /home/sof/sof.git -RUN ./autogen.sh -RUN ./configure --enable-rimage -RUN make -USER root -RUN make install
# Create direcroties for the host machines sof/soft directories to be mounted. -USER sof -RUN mkdir -p /home/sof/work/sof -RUN mkdir -p /home/sof/work/soft +RUN mkdir -p /home/sof/work/sof.git && \
mkdir -p /home/sof/work/soft.git
USER sof WORKDIR /home/sof/work/sof.git/
-# Default to building all. -CMD ./scripts/xtensa-build-all.sh
On 6/5/2018 18:43, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Modify Dockerfile to copy apt.conf from host and set host proxy to environment. Also modify some git url to http url in order to use the proxy.
Also add a docker-build.sh to help docker build
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
V2: Add selection to use git url when no proxy is used
Hi Dylan,
Could you try these patches to see if the selection with git url work fine without git?
Thanks Xiuli
scripts/README.docker | 3 ++- scripts/docker_build/Dockerfile | 23 ++++++++++++++++++----- scripts/docker_build/docker-build.sh | 7 +++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100755 scripts/docker_build/docker-build.sh
diff --git a/scripts/README.docker b/scripts/README.docker index 82558b1..e2f189f 100644 --- a/scripts/README.docker +++ b/scripts/README.docker @@ -16,7 +16,8 @@ First, build the docker container. This step needs to be done initially and when the toolchain or alsa dependencies are updated.
cd scripts/docker_build -docker build --build-arg UID=$(id -u) -t sof .
+./docker-build.sh
After the container is built, it can be used to run the scripts.
diff --git a/scripts/docker_build/Dockerfile b/scripts/docker_build/Dockerfile index 7ee0a45..8dede3c 100644 --- a/scripts/docker_build/Dockerfile +++ b/scripts/docker_build/Dockerfile @@ -17,6 +17,13 @@ FROM ubuntu:16.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 \
@@ -49,11 +56,17 @@ RUN apt-get clean RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
# Use ToT alsa utils for the latest topology patches. -RUN mkdir -p /root/alsa-build -RUN cd /root/alsa-build && git clone git://git.alsa-project.org/alsa-lib.git -RUN cd /root/alsa-build && git clone git://git.alsa-project.org/alsa-utils.git -RUN cd /root/alsa-build/alsa-lib && ./gitcompile && make install -RUN cd /root/alsa-build/alsa-utils && ./gitcompile && make install +RUN mkdir -p /root/alsa-build && cd /root/alsa-build && \
- if [ "x$http_proxy" = "x" ]; then \
git clone git://git.alsa-project.org/alsa-lib.git && \
git clone git://git.alsa-project.org/alsa-utils.git ; \
- else \
git clone http://git.alsa-project.org/http/alsa-lib.git && \
git clone http://git.alsa-project.org/http/alsa-utils.git; \
- fi && \
+cd /root/alsa-build/alsa-lib && ./gitcompile && make install && \ +cd /root/alsa-build/alsa-utils && ./gitcompile && make install && \ +cd /root/ && rm -rf alsa-build
RUN useradd --create-home -d /home/sof -u $UID -G sudo sof RUN echo "sof:test0000" | chpasswd diff --git a/scripts/docker_build/docker-build.sh b/scripts/docker_build/docker-build.sh new file mode 100755 index 0000000..1090f15 --- /dev/null +++ b/scripts/docker_build/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 sof .
participants (2)
-
Pan, Xiuli
-
Xiuli Pan