2013.11.26 - taming panda

i'm with panda recently i bought pandaboard. pretty old, yet still quite nicely featured dual core 1.2GHz ARM A-9 with 1GB ram and SD card as a hard drive. since i spent quite some time running this thing i'd like to share my findings.

note that this manual can also be used as an howto on installation debian on pandaboard.

sanity checks

after unpacking and connecting the board it is worth while to check if it is working as expected. there is ready to go validation image prepared on the troubleshooting page. get it and write to SD card directly:

wget https://gforge.ti.com/gf/download/frsrelease/643/5076/validation-19102011.img
dd if=validation-19102011.img of=/dev/XXX

(/dev/XXX is your SD card)

panda's terminal is setup to 115200-8-N-1. to connect use gtkterm (or similar):

gtkterm -p /dev/ttyUSB0 -s 115200 

connect RS-232 (regular – panda uses max232 to do level converting for you) to usb adapter (directly), insert SD card and apply power. if everything works as expected, it should boot and on your terminal linux prompt should appear. this image allows testing of a board, but for the purposes of this manual it is enough to see the prompt.

use ready images

if it's possible, just use what's there. there are pre-built ubuntu and android images available. you can download them and write to SD card the same way you did with validation image. it given distribution works for you, you're home!

own (debian) installation

i was unlucky and my SD (SDHC, to be precise) card did not work properly with pre-shipped ubuntu kernel. kernel delivered with debian did not worked as well. the only option i was left with, was to go the hard way and compile everything from scratch.

pandaboard es, which i have, uses OMAP4460 (OMAP4). general boot sequence on OMAP4 is starting with the first partition of the SD card (needs to be a fat partition – sorry) and goes like this:

  1. start x-loader (“MLO” file) – this is a first boot stage, that initializes basic hardware.
  2. start u-boot (“u-boot.img” file) – this is a second boot stage, that loads and starts kernel, passes arguments, etc…
  3. boot kernel (“zImage” file)

following sections describe how to obtain, compile and install required elements on an SD card.

formatting card

since you already have written validation image on the card, first (fat) partition is fine. you only need to change the second one, to use full card space, and have no content. the shortest way is simply to re-create it and format. run:

fdisk /dev/XXX

and delete second partition, create new one in its place, taking whole disk space and quit while saving changes. now format both partitions:

mkdosfs /dev/XXX1
mkfs.ext3 /dev/XXX2

having them all in place, mount them for further processing:

mount /dev/XXX1 /media/usb1
mount /dev/XXX2 /media/usb2

installing debian

thanks to debootstap and qemu emulation in rootfs, installation of debian is dead simple! :D first install this wunderwaffe-set:

apt-get install debootstrap qemu-user-static

and then prepare filesystem. root privileges are required here.

debootstrap --foreign --arch=armhf testing /media/usb2 http://ftp.pl.debian.org/debian/
cp -v /usr/bin/qemu-arm-static /media/usb2/usr/bin/
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot /media/usb2 /debootstrap/debootstrap --second-stage

this finishes the basic installation, there are however few steps worth doing.

set root password to 'root':

sed -i 's#^root:.*#root:$6$D4IAlHGx$VyuhjuulSFUbc6DjehKZPw9Cn1ZyaNBJl9jOsuAeCY75LoodSNnSdK7DjImqBR6lk3WAalDYAm3oRCO3yILqV.:16030:0:99999:7:::#g' /media/usb2/etc/shadow

enable serial console:

cat >> "$D/etc/inittab" <<EOF
# PandaBoard serial console
s0:12345:respawn:/sbin/agetty -8 -s 115200 ttyO2 linux
EOF

setup basic network interfaces:

cat >> /media/usb2/etc/network/interfaces <<EOF
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
EOF

toolchain

if you have not done this yet, install ARM toolchain. the one from the emdebian work just fine:

cat >> /etc/apt/sources.list <<EOF
deb     http://www.emdebian.org/debian/ testing main
deb-src http://www.emdebian.org/debian/ testing main
deb     http://www.emdebian.org/debian/ stable  main
deb-src http://www.emdebian.org/debian/ stable  main
EOF
apt-get update
apt-get install gcc-4.7-arm-linux-gnueabi binutils-arm-linux-gnueabi

x-loader and u-boot

download latest stable Das U-Boot release package and build it, for panda board:

wget ftp://ftp.denx.de/pub/u-boot/u-boot-2013.10.tar.bz2
tar xjvf u-boot-2013.10.tar.bz2
cd u-boot-2013.10
make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm omap4_panda_config
make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm

you should now have the following files:

  1. MLO
  2. u-boot.bin
  3. u-boot.img

copy them to boot partition:

cp -v MLO u-boot.bin u-boot.img /media/usb1

kernel

this was the most tricky part for me and here exactly i've spent the most time. the problem is that most mainline kernels do NOT work properly with this device. this is very bad news and there is no easy way to fix that manually. in short – a proper set of kernel patches need to be applied to make it all work. otherwise you'll stuck with “Starting kernel…” message on the screen, and nothing will happen.

fortunately Robert Nelson prepared set of scripts that automate this all. the fast procedure to build reasonably-new-and-yet-known-to-be-working kernel, with all the required patches, follows:

git clone git://github.com/RobertCNelson/stable-kernel.git
cd stable-kernel
./build_kernel.sh
# you'll be asked to checkout kernel branch - choose the one you like
./build_kernel.sh

now in the deploy directory there will be a set of files, that you'll need to install to rootfs (modules and firmwares) and boot partition (kernel and DTBs). for start save absolute path to the deploy directory into a variable:

S=`pwd`/deploy

first rootfs:

cd /media/usb2
tar xzf $S/*-modules.tar.gz
cd lib/formware
tar xzf $S/*-firmware.tar.gz

note that some of the firmwares will override firmware delivered with modules. that's ok, since the files are binary identical.

now boot partition preparation:

cd /media/usb1
cp $S/*.zImage zImage
mkdir dtbs
cd dtbs
tar xzf $S/*-dtbs.tar.gz

having all binaries in place the time has come to create a boot script for u-boot:

cd /media/usb1
cat > boot_mmc.txt <<EOF
setenv bootargs 'root=/dev/mmcblk0p2 rw rootwait rootfstype=ext3 console=ttyO2,115200n8 vram=16M'
fatload mmc 0 82000000 zImage
bootz 82000000
EOF
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Panda SD Boot" -d boot_mmc.txt boot.scr

running

after doing all the operations unmount SD card:

mount /media/usb[12]

and put it into your pandaboard. when power is applied it should boot smoothly. since the serial console is constantly available, you can login via it (root:root).

system is up and running, so from this point it is just regular linux console you have and distribution you already know. a good place to start. :) there are few more packages and operation that are recommended.

first of all – install locales package for apt-get not to complain about missing settings:

apt-get install locales
dpkg-reconfigure locales

you probably should setup ssh access and add user to connect as:

adduser johndoe
apt-get install openssh-server

that's all folks! have fun! :)

blog/2013/11/26/taming_panda.txt · Last modified: 2021/06/15 20:09 by 127.0.0.1
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0