1. Introduction
This documentation discusses how to build the linux-add-in on the up-to-date Ubuntu-18.04-bit-64 host. The target host Ubuntu we can get form both Docker and OS, we will expound them respectively.
- OS Ubuntu-18.04: Refer to http://releases.ubuntu.com/18.04/ to download the installation image ubuntu-18.04.1-desktop-amd64.iso and install it to your local PC.
- Ubuntu-18.04 image form Docker: Build an Ubuntu-18.04 image and get start to construct the Linux-add-in container.
Supported files:
- adi-linux-add-in toolchain: adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb
adi-LinuxAddinForCCES-linux-x86-1.3.0.deb
Both packages are available from https://www.analog.com/en/design-center/processors-and-dsp/evaluation-and-development-software/LinuxAddin.html - automake patch for buildroot: 0002-port-to-perl-5.22-and-later.patch
2. Build ADI-LINUX-ADD-IN on OS Ubuntu-18.04-bit-64.
2.1 Install Ubuntu 18.04 to local PC.
An open link to install the Ubuntu To local Pc is here: https://www.linuxtechi.com/ubuntu-18-04-lts-desktop-installation-guide-screenshots/
2.2 Environment set up for adi-Linux-add-in
2.2.1 Configure the Linux Host Machine
Several packages are required on the host machine in order to complete. These can be installed on your host system with the following command:
sudo apt-get update
sudo apt install -y vim-nox openssh-server expect default-jdk minicom ckermit gawk git-core g++ bison flex gettext texinfo libncurses5-dev subversion meld rsh-client mpg123 python-setuptools python-dev netperf tftpd-hpa uuid-dev genromfs samba cifs-utils xz-utils intltool ethtool libtool wakeonlan make lib32z1 lib32stdc++6 lib32ncurses5
2.2.2 Install the adi-linux-add-in Toolchains
Download adi-linux-add-in toolchains form the attached link and install the packages by executing the commands below. Note that the version numbers of the packages may differ from those shown on the command lines below.
$ sudo dpkg -i adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb
$ sudo dpkg -i adi-LinuxAddinForCCES-linux-x86-1.3.0.deb
The products will be installed in the /opt/analog
directory on your host system.
2.2.3 Configure the Patch for Toolchains
Development for Linux requires the use of two toolchains:
- The Bare Metal toolchain is provided as part of CrossCore Embedded Studio. It produces bare metal applications that run directly on the hardware without an underlying operating system. The bare metal toolcain is used to build the u-Boot bootloader.
- The Linux Targeting toolchain is provided as part of the Linux Add-In for CrossCore Embedded Studio. It produces applications that run under Linux on the ADSP-SC5xx EZ-Kits.
The following instructions in the User Guide assume that the bin directories for both toolchains are included in your path.
To add the paths to your PATH environment variable, add the following line to the end of the ~/.bashrc
file:
export PATH=$PATH:/opt/analog/cces-linux-add-in/1.3.0/ARM/arm-linux-gnueabi/bin:/opt/analog/cces/2.7.0/ARM/arm-none-eabi/bin
Then run the following command, to update your path in your current shell:
$ source ~/.bashrc
2.2.4 Extract the Source Code and Apply the Patch
Use the following commands to get the source code and apply the patch 0002-port-to-perl-5.22-and-later.patch of automake for buildroot.# create the workspace directory
mkdir ~/sc5xx_dev/
#get source codes(u-boot & buildroot) form the linu-add-in.
sudo tar -zxvf /opt/analog/cces-linux-add-in/1.3.0/buildroot-sc5xx-1.3.0/src/buildroot-sc5xx-1.3.0.tar.gz -C ~/sc5xx_dev
sudo tar -zxvf /opt/analog/cces-linux-add-in/1.3.0/uboot-sc5xx-1.3.0/src/uboot-sc5xx-1.3.0.tar.gz -C ~/sc5xx_dev
#apply the patch for automake of buildroot
cp 0002-port-to-perl-5.22-and-later.patch ~/sc5xx_dev/buildroot/package/automake/
Now the source codes (buildroot & uboot) will be generated in directory "~/sc5xx_dev" and you can use the them to build adi-Linux-add-in after the above configuring.test@hashirama:~/sc5xx_dev$ ll
drwxrwxr-x 13 test test 4096 Sep 28 12:09 buildroot/
drwxrwxr-x 21 test test 4096 Nov 1 15:11 uboot/
3. Build ADI-LINUX-ADD-IN on Docker Image Ubuntu-18.04-bit-64.
3.1 Install Docker Server to Local PC.
You can install Docker to your host PC following the quick start page Docker use on Ubuntu, if you have install the docker server once, just skip it.
3.2 Customize the Container of Docker
Before we start to build a workable Container of Docker for Linux-add-in, the Dockerfile and environment should be prepared and configured firstly.
3.2.1 Structure of the File distribution
workspace/
-->linuxaddin-dockerfile
-->Dockerfile
-->install_toolchains.sh
-->build_docker_image.sh
-->run_linuxaddin_ubuntu-18.04.sh
-->lib/
-->toolchains/
-->adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb
-->adi-LinuxAddinForCCES-linux-x86-1.3.0.deb
-->0002-port-to-perl-5.22-and-later.patch
3.2.2 Dockerfile
Create an empty directory and Change directories into it, create a file called "Dockerfile" and fill it with the following content.
$ sudo mkdir /tftboot/
$ mkdir -p ~/workspace/linuxaddin-dockerfile
$ cd ~/workspace/linuxaddin-dockerfile
$ vim Dockerfile
Contents for Dockerfile
# Use official Ubuntu as our base# Use official Ubuntu as our base
FROM ubuntu:18.04
# Set the workspace in /sc5xx_dev
ARG WORK_PATH=/sc5xx_dev
# Set the volume directory in /tftpboot
ARG VOLUME_PATH=/tftpboot
# Set the path of dockerfile in /sc5xx_dev/linuxaddin-dockerfile
ARG DOCKERFILE_PATH=${WORK_PATH}/linuxaddin-dockerfile
# Set the path and name of Patch in /sc5xx_dev/linuxaddin-dockerfile/lib
ARG PATCH_PATH=${DOCKERFILE_PATH}/lib
ARG PATCH=${PATCH_PATH}/0002-port-to-perl-5.22-and-later.patch
# Set the path of toolchains in /sc5xx_dev/linuxaddin-dockerfile/lib/tootchains
ARG TOOLCHAINS_PATH=${DOCKERFILE_PATH}/lib/toolchains
# Set the Version and Path of CCES
ARG CCES_VERSION=2.7.0
ARG CCES=${TOOLCHAINS_PATH}/adi-CrossCoreEmbeddedStudio-linux-x86-${CCES_VERSION}.deb
# Set the Version and Path of cces-linux-add-in.
ARG LINUX_ADDIN_VERSION=1.3.0
ARG LINUX_ADDIN=${TOOLCHAINS_PATH}/adi-LinuxAddinForCCES-linux-x86-${LINUX_ADDIN_VERSION}.deb
# Configure the Label of Version/description/maintainer
LABEL version="ubuntu-18.04" description="Linux-add-in-1.3.0 based on Ubuntu-18.04-bit-64" Maintainer="Sullivan Liu <Sullivan.liu@analog.com>"
# Working directory set to /sc5xx_dev
WORKDIR ${WORK_PATH}
# Add local scripts to working directory /sc5xx_dev/linuxaddin_dockerfile
ADD . ${DOCKERFILE_PATH}
# Add required packages in the noninteractive mode
RUN apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q install net-tools build-essential minicom tftpd-hpa git-all subversion openssh-server ncurses-dev php gawk g++ m4 libncurses5-dev texinfo flex bison php-cli vim php-xml python-setuptools python-dev make unzip rsync cpio bc lib32z1 lib32stdc++6 lib32ncurses5
# mountu the local volue_path to remote container, volume_path=/tftpboot
VOLUME ${VOLUME_PATH} ${VOLUME_PATH}
#install the adi CCES and Linux-add-in toolchains
RUN dpkg --add-architecture i386
RUN sh ${DOCKERFILE_PATH}/install_toolchains.sh ${CCES} ${CCES_VERSION} ${LINUX_ADDIN} ${LINUX_ADDIN_VERSION} ${WORK_PATH} ${PATCH}
# Set toolchain PATH for remote container
ENV PATH=${PATH}:/opt/analog/cces/${CCES_VERSION}/ARM/arm-none-eabi/bin:/opt/analog/cces-linux-add-in/${LINUX_ADDIN_VERSION}/ARM/arm-linux-gnueabi/bin/
# Run docker image linuxaddin-ubuntu-18.04 when the container launches
CMD pwd ; echo "ADI-Linux-add-in-1.3.0 based on Ubuntu-18.04-bit-64"
3.2.3 Toolchain and supported files
Download the latest versions of the CrossCore Embedded Studio and Linux Add-In for CrossCore Embedded Studio.
- CrossCore Embedded Studio: adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb
- Linux Add-In for CrossCore Embedded Studio: adi-LinuxAddinForCCES-linux-x86-1.3.0.deb
Add the unescaped left brace warning patch for buildroot: 0002-port-to-perl-5.22-and-later.patch
From 13f00eb4493c217269b76614759e452d8302955e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 31 Mar 2016 16:35:29 -0700
Subject: [PATCH] automake: port to Perl 5.22 and later
Without this change, Perl 5.22 complains "Unescaped left brace in
regex is deprecated" and this is planned to become a hard error in
Perl 5.26. See:
http://search.cpan.org/dist/perl-5.22.0/pod/perldelta.pod#A_literal_%22{%22_should_now_be_escaped_in_a_pattern
* bin/automake.in (substitute_ac_subst_variables): Escape left brace.
[Backported from:
http://git.savannah.gnu.org/cgit/automake.git/commit/?id=13f00eb4493c217269b76614759e452d8302955e]
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
bin/automake.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/automake.in b/bin/automake.in
index a3a0aa3..2c8f31e 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables_worker
sub substitute_ac_subst_variables
{
my ($text) = @_;
- $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
+ $text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
return $text;
}
--
2.7.4
Then we include the above to file toolchain and patch in a directory: "lib"
$ cd ~/workspace/linuxaddin-dockerfile/
$ mkdir -p lib/toolchains
$ cp adi-CrossCoreEmbeddedStudio-linux-x86-2.7.0.deb ~/sc5xx_dev/lib/toolchains/
$ cp adi-LinuxAddinForCCES-linux-x86-1.3.0.deb ~/sc5xx_dev/lib/toolchains/
$ cp 0002-port-to-perl-5.22-and-later.patch ~/sc5xx_dev/lib/
3.2.4 Convenient shell script for install the toolchains, build and run the container
Configure the toolchains installing script.
#!/bin/sh
##################################### Install CCES Tallchain #############################
cces_link=$1
cces_version=$2
echo "s2:$s1"
if [ ! -d "$cces_link" ]; then
no link given - try analog.com
cces_link="http://download.analog.com/tools/CrossCoreEmbeddedStudio/Releases/Release_$cces_version/adi-CrossCoreEmbeddedStudio-linux-x86-$cces_version.deb"
echo "Start downloading CCES ($cces_link)"
wget --quiet $cces_link
echo "CCES download finished"
cces_link=`basename $cces_link`
fi
cces_name=`basename $cces_link`
cces_deb=$cces_link
echo "Start to install $cces_name, Installing..."
echo adi-cces-$cces_version adi-cces-$cces_version/accept-sla boolean true | debconf-set-selections
echo adi-cces-$ceese_version adi-cces-$cces_version/run-ocd-config boolean true | debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
dpkg -i $cces_deb
echo "Finished, $cces_name installed into PATH=/opt/analog/cces/${cces_version}/ARM/arm-none-eabi/bin/"
##########################################################################################
##################################### Install CCES Tallchain #############################
linux_addin_link=$3
linux_addin_version=$4
if [ ! -d "$linux_addin_link" ]; then
# no linuxaddin link given - try analog.com
linux_addin_link="https://download.analog.com/tools/LinuxAddInForCCES/Releases/Release_$linux_addin_version/adi-LinuxAddinForCCES-linux-x86-$linux_addin_version.deb"
echo "Start downloading linux-addin ($linux_addin_link)"
wget --quiet $linux_addin_link
echo "linux-addin download finished"
linux_addin_link=`basename $linux_addin_link`
fi
linux_addin_name=`basename $linux_addin_link`
linux_addin_deb=$linux_addin_link
echo "Start to install $linux_addin_name, Installing..."
echo adi-cces-linux-add-in-$linux_addin_version adi-cces-linux-add-in-$linux_addin_version/accept-sla boolean true | debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
dpkg -i $linux_addin_deb
echo "Finished, $linux_addin_name installed into PATH=/opt/analog/cces-linux-add-in/${linux_addin_vesion}/ARM/arm-none-eabi/bin/"
##########################################################################################
##################### Get source codes(u-boot & buildroot) form linu-add-in ############
echo "Start to unzip the source-code to workspace, Installing..."
source_code_path=$5
tar -zxvf /opt/analog/cces-linux-add-in/${linux_addin_version}/buildroot-sc5xx-${linux_addin_version}/src/buildroot-sc5xx-${linux_addin_version}.tar.gz -C ${source_code_path}
tar -zxvf /opt/analog/cces-linux-add-in/${linux_addin_version}/uboot-sc5xx-${linux_addin_version}/src/uboot-sc5xx-${linux_addin_version}.tar.gz -C ${source_code_path}
echo "Finished, source-code{uboot & buildroot} in the PATH=${source_code_path}"
#Apply the patch for automake of buildroot
echo "Apply the patch for automake of buildroot"
patch=$6
cp ${patch} ${source_code_path}/buildroot/package/automake/
##########################################################################################
Build docker images Command.
docker build --network host -t linuxaddin-ubuntu-18.04 --build-arg OPT_KEY=analog -f ./Dockerfile .
Run the iamge of adi-linux-add-in Command.
ocker run --network host -i -t -v /tftpboot:/tftpboot/ linuxaddin-ubuntu-18.04 /bin/bash
3.3 Setup the Docker Container
3.3.1 Build the docker image using the command "build_docker_image.sh"
$ sh build_docker_image.sh
This command will build a customized Docker Image named "linuxaddin-ubuntu-18.04" form the official and basic Ubuntu-18.04 image, witch the required packages and the adi-linux-add-in toolchain will be installed into.
When the log "ADI-Linux-add-in-1.3.0 based on Ubuntu-18.04-bit-64"printed the Docker Image has been built successfully. Also we can use the command "docker images" to check the target images in docker images list:
Step 7/7 : CMD pwd ; echo "ADI-Linux-add-in-1.3.0 based on Ubuntu-18.04-bit-64"
---> Running in ba0ec6673104
Removing intermediate container ba0ec6673104
---> cb70592ccdb0
Successfully built cb70592ccdb0
Successfully tagged linuxaddin-ubuntu-18.04:latest
test@hashirama:/opt$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
linuxaddin-ubuntu-18.04 latest 27b64333f22c 39 minutes ago 5.86GB
3.3.2 Run the docker image using the command "run_linuxaddin_ubuntu-18.04.sh"
& sudo mkdir /tftboot
$ sh run_linuxaddin_ubuntu-18.04.sh
root@hashirama:/sc5xx_dev#
root@hashirama:/sc5xx_dev# ls
Dockerfile buildroot lib set_configuration.sh uboot
This command will run the target image and you can use it now.
- Note that we mount the directory "/tftpboot" of local PC to the remote, so make sure the directory "/tftpboot" has been created and configured in local PC before running the command "sh run_linuxaddin_ubuntu-18.04.sh ".
- And then after building the linux-addin kernel image and u-boot in the remote container, we can copy them to "tftpboot"(Remote) and get them to use in the corresponding directory "tftpboot"(Local).
3.3.3 Set up the PATH of toolchains
Check if the PATH has been set up correctly, if not, try it again as below.
root@hashirama:/sc5xx_dev# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root@hashirama:/sc5xx_dev# source /etc/profile
root@hashirama:/sc5xx_dev# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/analog/cces/2.7.0/ARM/arm-none-eabi/bin:/opt/analog/cces-linux-add-in/1.3.0/ARM/arm-linux-gnueabi/bin
4. Demo of Building Linux-add-in on Ubuntu-18.04-bit-64
Now you can use the up-to-date Ubuntu to build adi-Linux-add-in, ,more information can be found in the Quick Start Guide
4.1 Demo for Configure and build u-boot
$ cd /sc5xx_dev/uboot/ $ make distclean $ make sc589-ezkit_defconfig $ make
4.2 Demo for Configure and build Buildroot and Linux kernel
$ cd /sc5xx_dev/buildroot/
$ make distclean
$ make sc589-ezkit_defconfig
$ make menuconfig
$ make linux-menuconfig
$ make
5. Frequently Asked Questions
Q: When building Linux-kernel from Linux Add-In-1.3.0 source code in Buildroot on Ubuntu-18.04, you may receive the following error:
root@08ace7e5649c:/sc5xx_dev/buildroot# make sc573-ezkit_defconfig root@08ace7e5649c:/sc5xx_dev/buildroot# make Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /sc5xx_dev/buildroot/output/host/usr/bin/automake line 3936. autoreconf: /sc5xx_dev/buildroot/output/host/usr/bin/automake failed with exit status: 255 package/pkg-generic.mk:174: recipe for target '/sc5xx_dev/buildroot/output/build/alsa-lib-1.0.28/.stamp_configured' failed make: *** [/sc5xx_dev/buildroot/output/build/alsa-lib-1.0.28/.stamp_configured] Error 1
A: Apply the automake patch for buildroot.
- Get the patch from here: 0002-port-to-perl-5.22-and-later.patch
- Copy the patch to directory "buildroot/package/automake/", make clean and rebuild the Linux-kernel.
root@08ace7e5649c:/workspace# cp 0002-port-to-perl-5.22-and-later.patch /sc5xx_dev/buildroot/package/automake/ root@08ace7e5649c:/sc5xx_dev/buildroot# make clean root@08ace7e5649c:/sc5xx_dev/buildroot# make sc573-ezkit_defconfig root@08ace7e5649c:/sc5xx_dev/buildroot# make -j8