Thursday, February 25, 2016

Building latest bluez with pbuilder

Wanted to learn how to use pbuilder to create bluez (which I am calling 5.37) from the latest code.

First I have Mint Debian Betsy (http://www.linuxmint.com/download_lmde.php) running under vmware fusion.

To get pbuilder installed I followed this blog (https://jodal.no/2015/03/08/building-arm-debs-with-pbuilder/). So first you create .pbuilderrc and put it in the home directory. One challenge I found is that sudo would require that .pbuilderrc in /root as well. So put it in both or I read to just put it in /etc/pbuilderrc. I simplified the file since I only care about arm:
#!/bin/sh

set -e

if [ "$OS" == "debian" ]; then
MIRRORSITE="http://ftp.debian.org/debian/"
COMPONENTS="main contrib non-free"
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
"--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
: ${DIST:="jessie"}
: ${ARCH:="armhf"}
else
echo "Unknown OS: $OS"
exit 1
fi

if [ "$DIST" == "" ]; then
echo "DIST is not set"
exit 1
fi

if [ "$ARCH" == "" ]; then
echo "ARCH is not set"
exit 1
fi

NAME="$OS-$DIST-$ARCH"

if [ "$ARCH" == "armel" ] && [ "$(dpkg --print-architecture)" != "armel" ]; then
DEBOOTSTRAP="qemu-debootstrap"
fi
if [ "$ARCH" == "armhf" ] && [ "$(dpkg --print-architecture)" != "armhf" ]; then
DEBOOTSTRAP="qemu-debootstrap"
fi

DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--arch=$ARCH")
BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build"
#HOOKDIR="/var/cache/pbuilder/hook.d/"
With that in place, install the required debian packages:
apt-get install pbuilder qemu-user-static
And I only need the debian keyring:
apt-get install debian-archive-keyring
Which is installed here:
/usr/share/keyrings/
I also ran the following to get the bluez dependencies:
apt-get build-dep bluez
Now create the virtual image:
OS=debian DIST=jessie ARCH=armhf pbuilder --create
The image is created here:
/var/cache/pbuilder
With pbuilder ready I can now prepare bluez by first grabbing the latest git (will create a bluez folder in the current directory):
git clone git://git.kernel.org/pub/scm/bluetooth/bluez.git
We want to get the 5.37 release so we checkout as follows:
git checkout tags/5.37
Now some debian package pieces are needed and can be retrieved from http://http.debian.net/debian/pool/main/b/bluez/:
wget http://http.debian.net/debian/pool/main/b/bluez/bluez_5.36.orig.tar.xz
wget http://http.debian.net/debian/pool/main/b/bluez/bluez_5.36-1.dsc
wget http://http.debian.net/debian/pool/main/b/bluez/bluez_5.36-1.debian.tar.xz
now uncompress the debian folder and place in the bluez folder
tar xJvf bluez_5.36-1.debian.tar.xz -C ./bluez
Now we want to create a new number for our purposes, which we be 5.37. To get pbuilder to work, change the version of the downloaded files from 5.36 to 5.37:
cp bluez_5.36.orig.tar.xz bluez_5.37.orig.tar.xz
cp bluez_5.36-1.dsc bluez_5.37-1.dsc
Now use an editor (like vim) to modify the changelog in bluez/debian to a new version.
vim ./debian/changelog
It is important that the change match the previous entries and there is no leading spaces. Something like this will suffice:
bluez (5.37-1) unstable; urgency=medium

  * Update to 5.37. 

-- Name email Sat, 07 Jan 2016 11:47:02 +0900
The changes made in the latest bluez have to be made into a patch, quilt is the tool to do this properly. However, for a quick and dirty method just run the build (want to be in the bluez folder when running this command):
cd bluez
OS=debian DIST=jessie ARCH=armhf pdebuild --debbuildopts "-j4 -b -uc -us"
Which results in an error similar to the following:
dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/bluez_5.37-1.diff.XW1beT
dpkg-source: info: you can integrate the local changes with dpkg-source --commit
dpkg-buildpackage: error: dpkg-source -b bluez gave error exit status 2
So copy the differences into a patch and add it to patch series file as follows:
cp /tmp/bluez_5.37-1.diff.XW1beT debian/patches/latestmods.patch
echo latestmods.patch >> debian/patches/series
Now run the command again and wait:
OS=debian DIST=jessie ARCH=armhf pdebuild --debbuildopts "-j4 -b -uc -us"
The end result will be the creation of a bunch of debian bluez packages in /var/cache/pbuilder/debian-jessie-armhf/result:
bluetooth_5.37-1_all.deb
bluez-cups_5.37-1_armhf.deb
bluez-dbg_5.37-1_armhf.deb
bluez-hcidump_5.37-1_armhf.deb
bluez-obexd_5.37-1_armhf.deb
bluez-test-scripts_5.37-1_all.deb
bluez_5.37-1_armhf.deb
libbluetooth-dev_5.37-1_armhf.deb
libbluetooth3-dbg_5.37-1_armhf.deb
libbluetooth3_5.37-1_armhf.deb

Wednesday, February 10, 2016

Building Bluez 5.37 on Debian Jessie

Working on an Emtrion sbc-sama5d36 ARM Cortex-A5 setup using Debian Jessie. With Emtrion support, Elbe was used to build the base debian system. Then a bunch of build packages were added to the build (any easy way to add these packages is the apt-get build-dep bluez):
build-essential perl flex bison python3 autoconf automake dh-autoreconf autotools-dev debhelper dh-make dh-systemd devscripts fakeroot check libdbus-glib-1-dev libglib2.0-dev libcap-ng-dev libudev-dev libreadline-dev libical-dev file git lintian patch patchutils pbuilder vim
Once booted I was then ready to build bluez 5.37, first step was to clone the bluez git repository:
git clone git://git.kernel.org/pub/scm/bluetooth/bluez.git
Change into the bluez folder:
cd bluez
We want to get the 5.37 release so we checkout as follows:
git checkout tags/5.37
Then get the debian folder from the previous version of bluez, this is what is used to build bluez and is placed in the bluez folder created by the git clone.

Thus, get the compressed tar file:
wget http://http.debian.net/debian/pool/main/b/bluez/bluez_5.36-1.debian.tar.xz
and then uncompress and place in the bluez folder
tar xJvf bluez_5.36-1.debian.tar.xz -C ./
now use your favorite editor (like vim) to modify the changelog to a new version.
vim ./debian/changelog
It is important that you match the previous entries and there is no leading spaces. Something like this will suffice:
bluez (5.37-1) unstable; urgency=medium

  * Update to 5.37. 

-- Name  Sat, 07 Jan 2016 11:47:02 +0900
I also had to modify the rules file to avoid a dpkg-shlibdeps error. To do this just modify the rules file.
vim ./debian/rules
By adding the following in the %: section as follows (where the dh $@ --with systemd,autoreconf already exists) :
%:
 dh $@ --with systemd,autoreconf

override_dh_shlibdeps:
 dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
Note, you want a tab not a space before dh_shlibdeps.
Now just run buildpackage command and wait forever.
dpkg-buildpackage -j4 -b -uc -us
The end result will be the creation of a bunch of debian bluez packages in the directory above bluez:
bluetooth_5.37-1_all.deb
bluez-cups_5.37-1_armhf.deb
bluez-dbg_5.37-1_armhf.deb
bluez-hcidump_5.37-1_armhf.deb
bluez-obexd_5.37-1_armhf.deb
bluez-test-scripts_5.37-1_all.deb
bluez_5.37-1_armhf.deb
libbluetooth-dev_5.37-1_armhf.deb
libbluetooth3-dbg_5.37-1_armhf.deb
libbluetooth3_5.37-1_armhf.deb

Tuesday, October 21, 2014

Getting Eink Display working with SAMA5D3 XPLAINED Board using Python3

Wrote some python code to run the Pervasive Display 2" Eink via COG Driver board (http://repaper.org).  I am running Debian Jessie on the SAMA5D3 XPLAINED board.

First lets connect up the SAMA5D3 to the COG Driver as follows.  You should look for the pin on the specified header.  The XPLAIN board is Arduino compatible so thus the pin numbers should be equivalent to other Arduino boards.  The board port/pins section is just for reference and not needed to connect up.

Pin NumberDescriptionColorSAMA5D3
Pin
SAMA5D3
Header
Board
Port/Pins
1.Vcc 3VRed3V3J14
2.(LED1)White-

3.(UART_RX)Grey-

4.(UART_TX)Purple-

5.(SW2)Blue-

6.TemperatureGreenA0J17C18
7.SPI_CLKYellow13J15C24
8.BUSYOrange7J18C5
9.PWMBrownPA20J19A20
10./RESETBlack6J18C6
11.PANEL_ONRed2J18C9
12.DISCHARGEWhite4J18C28
13.BORDER_CONTROLGrey3J18C8
14.SPI_MISOPurple12J15C22
15.SPI_MOSIBlue11J15C23
16.(RST/SBWTDIO)Green-

17.(TEST/SBWTCK)Yellow-

18.FLASH_CSOrange9J15C3
19./EPD_CSBrown8J15C4
20.GNDBlackGNDJ14
With the boards connected you now need to make sure you have GPIO, PWM, and SPI functioning on the debian build along with python 3 and the appropriate additional libraries.  Previous posts help you setup a Debian Jessie kernel and root file system.  Two other posts demonstrate how to get PWM and SPI working.  Then just make sure you have installed (apt-get install) python3 and python3-pil.  Finally you will need the liberation fonts for the text demo and this can be installed by doing an apt-get install fonts-liberation.

The sample python 3 code is available at this site: https://github.com/photonthunder/thunderLightning/tree/master/pythonEink.  There are three files: DebianIO.py, SpiBus.py, and EinkDriver.py.

To run the demo code just type ./EinkDriver.py

If you don't see anything on the display use the backside of the COG driver board and make sure that the PWM is running (should be between 100-300 kHz), that the pins are changing state, and that you are getting SPI data.  There is no feedback so you really won't know if it is working until you see data on the screen.  You can run DebianIO.py or SpiBus.py to test the IO or the spidev and see if they are working.

Good Luck

Friday, September 19, 2014

PWM0 on Debian Jessie with SAMA5D3 XPLAIN board

A previous post setups a fresh debian jessie install but the PWM wasn't working.  In order to get it to work I had to swap the kernel configuration file as follows:


--- Pulse-Width Modulation (PWM) Support
    <*> Atmel PWM support
    < > Atmel HLCDC PWM support 
    < > Atmel TC Block PWM support 
    < > Freescale FlexTimer Module (FTM) PWM support 
    < > NXP PCA9685 PWM driver


* means you want it built in to the kernel, m means you want it set up as a module.

After that I was able to find the directory pwmchip0 in /sys/class/pwm

To use the PWM you do the following:

For any PWM line you want to use you have to export it:

~# echo 0 > /sys/class/pwm/pwmchip0/export

To use that line as generic GPIO you can unexport it.  For the exported channel a directory called pwm0 is created. In that directory you will find different files that setup different features of the PWM.

For example to setup the PWM with a 1 mS period and 0.5 mS duty cycle do the following:

~# echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/period
~# echo 500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
~# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable 


I found that the PWM0H pin was PA20, and PWM0L was PA21 on the XPLAIN board.

Good luck.

Thursday, September 18, 2014

Setting up Verizon Novatel USB760 USB Cell Modem with Debian Jessie on SAMA5D3

In previous posts I have setup my Novatel USB760 cell modem (Verizon) on a beaglebone black.  I wanted to get it working on the SAMA5D3.  Previously there was a Novatel Debian package that I used but I wanted to get it working without this package.  From what I read it should be plug and play but that wasn't the case for me.

So I start with the Debian Jessie setup in this previous post.  The first modification is that when you build the kernel (or rebuild it) make sure that the following are selected in the configuration menu under Device Driver:

Code: [Select]
Device Drivers  --->
  [*] USB support  --->
    <*>   USB Modem (CDC ACM) support
    <*>   USB Serial Converter support  --->
      [*]   USB Generic Serial Driver
      <*>   USB driver for GSM and CDMA modems
  [*] Network device support  --->
    <*>   PPP (point-to-point protocol) support
    <*>     PPP support for async serial ports


make sure that the following packages are installed in Debian Jessie:

Code: [Select]
apt-get install ppp wvdial eject usb-modeswitch

unzip the existing usb_modeswitch scripts (probably worth noting that the package is usb-modeswitch, but the executable program is usb_modeswitch - this can be confusing):

Code: [Select]
tar -xvf /usr/share/usb_modeswitch/configPack.tar.gz

modify the /etc/wvdial.conf file with the following:

Code: [Select]
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Stupid Mode = 1
Phone = #777
Username = anything@vzw3g.com
Password = vzw


You are suppose to be able to run wvdial and your modem should connect however I observed that my modem was still in storage mode.  To check this type lsusb and you will see something like the following in the list:

Code: [Select]
Bus 002 Device 003: ID 1410:5030 Novatel Wireless

To switch modes we use usb_modeswitch:

Code: [Select]
usb_modeswitch -W -i0 -v1410 -p5030 -c /usr/share/usb_modeswitch/1410\:5030

after the command lsusb should now give the following:


Code: [Select]
Bus 002 Device 003: ID 1410:6000 Novatel Wireless

0x6000 means you should be good to go.  You can double check this by making sure /dev has some /dev/USB* options like the following:

Code: [Select]
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3

If you have other USB files these four will move in number, if that happens just change the wvdial.conf Modem line to match the first of the four.

After this just run wvdial and you should connect.

Good luck


Wednesday, September 10, 2014

Modify kernel configuration and device tree files to create spidev for SAMA5D3 Xplained

I previously posted how to create an SD card with debian jessie here.  In this post I want to share how to modify the device tree file and the configuration file to setup spidev, and then how to rebuild the kernel.

First challenge I notice with the default build is that the SPI doesn't show up in /dev.  To try and get this to work I make the following changes:

First I want to change the device tree binding (.dts) file so that both SPI are active.  To do this modify armv7_devel/KERNEL/arch/arm/boot/dts/at91-sama5d3_xplained.dts.  In this file you will find spi1, modify it to match the following:


spi1: spi@f8008000 {
    cs-gpios = <&pioC 25 0>;
    status = "okay";
    spidev@0 {
        compatible = "spidev";
        spi-max-frequency = <50000000>;
        reg = <0>;
    };
};


Then make sure SPI is set in the kernel configuration file.  To do this run armv7_devel/tools/rebuild.sh instead of .armv7_devel/build_kernel.sh since build_kernel.sh will revert all .dts files to the default settings.

As rebuild.sh runs it will pull up the configuration screen, in this screen make sure the following are set:

Device Drivers --->
    [*]SPI support --->
        <*> Atmel SPI Controller
        <*> User mode SPI device driver support


* means you want it built in to the kernel, m means you want it set up as a module.  When this finishes you can copy over to the SD card as documented in the previous post and shown below.  You may with to delete the dtb folder on the boot partition before copying if you make substantial changes - but in that case you might just want to start with a clean SD card.

export kernel_version=3.16.1-sama5-armv7-r6
sudo cp -v ~/armv7_devel/deploy/${kernel_version}.zImage /media/<username>/boot/zImage
sudo mkdir -p /media/boot/dtbs/
sudo tar xvo -f ~/armv7_devel/deploy/${kernel_version}-dtbs.tar.gz -C /media/<username>/boot/dtbs/
sudo tar xv -f ~/armv7_devel/deploy/${kernel_version}-modules.tar.gz -C /media/<username>/rootfs/

Once everything is copied and you boot up you should see in /dev something like the following:
# ls /dev/spidev*
/dev/spidev32765.0

If you don't see something similar then check /var/log/syslog for atmel_spi entries and they should give you an idea of any errors.

You should find SPI1 on the following pins:

J15 Header
Pin 10 PC25 Select Pin
Pin 11 PC23 MOSI
Pin 12 PC22 MISO
Pin 13 PC24 SCK

In order to program the SPI, I used code written taken from this repository (https://github.com/tanzilli/playground/tree/master/python/spi) and modified it for Python3.  You can find the modified code at this repository (https://github.com/photonthunder/thunderLightning/tree/master/spidev).  Just put the three python files in the same folder and make sure they have proper permission (chmod 755 *.py).  To run the test just connect pin 11 and 12 together and run the python code and you should get the following:

# ./spisend.py  0x55 0xaa

Enjoy the hacking.


Installing Debian Jessie and Kernel 3.16 on SD card for SAMA5D3 XPLAINED board

I wanted to rewrite a previous post using Jessie instead of Wheezy.  I am running a Ubuntu 14 virtually on my apple laptop using parallels.

First make sure you have the necessary dependencies installed (there may be some I missed):

sudo apt-get update
sudo apt-get install vim git build-essential device-tree-compiler lzma lzop u-boot-tools libncurses5-dev:amd64 libncurses5:i386 libstdc++6:i386

Linux Kernel


Now we build the kernel, I am using the latest kernel build by Robert C Nelson and then modifying it to my needs, his wiki page is here.

Now make sure you are in the master directory where you will put all of your linux build.  I just called my master.  The following steps will clone Roberts' git repository, checkout a branch called tmp and build the kernel (this will take some time).

cd ~/master
git clone https://github.com/RobertCNelson/armv7_devel.git
cd armv7_devel/
git checkout origin/v3.16.x-sama5-armv7 -b tmp
./build_kernel.sh

As the linux kernel is built it will prompt for configuration options.  This first time just exit, we will come back and make changes in a later post.  When done change back to the master directory.

U-boot Compile


To compile U-boot so that it will work with the SAMA5D3 do the following (run this from your master folder).  This relies on the cross compiler built with the kernel script.  Probably a good time to mention that the numbers below will change as scripts are updating.  So if there is a problem running any part of this blog search the directory for the updated numbers.  For example, "find ${DIR}/armv7_devel/dl -name gcc-linaro-arm-linux-gnueabi*_linux -type d" will give you the path used by export CROSS_COMPILE below.


git clone git://git.denx.de/u-boot.git
cd u-boot/
git checkout v2014.07 -b tmp
wget -c https://raw.githubusercontent.com/eewiki/u-boot-patches/master/v2014.07/0001-sama5d3_xplained-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-sama5d3_xplained-uEnv.txt-bootz-n-fixes.patch
export CROSS_COMPILE=~/master/armv7_devel/dl/gcc-linaro-arm-linux-gnueabihf-4.9-2014.08_linux/bin/arm-linux-gnueabihf-
export ARCH=arm
make distclean
make sama5d3_xplained_mmc_config
make

You will need to create a uEnv.txt file that setups the environment and gives some initial instructions, these are specific to the build that follows
vim uEnv.txt
<insert the following>
#Enable systemd in Debian
optargs=quiet init=/lib/systemd/systemd
console=ttyS0,115200
mmcroot=/dev/mmcblk0p2 ro
mmcrootfstype=ext4 rootwait fixrtc
Finally, while in the u-boot directory you can create a MAC address for the board as referenced in this link.  This is not necessary since the board will create one at random.
tools/gen_eth_addr
XX:XX:XX:XX:XX:XX
The result will be a mac address you can use for testing.  If you want to get real ones for deployment check out this link.  Save this MAC address for use later in the install.

Now you are done compiling the Uboot files so back out of the u-boot directory (cd ..)

Root File System


First is to install all the necessary packages.

sudo apt-get install debootstrap
sudo apt-get install binfmt-support
sudo apt-get install qemu-user-static

With everything installed we can now start to create the root file system

mkdir armhf-root
cd armhf-root
sudo debootstrap --foreign --arch=armhf jessie .

This will take a while to download all basic packages.  The next steps setup the root file system so that you can run it as if you were on the SAMA5D3 XPLAINED board :

sudo cp /usr/bin/qemu-arm-static usr/bin
sudo LC_ALL=C LANGUAGE=C LANG=C chroot . /debootstrap/debootstrap --second-stage
sudo LC_ALL=C LANGUAGE=C LANG=C chroot . dpkg --configure -a

Now it is just a matter of making modifications and additions to meet your needs.  First lets add a password for root (all these commands are run from the armhf-root directory):

sudo chroot . passwd

setup the package repository (./etc/apt/sources.list) which will vary based on your needs:

deb http://ftp.us.debian.org/debian/ jessie main contrib non-free #deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free #deb-src http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free deb http://security.debian.org/ jessie/updates main contrib non-free #deb-src http://security.debian.org/ jessie/updates main contrib non-free #deb http://ftp.debian.org/debian jessie-backports main contrib non-free ##deb-src http://ftp.debian.org/debian jessie-backports main contrib non-free

and install some packages (these will be different depending on your needs):

LC_ALL=C LANGUAGE=C LANG=C chroot . apt-get update
LC_ALL=C LANGUAGE=C LANG=C chroot . apt-get install <package_name>

Some packages to add include locales, dialog, python3, python3-serial, python3-bson, vim, openssh-server, ntpdate, ppp, wvdial, usb-modeswitch, eject etc.

Then you can modify different files to fit your needs as well.  For example:
modify etc/fstab using the following:
sudo sh -c "echo '/dev/mmcblk0p2 / auto errors=remount-ro 0 1' >> etc/fstab"
sudo sh -c "echo '/dev/mmcblk0p1 /boot/uboot auto defaults 0 2' >> etc/fstab"
and modify etc/inittab using the following:
sudo sh -c "echo 'T0:23:respawn:/sbin/getty -L ttyS0 115200 vt102' >> etc/inittab"

Or modify the network interfaces:

sudo vim etc/network/interfaces

and add the following (the hwaddress portion is optional, the board will create one at random), use the MAC address created previously in the u-boot section:
allow-hotplug eth0
iface eth0 inet dhcp
hwaddress ether XX:XX:XX:XX:XX:XX
After this you can make other changes and modifications as needed, just remember to always use chroot . when calling an application.

when done remove qemu-arm-static so it doesn't cause problems when you copy over to the SD card.
sudo rm usr/bin/qemu-arm-static
After this you can make other changes and modifications as needed, just remember to always use chroot . when calling an application.

Create SD Card

With these three components we can now create an SD card for use with the SAMA5D3 Xplained.  So start with an SD card preferably with class 10 for better reliability.  My card is an 8 Gbyte SD card.  I  connected the SD card to my parallels Ubuntu.  You may wish to monitor dmesg to identify the SD card.  Mine was /dev/sdb.

The following commands clear the SD card and then setup the partitions on the SD card (one for boot and one for roots).  The sfdisk command will change the terminal prompt which should be expected just type in the last three lines.
export DISK=/dev/sdb
sudo dd if=/dev/zero of=${DISK} bs=1M count=16
sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0xE,*
,,,-
__EOF__
After that name the partitions as follows:
sudo mkfs.vfat -F 16 ${DISK}1 -n boot
sudo mkfs.ext4 ${DISK}2 -L rootfs
wait 10 seconds and then eject the SD card and reinsert it again.  On some systems it will mount automatically, ubuntu mounts both partitions at /media/username where username is the username of the current login user.  If it doesn't mount you can mount it yourself with the following:
sudo mkdir -p /media/<useranem>/boot/
sudo mkdir -p /media/<username>/rootfs/
sudo mount ${DISK}1 /media/<username>/boot/
sudo mount ${DISK}2 /media/<username>/rootfs/

Copy Files to SD Card


Now we want to copy everything over to our SD card.  Your location for these files may be different depending on where you placed them in your file system.
Check the file location before running these commands.  <username> below should be replaced with your username if using ubuntu or the whole path should be modified to match your settings.  I am running all these commands from my master folder that contains u-boot, armv7_devel, and armhf-root.

First we copy over the u-boot related files
sudo cp -v ./u-boot/spl/u-boot-spl.bin /media/<username>/boot/BOOT.BIN
sudo cp -v ./u-boot/u-boot.img /media/<username>/boot/
sudo cp -v ./u-boot/uEnv.txt /media/<username>/boot/
Now we copy over the root file system:
sudo rsync -axHAX --progress armhf-root/ /media/<username>/rootfs/
then we copy over the kernel image (zImage), the device tree files (dtbs), and any modules related files (the export kernel_version command should make it a little easier to update with a new build in the future).

export kernel_version=3.16.1-sama5-armv7-r6
sudo cp -v armv7_devel/deploy/${kernel_version}.zImage /media/<username>/boot/zImage
sudo mkdir -p /media/boot/dtbs/
sudo tar xvo -f armv7_devel/deploy/${kernel_version}-dtbs.tar.gz -C /media/<username>/boot/dtbs/
sudo tar xv -f armv7_devel/deploy/${kernel_version}-modules.tar.gz -C /media/<username>/rootfs/
After that just unmount the SD card with the following:
sync
sudo umount /media/<username>/boot
sudo umount /media/<username>/rootfs
And then remove the SD card, power down the SAMA5D3 Xplained and pull jumper JP5.  Then insert the SD card into the SAMA5D3 and power up.  Use a serial cable to connect to the SAMA5D3 board and watch it boot up.  Once it is up you may wish to get the modules up and running with the following command:
depmod -a

That was a very basic build and you will quickly want to make changes.  First things is to make your changes.  You can update u-boot, the linux kernel, or the root file system and then just copy over the new files to the SD card.  For the device tree files and the root files system you may wish to delete (remove) the files first before making the changes.  Just using sudo rm -r is a quick and dirty way to remove, if you are doing something for deployment you may wish to do a full clean of the partition as previously described in this post.