Automating an SDK build

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Automating an SDK build

Postby snim2 » Fri Oct 31, 2014 10:15 am

Hi there,

I'm trying to automate a building and installing the SDK on a Ubuntu Intel host (so, cross compiling). This is to create a repeatable development environment (so, I'm not intending to use this to actually deploy anything on a Parallella board just yet).

I've read the instructions on the wiki and the post here: http://forums.parallella.org/viewtopic.php?f=44&t=577&start=30. I've copied the script below, which has two problems 1) /install-sdk.sh fails as it does not recognise arm-linux-gnuabihf as a valid host; and 2) building the parallella-examples repo fails because e-hal.h cannot be found. I'm not sure I have got the environment variables here correct, or even close. Also, I am not sure whether I need to build the parallella-linux repo also?

Any hints greatly appreciated...

Thanks,

Sarah

Code: Select all
#!/bin/bash
sudo apt-get update -qq
sudo apt-get -qq install build-essential
sudo apt-get -qq install bison flex libgmp-dev libncurses-dev libmpc-dev libmpfr-dev texinfo xzip lzip
sudo apt-get -qq install gcc-arm-linux-gnueabihf
sudo apt-get -qq install g++-arm-linux-gnueabihf
cd $HOME
mkdir epiphany-sdk
export EPIPHANY_BUILD_HOME=$HOME/epiphany-sdk
cd epiphany-sdk
git clone https://github.com/adapteva/epiphany-sdk.git sdk
cd sdk
./download-toolchain.sh --clone
sudo ./build-toolchain.sh --host arm-linux-gnueabihf
export PATH=$EPIPHANY_BUILD_HOME/INSTALL/bin:/opt/adapteva/esdk/tools/e-gnu/bin:$PATH
./build-epiphany-sdk.sh --host arm-linux-gnueabihf || tail build-*.log # Helps with debugging.
./install-sdk.sh --host arm-linux-gnueabihf -p /opt/adapteva
# Build epiphany-examples repo, just as a proof of concept.
cd $EPIPHANY_BUILD_HOME
git clone https://github.com/adapteva/epiphany-examples.git
cd epiphany-examples/scripts
./build_all.sh
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Automating an SDK build

Postby snim2 » Sat Nov 01, 2014 7:54 pm

In case it is helpful, I have pasted the output of that BASH script here: https://gist.github.com/snim2/bbcd0193da121fa16b3b

Thanks,

Sarah
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Automating an SDK build

Postby SYOUYU » Fri Nov 14, 2014 1:22 am

Hi All,

I also made auto-build script file.
but it meets an error of;
Epiphany toolchain not found on build machine

first,
sudo ./sdk/build-epiphany-sdk.sh -C -R -a x86_64
is successfully done, but second;
sudo ./sdk/build-epiphany-sdk.sh
is not.

Do you know how solving this issue?

Thanks and Regards,
SYOUYU
--
Best Regards,
SYOUYU
SYOUYU
 
Posts: 10
Joined: Wed Oct 01, 2014 6:27 am

Re: Automating an SDK build

Postby SYOUYU » Fri Nov 14, 2014 1:11 pm

Hi All,

Is the attached code of auto-build script sufficient to run any tools?
This script takes two arguments of;
1st: build-root path name (not absolute path)
2nd: version of code (ex. 2014.11)

Code: Select all
#!/bin/bash

#INSTALL NECESSARY PACKAGES FOR RUNNING E-ECLIPSE
sudo apt-get install libgmp3-dev libexpat1-dev openjdk-6-jre libmpfr-dev libmpc-dev tcsh csh  g++

#INSTALL COMPILATION PACKAGES TO UBUNTU
sudo apt-get --no-install-recommends install kernel-package gdb manpages-dev automake bison flex unzip git libgmp-dev libncurses5-dev libmpc-dev libmpfr-dev texinfo

#DOWNLOAD EPIPHANY SDK UNDER YOUR HOME DIRECTORY
cd $HOME

if [ $1 ]
then
    BUILDROOT=$1
else
    BUILDROOT="buildroot"
fi

echo "Install to $HOME/$BUILDROOT"
mkdir $BUILDROOT
cd $BUILDROOT

if [ $2 ]
then
    BRANCH=$2
else
    BRANCH="2014.11"
fi

echo "Git epiphany-sdk (branch = $BRANCH)"
git clone --branch $BRANCH https://github.com/adapteva/epiphany-sdk.git sdk

#BUILD EPIPHANY SDK
echo "Building for Intel x86_64"
sudo ./sdk/build-epiphany-sdk.sh -C -R -a x86_64

FILE = $HOME/.bashrc
if [ $FILE ]; then
    echo "EPIPHANY_HOME=${HOME}/${BUILDROOT}/esdk.${BRANCH}" >> $FILE
    echo "PATH=${EPIPHANY_HOME}/tools/e-gnu/bin/:$PATH" >> $FILE
    echo "MANPATH=${EPIPHANY_HOME}/tools/e-gnu/share/man/:$MANPATH" >> $FILE

    echo "type command: source .bashrc"
else
    echo "ERROR: There is no bashrc file in your home."
    echo "You need to set paths:"
    echo "EPIPHANY_HOME=${HOME}/${BUILDROOT}/esdk.${BRANCH}"
    echo "PATH=${EPIPHANY_HOME}/tools/e-gnu/bin/:$PATH"
    echo "MANPATH=${EPIPHANY_HOME}/tools/e-gnu/share/man/:$MANPATH"
fi


Best Regards,
SYOUYU
--
Best Regards,
SYOUYU
SYOUYU
 
Posts: 10
Joined: Wed Oct 01, 2014 6:27 am

Re: Automating an SDK build

Postby SYOUYU » Sat Nov 15, 2014 11:41 am

Hi All,

I updated the auto-build script;
Code: Select all
#!/bin/bash

#INSTALL COMPILATION PACKAGES TO UBUNTU
sudo apt-get --no-install-recommends install kernel-package gdb manpages-dev automake bison flex unzip git libgmp-dev libncurses5-dev libmpc-dev libmpfr-dev texinfo

#DOWNLOAD EPIPHANY SDK UNDER YOUR HOME DIRECTORY
cd $HOME

if [ $1 ]
then
    BUILDROOT=$1
else
    BUILDROOT="buildroot"
fi

echo "Install to $HOME/$BUILDROOT"
mkdir $BUILDROOT
cd $BUILDROOT

if [ $2 ]
then
    BRANCH=$2
else
    BRANCH="2014.11"
fi

echo "Git epiphany-sdk (branch = $BRANCH)"
git clone --branch $BRANCH https://github.com/adapteva/epiphany-sdk.git sdk

#BUILD EPIPHANY SDK
echo "Building for Intel x86_64"
sudo ./sdk/build-epiphany-sdk.sh -C -R -a x86_64

cd $HOME
FILE=".bashrc"
if [ $FILE ]; then
    echo "EPIPHANY_HOME=${HOME}/${BUILDROOT}/esdk.${BRANCH}" >> $FILE
    echo "PATH=${EPIPHANY_HOME}/tools/e-gnu/bin/:$PATH" >> $FILE
    echo "MANPATH=${EPIPHANY_HOME}/tools/e-gnu/share/man/:$MANPATH" >> $FILE

    echo "type command: source .bashrc"
else
    echo "ERROR: There is no bashrc file in your home."
    echo "You need to add paths:"
    echo "add EPIPHANY_HOME=${HOME}/${BUILDROOT}/esdk.${BRANCH}"
    echo "add PATH=${EPIPHANY_HOME}/tools/e-gnu/bin"
    echo "add MANPATH=${EPIPHANY_HOME}/tools/e-gnu/share/man"
fi


Best Regards,
SYOUYU
--
Best Regards,
SYOUYU
SYOUYU
 
Posts: 10
Joined: Wed Oct 01, 2014 6:27 am

Re: Automating an SDK build

Postby snim2 » Thu Jan 29, 2015 7:28 am

Thanks for posting your scripts and sorry it has taken me so long to reply.

Unfortunately I never got this script to work. The current error I get is this:

Code: Select all
/home/snim2/buildroot/gdb-multicore-sim/bfd/opncls.c: In function ‘bfd_fopen’:
./bfd.h:529:65: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
 #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
                                                                 ^
/home/snim2/buildroot/gdb-multicore-sim/bfd/opncls.c:263:5: note: in expansion of macro ‘bfd_set_cacheable’
     bfd_set_cacheable (nbfd, TRUE);
     ^
mv -f .deps/libbfd.Tpo .deps/libbfd.Plo
/bin/bash ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I/home/snim2/buildroot/gdb-multicore-sim/bfd -I. -I/home/snim2/buildroot/gdb-multicore-sim/bfd -I/home/snim2/buildroot/gdb-multicore-sim/bfd/../include  -DHAVE_bfd_elf32_epiphany_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec  -DBINDIR='"/home/snim2/buildroot/builds/bd-x86_64-2014.11-gdb-multicore-sim-install/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -pthread -lrt -fPIC -fvisibility=hidden  -MT section.lo -MD -MP -MF .deps/section.Tpo -c -o section.lo /home/snim2/buildroot/gdb-multicore-sim/bfd/section.c
cc1: all warnings being treated as errors
Makefile:1607: recipe for target 'opncls.lo' failed
make[3]: *** [opncls.lo] Error 1


which seems a little odd since there hasn't been a commit on the main branch of the SDK for a while, so I would have expected it to build OK.

Also, whenever I've build the SDK like this I always end up with an empty directory in .../buildroot/esdk.2014.11/tools/host/lib/ I'm not sure if that happened this time because the error above caused the build cycle to exit early or some other problem.

Any ideas would be greatly appreciated!

Thanks,

Sarah
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Automating an SDK build

Postby peteasa » Fri Jan 30, 2015 5:26 pm

Hi,

I have been working on a yocto environment. What is missing is a re-arrangement of the Makefiles in the epiphany-libs (https://github.com/adapteva/epiphany-libs) to be yocto friendly. I might get round to doing that at some point so that you can build epiphany-libs from source. Once done the yocto environment will build a distribution for the prototype board so you can use smart update to update packages, it will also produce an SDK so that you can use yocto eclipse or any IDE to develop epiphany code and then copy this to the board, it will also produce a complete SD card image so that you can boot the board from sd card. Follow the progress of this project at viewtopic.php?f=9&t=414.
The script at https://github.com/peteasa/parallella-yoctobuild builds all the compilers and cross compilers you need today. It is also can be configured to use the prebuilt epiphany-sdk with the yocto build. As mentioned the only thing missing now is the build epiphany-libs from source... a relatively simple step if you know yocto!

Peter
User avatar
peteasa
 
Posts: 117
Joined: Fri Nov 21, 2014 7:04 pm

Re: Automating an SDK build

Postby snim2 » Sat Jan 31, 2015 5:32 pm

Peter,

many thanks for this. I was aware of your work, but I don't really know anything about Yocto, so hadn't considered it before. I'm having a go now, but I'm not sure which documentation would be best to work from, other than your README in the github repo.

In particular there are two things I want to be able to do:

1) compile code for the Parallella, using the Epiphany SDK, on an x86_64 machine (so I can work on the train)

and 2) be able to create a reliably reproducible development environment, so that if someone wants to reproduce any work I have done, they would be able to easily recreate my environment on their own Parallella board.

It looks like your work certainly solves 2), I'm not sure how it will work with 1) - probably because I haven't used Yocto before. I'd be happy to contribute to your work if I knew a little more, but I'm not sure where to start. By the way, I have sent you a simple PR to format the README with GitHub-flavoured markdown!

Incidentally, my first go produced this error message:

Code: Select all
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    Please install the following missing utilities: chrpath
libsdl-native is set to be ASSUME_PROVIDED but sdl-config can't be found in PATH. Please either install it, or configure qemu not to require sdl.


That looks like missing dependencies at my end, so maybe something to add to your own docs?

Thanks,

Sarah
snim2
 
Posts: 53
Joined: Mon Feb 03, 2014 5:02 pm

Re: Automating an SDK build

Postby peteasa » Sat Jan 31, 2015 8:18 pm

Hi,
snim2 wrote:1) compile code for the Parallella, using the Epiphany SDK, on an x86_64 machine (so I can work on the train)

My plan to get the Epiphany SDK going in the x86_64 machine eventually. Right now I am having a bit of a break from Yocto because I have what I want.. an environment where I can develop kernel modules on an x86_64 machine and then drop them onto the target to run with my version of the FPGA. Also I can build a development version of the kernel and use tools like perf and stap to understand what is happening with the arm -> epiphany connection etc...

To get the SDK built in the x86_64 Yocto SDK is almost done. All the cross compilers needed are in place and have been proven and I have build the epiphany-libs by hand and so the libraries to use are also available. What is left is to create a single new Yocto recipe that will
[*]clone the epiphany-libs into the Yocto WORKDIR
[*]replace the Makefiles in the epiphany-libs with Makefiles that are Yocto friendly
[*]build and install the epiphany-libs
[*]package the epiphany-libs

Once that is done the Yocto SDK will have the epiphany-libs so that it will be possible to build on an x86_64 machine.

The reason why this is not necessarily a simple step to prove is that a lot of the Epiphany examples assume that there is a EPIPHANY_HOME location with the various binaries and tools. I have a separate shell script (138 lines long) that I use on the target to create a version of this Epiphany SDK from the yocto generated tools -
Code: Select all
mkdir -p epiphany-sdk/bsps
mkdir -p epiphany-sdk/tools/host
mkdir -p epiphany-sdk/tools/e-gnu/epiphany-elf
mkdir -p epiphany-sdk/tools/e-gnu/lib
mkdir -p epiphany-sdk/tools/e-gnu/libexec
...
then a lot of links like
ln -s /usr/include ${EPIPHANY_HOME}/tools/host/
ln -s /usr/lib ${EPIPHANY_HOME}/tools/host/
ln -s /usr/bin ${EPIPHANY_HOME}/tools/host/
...
then the epiphany library build
cd src/e-lib/Release
make clean
make all
...
and a lot more links like
ln -s  epiphany-libs/src/e-utils/e-objcopy /usr/bin/
ln -s  epiphany-libs/src/e-utils/e-hw-rev/e-hw-rev.sh /usr/bin/e-hw-rev


I have to decide how best to package this in Yocto. I think that I will create a /usr/epiphany folder and put these links into that location. I think that I will put the libraries like libe-lib.a into /usr/lib/epiphany-elf/ with the other epiphany-elf libraries and link to them from /usr/epiphany then the Epiphany examples can use /usr/epiphany as the EPIPHANY_HOME and a normal build will find the libraries in the normal place ie /usr/lib/epiphany-elf/.

By the time I have worked out how to do the above it will also be time to move the compiler, binutils, newlib and epiphany-libs onto the latest versions so as you see its a never ending job!

Peter
User avatar
peteasa
 
Posts: 117
Joined: Fri Nov 21, 2014 7:04 pm

Re: Automating an SDK build

Postby peteasa » Sat Feb 07, 2015 8:43 pm

Today I created a script that builds the epiphany-libs code in the Yocto SDK environment. This is the first step in getting the epiphany-libs code built as part of the Yocto build.

The script builds the epiphany-libs code and creates an SDK at /usr/epiphany/epiphany-sdk in the Yocto SDK environment. I then proved the operation of the epiphany-sdk in the Yocto SDK environment by building the hello-world example application and copying it to the target and it works :D.

So now with the Yocto environment if you want to build code for the arm or the epiphany processor you can do so using the Yocto SDK. If you are brave and want to try it out you clone the github project https://github.com/peteasa/parallella-yoctobuild.git; source initgitsubmodules.sh; source prepareyoctobuild.sh; bitbake hdmi-image; bitbake -c populate_sdk hdmi-image - note that that will all take a long time because you are building the whole linux distribution. Then install and setup the yocto sdk on a machine of your choice and in a suitable folder run the script build-eiphany-sdk.sh. This will download epiphany-libs, patch it and then build it. The sdk (composed of a set of links to the usual library directories) will be at
Code: Select all
export EPIPHANY_HOME=${OECORE_NATIVE_SYSROOT}/usr/epiphany/epiphany-sdk

EPIPHANY_HDF is set to the appropriate bsps folder (I only setup EPIPHANY_HOME=${OECORE_TARGET_SYSROOT}/usr/epiphany/epiphany-sdk/bsps, I think its only used on target anyway). In theory you would not need to set EPIPHANY_HOME because the libraries should be picked up from the normal library directories, but for the example code EPIPHANY_HOME is used so I have set it up.
User avatar
peteasa
 
Posts: 117
Joined: Fri Nov 21, 2014 7:04 pm

Next

Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 9 guests

cron