Emdebian image for SAMA5D3 Xplained

Flashing the SD Card using Windows:
openlogo-50

  1. Download the image from sd_sama5d3_xplained.zip
  2. Extract the image file from the downloaded .zip file
  3. Insert the SD card into your SD card reader and check what drive letter it was assigned.
  4. Download the Win32DiskImager utility
  5. Install or extract (depend on file type you chose) the executable from the zip file and run the Win32DiskImager utility
  6. Select the image file you extracted above.
  7. Select the drive letter of the SD card in the device box. Be careful to select the correct drive; if you get the wrong one you can destroy your data on the computer’s hard disk!
    win32 Disk Imager
  8. Click Write and wait for the write to complete.
  9. Exit the imager and eject the SD card
  10. Power off SAMA5D3 Xplained board
  11. Insert SD cart into SAMA5D3 Xplained board SD card socket
  12. Power on SAMA5D3 Xplained board

Root login:
Username: root
Password: root
User login:
Username: xplained
Password: xplained

boot

 


Please donate to support this blog:
Donate

Building Embedded Debian Linux bootable SD card for SAMA5D3 Xplained

This article illustrates how to build an   Embedded  Debian Linux bootable SD card for SAMA5D3 Xplained  board.

openlogo-50
Requirements:

  •  Linux PC (tested on Lubuntu 13.10 installed in VirtualBox)
  • ARM cross toolchain
  • AT91Bootstrap for SC card
  • Linux Kernel +  Device Tree
  • 4GB+ SD Card and  SAMA5D3 Xplained to test

1. Cross toolchain

You could build cross toolchain using buildroot or simply install:

$sudo apt-get install emdebian-archive-keyring
$sudo apt-get install libc6-armel-cross libc6-dev-armel-cross
$sudo apt-get install binutils-arm-linux-gnueabi
$sudo apt-get install gcc-arm-linux-gnueabi
$sudo apt-get install g++-arm-linux-gnueabi
$sudo apt-get install u-boot-tools
$sudo apt-get install libncurses5-dev

You could also use gnueabihf:

$sudo apt-get install gcc-arm-linux-gnueabihf
$sudo apt-get install g++-arm-linux-gnueabihf

2. AT91Bootstrap

more details

$git clone git://github.com/linux4sam/at91bootstrap.git
$cd at91bootstrap/
$make mrproper
$make sama5d3_xplainedsd_linux_zimage_dt_defconfig
$#make menuconfig #if you want to change something
$make CROSS_COMPILE=arm-linux-gnueabi-
$cd ..

3.Kernel

Get kernel source and compile details

$git clone git://github.com/linux4sam/linux-at91.git
$cd linux-at91/
$ls arch/arm/configs/+(at91|sam)*
$make ARCH=arm sama5d3_xplained_defconfig
$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage
$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs
$make modules ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
$make modules_install INSTALL_MOD_PATH=./modules ARCH=arm
$cd ..

4.Build an Embedded Debian root filesystem

Install tools:

sudo apt-get install multistrap
sudo apt-get install qemu
sudo apt-get install qemu-user-static
sudo apt-get install binfmt-support
sudo apt-get install dpkg-cross

Then:

$mkdir emdebian
$cd emdebian

Create file multistrap.conf and paste this inside:



[General]
arch=armhf
directory=target-rootfs
cleanup=true
noauth=true
unpack=true
debootstrap=Emdebian Net Utils Php Python
aptsources=Emdebian


[Emdebian]
packages=apt
source=http://www.emdebian.org/grip
keyring=emdebian-archive-keyring
suite=wheezy-grip


[Net]
#Basic packages to enable the networking
packages=netbase net-tools ethtool udev iproute iputils-ping ifupdown isc-dhcp-client ssh
source=http://www.emdebian.org/grip


[Utils]
#General purpose utilities
packages=locales adduser nano less wget vim rsyslog dialog sudo
source=http://www.emdebian.org/grip


[Php]
packages=php5-cgi lighttpd
source=http://ftp.debian.org/debian
suite=wheezy


#Python language
[Python]
packages=python python-serial
source=http://www.emdebian.org/grip


then run:

$sudo multistrap -f multistrap.conf
$sudo cp /usr/bin/qemu-arm-static target-rootfs/usr/bin
$sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs dpkg --configure -a

Create file fsupdate.sh



#!/bin/sh
TARGET_ROOTFS_DIR="target-rootfs"


#Directories used to mount some SD card partitions
echo "Create mount directories"
mkdir $TARGET_ROOTFS_DIR/media/kernel


#Set the target board hostname
filename=$TARGET_ROOTFS_DIR/etc/hostname
echo Creating $filename
echo SAMA5D3_Xplained > $filename


#Set the default name server
filename=$TARGET_ROOTFS_DIR/etc/resolv.conf
echo Creating $filename
echo nameserver 8.8.4.4 > $filename
echo nameserver 8.8.8.8 >> $filename


#Set the default network interfaces
filename=$TARGET_ROOTFS_DIR/etc/network/interfaces
echo Updating $filename
echo allow-hotplug eth0 >> $filename
echo iface eth0 inet dhcp >> $filename


#Set the eth0 interface MAC address
echo hwaddress ether 12:34:56:78:90:12 >> $filename


#Set a terminal to the debug port
filename=$TARGET_ROOTFS_DIR/etc/inittab
echo Updating $filename
echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> $filename


#Set how to mount the SD partitions
filename=$TARGET_ROOTFS_DIR/etc/fstab
echo Creating $filename
echo /dev/mmcblk0p1 /media/mmc_p1 vfat noatime 0 1 > $filename
echo /dev/mmcblk0p2 / ext4 noatime 0 1 >> $filename
echo proc /proc proc defaults 0 0 >> $filename


#Add the standard Debian repositories.
filename=$TARGET_ROOTFS_DIR/etc/apt/sources.list
echo Creating $filename
echo deb http://ftp.uk.debian.org/debian wheezy main > $filename
echo deb http://security.debian.org/ wheezy/updates main >> $filename


Then run and enter root password:

$sudo chmod +x fsupdate.sh
$sudo ./fsupdate.sh
$sudo chroot target-rootfs passwd

4. Format SD 

details are here

Run: System -> Administration -> Gparted

  • select sd card device /dev/sdb or similar (It is very important to select correct device!!!)
  • unmount
  • delete
  • new partition:
    • New size: 64MB
    • File system: FAT16
    • Label: kernel
  • newnev partition:
    • Leave size default
    • File system: EXT4
    • Label: rootfs
  • Apply changes
  • Close program GParted

Remove SD card from computer, wait 5 seconds and insert again.

SD card should be mounted as:

/media/$USER/KERNEL
/media/$USER/rootfs

where $USER will be replaced with your user name.
Copy Kernel AT91Bootstrap and Device tree file to SD card:

cp at91bootstrap/binaries/sama5d3_xplained-sdcardboot-linux-zimage-dt-3.6.2.bin /media/$USER/kernel/BOOT.BIN
cp linux-at91/arch/arm/boot/at91-sama5d3_xplained.dtb /media/$USER/kernel/
cp linux-at91/arch/arm/boot/zImage /media/$USER/kernel/

Copy root filesystem and kernel modules to SD card:

sudo rsync -axHAX --progress embedian/target-rootfs/ /media/$USER/rootfs/
sudo rsync -avc linux-at91/modules/lib/. /media/$USER/rootfs/lib/.
sync

Unmount SD card and remove from PC and inset into SAMA5D3 Xplained.
There ia also prebuild SD card image.

References:

 


Please donate to support this blog:
Donate