Thursday, April 21, 2011

My First PandaBoard

My PandaBoard is unboxed and ready to play work!

There is no installer (anaconda) for Fedora on ARM systems yet, so installation means downloading an image of the root filesystem and a kernel. The root filesystem is generic for all ARM (v5 and newer) systems so it does not include a kernel.

Download the root filesystem and kernel onto your host machine with an SD card reader.


Links from

Next, the filesystem and the kernel need to be copied to an SD(HC) card. The SD card should have a small FAT32 partition at the beginning to hold the kernel, and the rest of the card can be a regular Linux ext3 filesystem.

After inserting the SD card in the reader, I can see from the dmesg logs the
device name:
$ dmesg
[  277.436513] mmc0: new SDHC card at address 0007
[  277.536720] mmcblk0: mmc0:0007 SD08G 7.43 GiB
[  277.541804]  mmcblk0: p1

This script from will do the trick; many thanks to the folks in #pandaboard on freenode IRC for helping me get the SD card formatted correctly!



dd if=/dev/zero of=$DRIVE bs=1024 count=1024

SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`

echo DISK SIZE - $SIZE bytes

CYLINDERS=`echo $SIZE/255/63/512 | bc`


echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE

mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
mke2fs -j -L "rootfs" ${DRIVE}p2

NOTE: If your system shows the device as /dev/sda1 (or similar), then you will need to remove the 'p' from the last two lines, e.g.,
    mkfs.vfat -F 32 -n "boot" ${DRIVE}1

Format the device using the above script and then take a look at it with parted:
$ sudo ./ /dev/mmcblk0
$ sudo parted /dev/mmcblk0 print
Model: SD SD08G (sd/mmc)
Disk /dev/mmcblk0: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  74.0MB  74.0MB  primary  fat32        boot, lba
 2      74.0MB  7979MB  7904MB  primary  ext3

That looks better!

Okay, now I can extract the filesystem onto the SD card.  Mount the second partition onto a /mnt/panda-rootfs directory.
$ sudo mkdir /mnt/panda-rootfs
$ sudo mount /dev/mmcblk0p2 /mnt/panda-rootfs
$ cd /mnt/panda-rootfs && sudo tar xf ~/Download/arm-f13-beta2/rootfs-f13-beta-2011-03-23.tar.bz2

Finally, the kernel can be extracted into the first partition:
$ sudo mount /dev/mmcblk0p1 /mnt/panda-rootfs/boot
$ cd /mnt/panda-rootfs && sudo unzip ~/Download/arm-f13-beta2/kernel/pandaboard/
Archive:  ~/Download/arm-f13-beta2/kernel/pandaboard/
  inflating: boot/boot.scr          
  inflating: boot/MLO               
  inflating: boot/u-boot.bin        
  inflating: boot/uImage

A quick check to see that both partitions have some used space:
$ df -Th /mnt/panda-rootfs /mnt/panda-rootfs/boot
Filesystem    Type    Size  Used Avail Use% Mounted on
              ext3    7.3G  549M  6.4G   8% /mnt/panda-rootfs
              vfat    120M  2.8M  117M   3% /mnt/panda-rootfs/boot

There's a known bug with launching a getty on the PandaBoard.  For now, edit the /etc/rc.d/rc.local file and uncomment the "horrible hack":
$ sudo vim /mnt/panda-rootfs/etc/rc.d/rc.local
# horrible hack to respawn serial console
while true
                /sbin/agetty -L 115200 console vt100

Finally, unmount and remove the SD card and transfer it to the PandaBoard.
$ cd && sudo umount /mnt/panda-rootfs/boot && sudo umount /mnt/panda-rootfs && sudo sync

The PandaBoard is set up to use a serial console, so attach a serial cable (or a USB-to-serial cable with a Prolific PL2303 chip) and fire up minicom. I'm using a USB-to-serial cable, so I ran 'minicom -s' to configure it for /dev/ttyUSB0.  With minicom running, I finally attached the power cable to the PandaBoard and watched it boot.

Texas Instruments X-Loader 1.4.4ss (Mar  1 2011 - 23:55:13)
Reading boot sector
Loading u-boot.bin from mmc

U-Boot 2011.03-rc1 (Feb 09 2011 - 01:46:42)

CPU  : OMAP4430
Board: OMAP4 Panda
I2C:   ready
DRAM:  1 GiB
Using default environment

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
reading boot.scr


Fedora release 13 (Goddard)
Kernel 2.6.35-g6d019da-dirty on an armv7l (console)

fedora-arm login: root
Last login: Sat Jan  1 00:41:17 on console
[root@fedora-arm ~]# cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 2 (v7l)
processor       : 0
BogoMIPS        : 1195.29

processor       : 1
BogoMIPS        : 1166.88

Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x1
CPU part        : 0xc09
CPU revision    : 2

Hardware        : OMAP4430 Panda Board
Revision        : 0020
Serial          : 0000000000000000

It works!

Next up, networking...

No comments:

Post a Comment