[Sound-open-firmware] [PATCH V2 1/3] configure: Change install prefix for bin and keys
From: Pan Xiuli xiuli.pan@linux.intel.com
Install prefix will not influce PEM install path. Add the check to let PEM can install with the prefix.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/configure.ac b/configure.ac index 0f34acc..a948906 100644 --- a/configure.ac +++ b/configure.ac @@ -358,7 +358,11 @@ if test "$have_rimage" = "yes"; then fi fi
+if test "x$prefix" == "xNONE"; then PEM_KEY_PREFIX="/usr/local/share/rimage" +else +PEM_KEY_PREFIX=$prefix"/share/rimage" +fi AC_DEFINE_UNQUOTED([PEM_KEY_PREFIX], ["$PEM_KEY_PREFIX"], ["Path for PEM keys"]) AC_SUBST(PEM_KEY_PREFIX)
@@ -448,6 +452,7 @@ echo " Target Architecture: ${ARCH} Target Platform: ${PLATFORM} Target Core: ${XTENSA_CORE} +Install Prefix: ${prefix} PEM: ${PEM_KEY_PREFIX}
Compiler: ${CC}
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a flag "-l" to make rimage install only in pdw/local. Also add parse for args, then simplify platform build for loop since in parse the args will be all legal
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com --- V2: fix mismatch or variable name in for loop and add check for no args --- scripts/xtensa-build-all.sh | 137 ++++++++++++++++++++++++++------------------ 1 file changed, 82 insertions(+), 55 deletions(-)
diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index 99db2b0..198ab8d 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -1,5 +1,39 @@ #!/bin/bash
+SUPPORTED_PLATFORMS=(byt cht bdw hsw apl cnl) +if [ "$#" -eq 0 ] +then + PLATFORMS=${SUPPORTED_PLATFORMS[@]} +else + # parse the args + for args in $@ + do + if [[ "$args" == "-l" ]] + then + BUILD_LOCAL=1 + + # build all images for chosen targets + if [ "$#" -eq 1 ] + then + PLATFORMS=${SUPPORTED_PLATFORMS[@]} + break + fi + else + for i in ${SUPPORTED_PLATFORMS[@]} + do + if [ $i == $args ] + then + PLATFORMS+=$i" " + fi + done + fi + done +fi + + +# now build the firmware (depends on rimage) +rm -fr src/arch/xtensa/*.ri + # fail on any errors set -e
@@ -8,67 +42,60 @@ set -e
pwd=`pwd`
-# make sure rimage is built and aligned with code -./configure --enable-rimage -make -sudo make install - -# now build the firmware (depends on rimage) -rm -fr src/arch/xtensa/*.ri - -SUPPORTED_PLATFORMS=(byt cht bdw hsw apl cnl)
-# build all images for chosen targets -if [ "$#" -eq 0 ] +# make sure rimage is built and aligned with code +if [[ "x$BUILD_LOCAL" == "x" ]] then - PLATFORMS=${SUPPORTED_PLATFORMS[@]} + ./configure --enable-rimage + make + sudo make install else - PLATFORMS=$@ + echo "BUILD in local folder!" + rm -rf $pwd/local/ + ./configure --enable-rimage --prefix=$pwd/local + make + make install + PATH=$pwd/local/bin:$PATH fi
-for i in ${PLATFORMS[@]} +# build platform +for j in ${PLATFORMS[@]} do - for j in ${SUPPORTED_PLATFORMS[@]} - do - if [ $j == $i ] - then - if [ $j == "byt" ] - then - PLATFORM="baytrail" - ROOT="xtensa-byt-elf" - fi - if [ $j == "cht" ] - then - PLATFORM="cherrytrail" - ROOT="xtensa-byt-elf" - fi - if [ $j == "bdw" ] - then - PLATFORM="broadwell" - ROOT="xtensa-hsw-elf" - fi - if [ $j == "hsw" ] - then - PLATFORM="haswell" - ROOT="xtensa-hsw-elf" - fi - if [ $j == "apl" ] - then - PLATFORM="apollolake" - ROOT="xtensa-bxt-elf" - fi - if [ $j == "cnl" ] - then - PLATFORM="cannonlake" - ROOT="xtensa-cnl-elf" - fi - PATH=$pwd/../xtensa-root/$ROOT/bin:$PATH - ./configure --with-arch=xtensa --with-platform=$PLATFORM --with-root-dir=$pwd/../xtensa-root/$ROOT --host=$ROOT - make clean - make - make bin - fi - done + if [ $j == "byt" ] + then + PLATFORM="baytrail" + ROOT="xtensa-byt-elf" + fi + if [ $j == "cht" ] + then + PLATFORM="cherrytrail" + ROOT="xtensa-byt-elf" + fi + if [ $j == "bdw" ] + then + PLATFORM="broadwell" + ROOT="xtensa-hsw-elf" + fi + if [ $j == "hsw" ] + then + PLATFORM="haswell" + ROOT="xtensa-hsw-elf" + fi + if [ $j == "apl" ] + then + PLATFORM="apollolake" + ROOT="xtensa-bxt-elf" + fi + if [ $j == "cnl" ] + then + PLATFORM="cannonlake" + ROOT="xtensa-cnl-elf" + fi + PATH=$pwd/../xtensa-root/$ROOT/bin:$PATH + ./configure --with-arch=xtensa --with-platform=$PLATFORM --with-root-dir=$pwd/../xtensa-root/$ROOT --host=$ROOT + make clean + make + make bin done
# list all the images
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 V3: Add some readme for local rimage build --- scripts/README.docker | 2 + scripts/docker_build/Dockerfile | 99 +++++++++++++---------------------------- 2 files changed, 34 insertions(+), 67 deletions(-)
diff --git a/scripts/README.docker b/scripts/README.docker index e2f189f..468ae25 100644 --- a/scripts/README.docker +++ b/scripts/README.docker @@ -22,6 +22,8 @@ cd scripts/docker_build After the container is built, it can be used to run the scripts.
To build for baytrail: +./scripts/docker-run.sh ./scripts/xtensa-build-all.sh -l byt +or (may need password test0000 for rimage install) ./scripts/docker-run.sh ./scripts/xtensa-build-all.sh byt
To rebuild the topology in soft.git: diff --git a/scripts/docker_build/Dockerfile b/scripts/docker_build/Dockerfile index 8dede3c..9c6ce85 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 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
participants (1)
-
Xiuli Pan