====== Introduction ======
CoBo utilizes a dual PowerPC 440 processor inside the Virtex-5. CoBo embedded software currently runs on VxWorks 6.3 or Linux 3.9.0. IRFU is responsible for VxWorks [[https://project-get.cea.fr/|development]]. In this page, the focus is on the Linux embedded software, which is compiled and built using standard open source cross compilers.
Two operating systems have been tested
* RedHat Based. Fedora 19 64-bit ([[Cobo_Fedora_Setup|Setup]])
* Debian Based. Ubuntu 12.04 32-bit ([[CoBo_Ubuntu_Setup|Setup]])
====== Environment ======
For CoBo we could use crosstool-ng and buildroot or ELDK as a toolchain.
===== CrossTool-NG =====
This tool will generate the powerpc compatible cross platform compilers.
mkdir -p $HOME/dev
cd $HOME/dev
wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.18.0.tar.bz2
tar -jvxf crosstool-ng-1.18.0.tar.bz2
cd crosstool-ng-1.18.0
./configure --prefix=$HOME/dev/ct-ng
make install
PATH=$PATH:$HOME/dev/ct-ng
mkdir -p $HOME/dev/ct-wd
cd $HOME/dev/ct-wd
If you are running Fedora 19 then download {{:config_fc.txt|:.config}} and save it in the ct-wd as ''.config''
If you are running Ubuntu 12.04 then download {{:config_ub.txt|.config}} and save it in ct-wd as ''.config''
Now type the following and take a coffee break.
ct-ng build
The cross compiler should be in ''$HOME/dev/x-tools''
===== BuildRoot =====
As the name indicates this package will create the root file system. I listed in environment because it also creates some useful tools for the host system.
cd $HOME/dev
wget http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.bz2
tar -jvxf buildroot-2013.05.tar.bz2
cd buildroot-2013.05
Download {{:config_br.txt|:.config}} and save it in buildroot directory as ''.config''
Now type the following and take a walk
make
This should generate a RAM disk, squashfs, jffs2, etc images. We will utilize the tar file system as an NFS rootfs for testing purposes.
====== Root File System ======
===== Initrd RAMDISK =====
TBR
===== NFS root file system =====
cd $HOME/dev
mkdir coborootfs
sudo tar -C coborootfs -xf $HOME/dev/buildroot-2013.05/output/images/rootfs.tar
sudo mkdir -p coborootfs/usr/local
# chown must be reverted back to root later
sudo chown -R $USER:$USER coborootfs/usr/local
# sudo chown -R root:root coborootfs/usr/local
====== Linux Kernel ======
We will use the Xilinx Linux git repo. Currently, xilinx-v14.6.02 tag generates a linux 3.9.0 image.
git clone http://github.com/Xilinx/linux-xlnx.git
cd linux-xlnx
git describe
#xilinx-v14.6.02
# if that is not the tag then type the following
# git checkout tags/xilinx-v14.6.02
git checkout -b myChanges
We will now patch the Linux kernel to turn off autoneg on 1000base-x to support Vadatech 10GbE switch. We will also add a nice boot parameter to allow us to change the MTU of the ethernet interface on boot. This is very useful when using NFS root file system.
Download {{:cobo_linux_patch.txt|:cobo.patch}} and save it in linux-xlnx as cobo.patch then
git apply --ignore-space-change --ignore-whitespace --check cobo.patch
Now download the Linux Kernel Configuration {{:config_lx.txt|:.config}} and save it as ''.config'' in linux-xlnx
Next download the cobo NFS device tree {{:virtex440-cobo02_nfs.dts.txt|:virtex440-cobo02_nfs.dts}} and save it in linux-xlnx/arch/powerpc/boot/dts
If a ramdisk is to be merged with the kernel then download {{:virtex440-cobo02_ram.dts.txt|:virtex440-cobo02_ram.dts}}
It is important that you edit the dts file boot args to match your NFS root file system. Note that ''mem=128M memmap=128M@128M'' forces linux kernel to use upper half of memory
only. Also, ''ipmtu=8982'' is not a linux kernel standard, you must apply the patch above in order to set eth0 mtu at boot.
Use the environment below to build the kernel.
export ARCH=powerpc
export TARGET=powerpc-440-linux-gnu
export CROSS_COMPILE=$TARGET-
export PATH=$PATH:$HOME/dev/x-tools/$TARGET/bin
Finally, to build the Linux kernel for NFS rootfs type:
make ARCH=powerpc simpleImage.virtex440-cobo02_nfs
To build the Linux kernel for a ramdisk type:
make ARCH=powerpc simpleImage.initrd.virtex440-cobo02_ram
One the compilation is done you can copy the elf file to your fpga xmd directory
cp arch/powerpc/boot/simpleImage.virtex440-cobo02_nfs.elf TO_XMD_DIR
# for ramdisk
cp arch/powerpc/boot/simpleImage.initrd.virtex440-cobo02_ram.elf TO_XMD_DIR
====== IRFU MDaq software ======
This is not currently supported by IRFU.
To build IRFU's Mdaq embedded software for a Linux Target follow the steps below:
All the steps/sections above except XMD should be performed.
We need to use crosstool-ng toolchain
export ARCH=powerpc
export TARGET=powerpc-440-linux-gnu
export CROSS_COMPILE=$TARGET-
export PATH=$PATH:$HOME/dev/x-tools/$TARGET/bin
Download latest boost library from [[http://boost.org|boost.org]]
cd $HOME/dev
wget boost_1_54_0.tar.bz2
cd boost_1_54_0
echo "using gcc : powerpc : powerpc-440-linux-gnu-g++ ;" >> ~/user-config.jam
./bootstrap.sh --prefix=$HOME/dev/boostppc
./b2 toolset=gcc-powerpc install --prefix=$HOME/dev/boostppc
export BOOST_LOC=$HOME/dev/boostppc
This will install a PPC compatible boost library in ''$HOME/dev/boostppc''
Next we need to install IceE binaries
cd $HOME/dev
wget http://www.zeroc.com/download/IceE/1.2/IceE-trans-1.2.0-bin-rhel4.tar.gz
tar -zvxf IceE-trans-1.2.0-bin-rhel4.tar.gz
export ICEBIN=$HOME/dev/IceE-1.2.0/bin
This will install x86 binaries for Ice in ''$HOME/dev/IceE-1.2.0''
**CLOSE THIS TERMINAL**
**START A NEW TERMINAL**
We will be using buildroot toolchain
export ARCH=powerpc
export TARGET=powerpc-440-linux-gnu
export CROSS_COMPILE=$TARGET-
export PATH=$PATH:$HOME/dev/buildroot-2013.05/output/host/usr/bin
export ROOTFS=$HOME/dev/coborootfs
export PREFIX=$ROOTFS/usr/local
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export SVNUSER=user
export SVNPASSWORD=pass
export BOOST_LOC=$HOME/dev/boostppc
export ICEBIN=$HOME/dev/IceE-1.2.0/bin
Download IRFU relevant IRFU GET software. This software is not currently ported to embedded PPC linux so we have to work around few things when we reach Mdaq compilation.
First, we create a working directory
mkdir -p $HOME/dev/GET
cd $HOME/dev/GET
Fetch the code from their SVN.
svn co --username $SVNUSER --password $SVNPASSWORD https://dsm-trac.cea.fr/svn/cconfig/TinyXml/trunk TinyXml
# accept the certificate perminantely.
svn co --username $SVNUSER --password $SVNPASSWORD https://dsm-trac.cea.fr/svn/cconfig/CompoundConfig/trunk CompoundConfig
svn co --username $SVNUSER --password $SVNPASSWORD https://dsm-trac.cea.fr/svn/mordicus/Utilities/trunk Utilities
svn co --username $SVNUSER --password $SVNPASSWORD https://dsm-trac.cea.fr/svn/mordicus/IceEirfu/trunk IceEirfu
svn co --username $SVNUSER --password $SVNPASSWORD https://dsm-trac.cea.fr/svn/mordicus/MDaq/trunk Mdaq
Now we start compiling and installing
cd $HOME/dev/GET/TinyXml
./autogen.sh
mkdir -p build/ppc && cd build/ppc
../../configure --prefix=$PREFIX --host=$TARGET --build=i686-pc-linux-gnu
make install
# if install fails then fix permissions in $prefix to chown -R $USER:$USER $PREFIX
# once you are done with all packages change it back to root.
cd $HOME/dev/GET/CompoundConfig
./autogen.sh
mkdir -p build/ppc && cd build/ppc
../../configure --prefix=$PREFIX --host=$TARGET --build=i686-pc-linux-gnu --with-boost=$BOOST_LOC
make install
cd $HOME/dev/GET/Utilities
./autogen.sh
mkdir -p build/ppc && cd build/ppc
../../configure --prefix=$PREFIX --host=$TARGET --build=i686-pc-linux-gnu --with-boost=$BOOST_LOC
make install
cd $HOME/dev/GET/IceEirfu
./autogen.sh
mkdir -p build/ppc && cd build/ppc
../../configure --prefix=$PREFIX --host=$TARGET --build=i686-pc-linux-gnu --with-icee-bin=$ICEBIN
make install
We have reached MDaq, now we need to play nice with the linker.
cd $HOME/dev/GET/Mdaq
# just for Mdaq
export CPPFLAGS="-I$ROOTFS/usr/local/include"
export LDFLAGS="-L$ROOTFS/usr/lib -L$ROOTFS/usr/local/lib"
# without ncurses readline is not linked correctly
export LIBS=-lncurses
./autogen.sh
mkdir -p build/ppc && cd build/ppc
../../configure --build=i686-pc-linux-gnu --host=powerpc-440-linux-gnu --prefix=$PREFIX --with-icee-bin=$ICEBIN --with-icee=$PREFIX --with-boost=$BOOST_LOC
make install
Once Mdaq is installed we can run it on cobo like this
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
hwServer