BeagleBoardDebian

This page is about running a (ARM EABI) Debian distribution at BeagleBoard. BeagleBoard will boot the (ARM EABI) Debian distribution from SD card. To prepare the SD card and install (ARM EABI) Debian on it, QEMU on host PC will be used, following Aurélien Jarno's excellent Debian on an emulated ARM machine howto.

Note: Debian armel deb's are compiled for armv4t, this allows debian to support a larger number of arm devices with a single port, at only the sacrifice of speed.

= Help =

If you need any help:


 * Kernel related help:
 * #beagle: Beagle irc on freenode, accessible also by web interface (logs)
 * Email beagleboard user groups
 * Launchpad Project "Beagleboard Kernel"
 * Launchpad Stable Kernel 2.6.31 src
 * Launchpad Development Kernel 2.6.32 src
 * Launchpad Kernel git src
 * Launchpad Kernel for Ubuntu Lucid (10.04)
 * trac/svn interface for the kernel builds


 * When asking for help, please provide some debugging information:
 * U-Boot Version installed on board
 * Kernel Version: uname -a
 * pastebin dmesg
 * Copy from serial port or use "dmesg | pastebinit" (sudo apt-get install pastebinit)

= Recommended Beagle Software =
 * Recent x-loader/MLO
 * Rev C2/3/4 Boards are fine and do not need an upgrade
 * Old Rev Bx Boards should upgrade there MLO from here: http://www.angstrom-distribution.org/beagleboard-demo-image-available


 * Recent U-Boot with 'boot.scr' scripts enabled
 * u-boot.bin from here: http://www.angstrom-distribution.org/beagleboard-demo-image-available
 * Or this one I've archived: U-Boot 2009.08+r37 Upgrade
 * Version 2009.01 (factory installed on C2/3's) and earlier will not work with this guide
 * Version 200X.XX (factory installed on C4's) works fine with this guide

= Native Net Install =

Development PC: Format SD Card
You will need a 1GB SD card or greater. Standard System : ~455MB + Desktop environment (GNOME) : ~2.9GB

Starting with an empty SD card and using gparted, create: 50 MiB Primary Partition, fat32 Leave remaining space for the Debian-Installer

Development PC: Setup SD U-boot Partition
Mount your SD card fat32 partition. (/media/disk/)

Debian Lenny Stable cd /media/disk/ sudo wget http://rcn-ee.net/deb/kernel/CC-beagle-v2.6.29-58cf2f1-oer44.1.uImage sudo wget http://ftp.debian.org/debian/dists/lenny/main/installer-armel/current/images/versatile/netboot/initrd.gz sudo mv CC-beagle-v2.6.29-58cf2f1-oer44.1.uImage uImage sudo gzip -d initrd.gz sudo dd if=initrd of=initrd.pad ibs=8388608 conv=sync

Create U-boot boot script for netinstall:

Debian Install over DVI Port nano netinstall.cmd setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 0x81600000 initrd.pad; bootm 0x80300000' setenv bootargs 'console=tty0 ramdisk_size=8192 root=/dev/ram0 rw rootfstype=ext2 initrd=0x81600000,8M omapfb.mode=dvi:1280x720MR-16@60' boot

Debian Install over the Serial Port nano netinstall.cmd setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 0x81600000 initrd.pad; bootm 0x80300000' setenv bootargs 'console=ttyS2,115200n8 ramdisk_size=8192 root=/dev/ram0 rw rootfstype=ext2 initrd=0x81600000,8M' boot

Create U-boot *.scr file:

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Debian Lenny" -d ./netinstall.cmd ./boot.scr

Sync and Unmount your mmc card and boot the beagle, it should find the 'boot.scr' file on your first partition while booting.

Beagleboard: netinstall
Choose a language C - No localization English - English

Configure the network: usb0: USB net <- See below for 2.6.29. Could not find usb0 with B7 installing 2.6.28. eth0: Ethernet <- Your usb-ethernet device wlan0: Wifi <- Your usb-wifi device.. See BeagleBoardDebianWifiInstallInfo for my hack to set it up.

Configuring usb0 network bridge for 2.6.29: While you chose your keyboard layout, setup a bridge with ethX and usbX. # ifconfig ethX 0.0.0.0 # ifconfig usbX 0.0.0.0 # brctl addbr brX # brctl addif brX ethX # brctl addif brX usbX # ifconfig brX up  # dhclient brX *Sometimes the first beagle DHCP will fail(probably due PC trying autoconnect), just run the auto configuration again and it will configure it right.

Continue the install without loading kernel modules? :

Partition disks: This partitioner doesn't have the inform.....? :  Logical Volume Manager not available: 

Partition disks: Guided - Use the largest continuous free space

Partitioning scheme....

Example: MMC/SD card #1 (mmcblk0) - 2.0 GB Unknown > #1 primary  57.5 MB     fat32 > #2 primary   1.8 GB B f ext3  / > #5 logical 148.0 MB   f swap  swap Finish partitioning and write changes to disk Write the changes to disk? :

No installable kernel was found in the defined APT sources? :  Continue without installing a kernel? :

Standard System

No BootLoader: 

Development PC: Setup U-boot for Normal Boot
Create a U-boot normal boot script:

DVI Port nano normal.cmd setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000' setenv bootargs 'console=tty0 root=/dev/mmcblk0p2 rootwait rootfstype=ext3 ro omapfb.mode=dvi:1280x720MR-16@60' boot

Serial Port nano normal.cmd setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000' setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait rootfstype=ext3 ro'

Create U-boot *.scr file:

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Debian Lenny" -d ./normal.cmd ./boot.scr

Debian will fix the ext3 partition, it'll try to reboot, after halting remove and reapply power.

Script File
Every Kernel upload going further on rcn-ee.net will now have an 'install-me.sh' file in the same directory..

example: http://www.rcn-ee.net/deb/kernel/beagle/lenny/v2.6.31.6-x6.0/ wget http://rcn-ee.net/deb/kernel/beagle/lenny/v2.6.31.6-x6.0/install-me.sh sudo /bin/bash install-me.sh

Note: vmlinuz symbolic link (yes  no)...

Reboot with your new uImage

= Debian Configuration =

Serial Ports
Lenny

edit /etc/inittab and add: S:2345:respawn:/sbin/getty 115200 ttyS2

For root access over the serial port add ttyS2 to /etc/securetty

WiFi
See BeagleBoard Debian WiFi install info.

Kernel Modules
The 'install-me.sh' script will download and install these, however make sure to issue this command to update the omaplfb modules.

sudo depmod -a omaplfb

SDK
Make sure to use a "corporate email" : http://software-dl.ti.com/dsps/forms/export.html?prod_no=/OMAP35x_Graphics_SDK_setuplinux_3_00_00_09.bin

Note: the SDK will not extract directly on any arm platform, extract it first on an x86 machine and tar the resulting folder before transferring to the beagleboard.

System Libraries: sudo ln -sf /usr/lib/libXdmcp.so.6.0.0 /usr/lib/libXdmcp.so.0 sudo ln -sf /usr/lib/libXau.so.6.0.0 /usr/lib/libXau.so.0

SDK install lib/bin from 3.00.00.09: sudo mkdir /usr/lib/ES2.0 sudo mkdir /usr/bin/ES2.0 sudo mkdir /usr/lib/ES3.0 sudo mkdir /usr/bin/ES3.0 sudo cp SDK_EXT_DIR/gfx_rel_es2.x/lib* /usr/lib/ES2.0 sudo cp SDK_EXT_DIR/gfx_rel_es2.x/p[dv]* /usr/bin/ES2.0 sudo cp SDK_EXT_DIR/gfx_rel/lib* /usr/lib/ES3.0 sudo cp SDK_EXT_DIR/gfx_rel/p[dv]* /usr/bin/ES3.0

Startup Script
For 3.00.00.09

Lenny: sudo nano /etc/rcS.d/S60pvr.sh sudo chmod +x /etc/rcS.d/S60pvr.sh

Squeeze: (probally lenny too) sudo nano /etc/init.d/pvr sudo chmod +x /etc/init.d/pvr sudo update-rc.d pvr defaults

if [ "$1" = "" ]; then echo PVR-INIT: Please use start, stop, or restart. exit 1 fi if [ "$1" = "stop" -o "$1" = "restart" ]; then echo Stopping PVR rmmod omaplfb 2>/dev/null rmmod pvrsrvkm 2>/dev/null fi if [ "$1" = "stop" ]; then exit 0 fi echo Starting PVR modprobe omaplfb pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3` if [ -e /dev/pvrsrvkm ] ; then rm -f /dev/pvrsrvkm fi mknod /dev/pvrsrvkm c $pvr_maj 0 chmod 666 /dev/pvrsrvkm touch /etc/powervr-esrev SAVED_ESREVISION="$(cat /etc/powervr-esrev)" ES_REVISION="$(cat /proc/cpuinfo | grep "CPU revision" | awk -F: '{print $2}')" if [ "${ES_REVISION}" != "${SAVED_ESREVISION}" ] ; then echo -n "Starting SGX fixup for" if [ "${ES_REVISION}" = " 3" ] ; then echo " ES3.x" 	cp -a /usr/lib/ES3.0/* /usr/lib cp -a /usr/bin/ES3.0/* /usr/bin else echo " ES2.x" 	cp -a /usr/lib/ES2.0/* /usr/lib cp -a /usr/bin/ES2.0/* /usr/bin fi echo "${ES_REVISION}" > /etc/powervr-esrev fi /usr/bin/pvrsrvinit
 * 1) !/bin/sh

Xorg omapfb Drivers
By default Debian will try* to use the FBDEV video driver, however for the beagleboard we can take advantage of a more software optimized driver (still not using the sgx video hardware) using the NEON extensions of the Cortex-A8 core.

Lenny might need this xorg.conf, but it's best to use omapfb later in this guide..

/etc/X11/xorg.conf: Section "Device" Identifier	"Configured Video Device" Option		"UseFBDev"		"true" Driver		"fbdev" EndSection

cat /var/log/Xorg.0.log | grep FBDEV (II) FBDEV: driver for framebuffer: fbdev (II) FBDEV(0): using default device (II) FBDEV(0): Creating default Display subsection in Screen section (==) FBDEV(0): Depth 16, (==) framebuffer bpp 16 (==) FBDEV(0): RGB weight 565

Login into Debian and open a new terminal, xorg has to be running..

xvinfo -display :0.0 X-Video Extension version 2.2 screen #0 no adaptors present

Drivers
Note: These are built with neon optimizations: http://git.debian.org/?p=collab-maint/xf86-video-omapfb.git;a=blob;f=debian/rules;h=c2f0d5391c96c5abb60b1e691ad86bb27e0c17d8;hb=HEAD (line 48/49)

Lenny: wget -c http://rcn-ee.homeip.net:81/dl/deb-sbuild/lenny/xorg-drivers/xserver-xorg-video-omap3_0.1.1-2_armel.deb sudo dpkg -i xserver-xorg-video-omap3_0.1.1-2_armel.deb

Squeeze/Sid: sudo apt-get install xserver-xorg-video-omap3

xorg.conf
/etc/X11/xorg.conf

Section "Monitor" Identifier "Configured Monitor" EndSection Section "Screen" Identifier "Default Screen" Device "Configured Video Device" #Limited by SGX? DefaultDepth 16 EndSection Section "Device" Identifier "Configured Video Device" Driver "omapfb" Option "fb" "/dev/fb0" EndSection

To verify it was correctly installed, reboot and:

cat /var/log/Xorg.0.log | grep omapfb (II) LoadModule: "omapfb" (II) Loading /usr/lib/xorg/modules/drivers//omapfb_drv.so (II) Module omapfb: vendor="X.Org Foundation" (II) omapfb: Driver for OMAP framebuffer (omapfb) and external LCD controllers: (WW) Error opening /sys/devices/platform/omapfb/ctrl/name: No such file or directory (II) omapfb(0): VideoRAM: 1800KiB (SDRAM) (II) omapfb(0): Creating default Display subsection in Screen section (**) omapfb(0): Depth 16, (--) framebuffer bpp 16 (==) omapfb(0): RGB weight 565 (==) omapfb(0): Default visual is TrueColor (--) omapfb(0): Virtual size is 1280x720 (pitch 1280) (**) omapfb(0): Built-in mode "current" (==) omapfb(0): DPI set to (96, 96) (II) omapfb(0): DPMS enabled (II) omapfb(0): Video plane capabilities: (II) omapfb(0): Video plane supports the following image formats: (II) omapfb(0): XVideo extension initialized

Login into Debian and open a new terminal, xorg has to be running..

xvinfo -display :0.0 X-Video Extension version 2.2 screen #0 Adaptor #0: "OMAP XV adaptor" number of ports: 1 port base: 56 operations supported: PutImage supported visuals: depth 16, visualID 0x21 number of attributes: 1 etc..

DSP
= Kernel Build =

https://launchpad.net/~beagleboard-kernel

Register on launchpad.net, install bzr sudo apt-get install bzr

Download SRC bzr branch lp:~beagleboard-kernel/+junk/2.6-stable bzr branch lp:~beagleboard-kernel/+junk/2.6-dev

Build Kernel . build_kernel.sh

Build SGX Modules . build_sgx_modules.sh

Build Deb File . build_deb.sh

= QEMU install method via debian-installer (emulated arm core via Desktop PC)=


 * Planning to drop this section for squeeze, it's slow and ubuntu's rootstock can replace it**

This methods lasted 4 hours on a PC Ubuntu/Lenny (P4 2GHz) with an external USB2.0 card reader. Install QEMU on your host PC. This assumes that your host PC is running Debian as well. If not, install QEMU the way your host PC distribution uses. apt-get install qemu Note: If your debian armel image crashes while fscking the partition, rebuild qemu from trunk.

Development PC: Format SD Card
You will need a 1GB SD card or greater, depending on the installation chosen : Standard System (without graphical environment) : ~455MB + Desktop environment (GNOME) : ~2.3GB Please note that installer download all packages before installing them, that's why you'll need more space disk.

Starting with an empty SD card and using gparted/fdisk, create: 50 MiB Primary Partition, fat32 Leave remaining space for the Debian-Installer

Development PC: Preparation
Create a working directory to keep your files organized.

mkdir debian-armel cd debian-armel/ wget ftp://ftp.us.debian.org/debian/dists/lenny/main/installer-armel/current/images/versatile/netboot/initrd.gz wget ftp://ftp.us.debian.org/debian/dists/lenny/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.26-2-versatile

Development PC: Install Debian in QEMU
Quick Note: Debian Lenny is undergoing Beta/RC testing so these debian installers are currently way out of date, so it will tell you their are unavailable kernel modules, just ignore the question and continue. These modules will be provided later, with the provided linux-image deb.

To install (ARM EABI) Debian inside QEMU:

sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.26-2-versatile -initrd initrd.gz -m 256 -hda /dev/sdX -append "root=/dev/ram mem=256M" Note: root/sudo access is required to access /dev/sdX directly (verify mmc card with fdisk -l)

Partition disks, default settings should work for most: Guided - use the largest continuous free space



Development PC: Running Debian in QEMU (Optional)
Note: This section is only useful for people with out a usb-network device for their beagle who would like to install additional applications, otherwise just skip to the next subsection to install your linux-kernel by copying files from your desktop pc to a SD card. As ext3 filesystem support is not included in kernel you will need an initrd, just copy the one installed in the SD card in /boot.

sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.26-2-versatile -initrd initrd.img-2.6.26-2-versatile -m 256 -hda /dev/sdX -append "root=/dev/sda2 mem=256M"

Note: Time will be incorrect.

sudo apt-get install ntpdate ntpdate pool.ntp.org

Install default deb packages for linux-image.

Stable 2.6.29 wget http://rcn-ee.net/deb/kernel/beagle/lenny/v2.6.29-58cf2f1-oer44.1/linux-image-2.6.29-oer44.1_1.0lenny_armel.deb sudo dpkg -i *.deb

Note: It's easier to download these straight to the sd card after you've mounted the SD card to copy uImage to the FAT partition.

Development PC: Linux Kernel Preparation
Install uboot-mkimage utility sudo apt-get install uboot-mkimage

Remount SD card, Ubuntu remounts SD card like this: /media/vfat/ /media/debian/

Download Kernel-Image cd /media/debian/home/ / wget http://rcn-ee.net/deb/kernel/beagle/lenny/v2.6.29-58cf2f1-oer44.1/linux-image-2.6.29-oer44.1_1.0lenny_armel.deb

Extract linux-image's vmlinuz-* dpkg -x linux-image* ./temp

Build uboot compatible image and copy to /media/disk/ mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux" -d ./temp/boot/vmlinuz-* /media/vfat/uImage

Clean up rm -rfd temp

Sync, umount Partitions and Install sd card in beagleboard

Beagleboard: Setup U-boot for boot
Insert SD Card and power up Beagleboard.

Using a terminal program, stop u-boot and add these commands:

For Linux Kernel 2.6.29 and higher using DSS2 setenv bootcmd 'mmcinit; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000' or setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000' DVI Port setenv bootargs 'console=tty0 root=/dev/mmcblk0p2 rootwait rootfstype=ext3 ro omapfb.mode=dvi:1280x720MR-16@60' Serial Port setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait rootfstype=ext3 ro' saveenv boot

You shall adapt the resolution to you screen as following : omapfb.mode=dvi:1280x720MR-24@60 Modes: "1024x768MR-24@60""800x600-MR24@60" ...

Here is more explanation on dss video options :

The Beagleboard will reboot 3-4 times while the ext3 filesystem is repaired. (may have to remove power etc)

Debian on Beagleboard
Debian on BeagleBoard uses the following configuration:


 * Console log = Serial Terminal
 * User Console = HDMI port + usb (keyboard, mouse, etc).

If you want to log in with the serial port, you will have to add to /etc/inittab S:2345:respawn:/sbin/getty 115200 ttyS2

And if you want to log in as root on the serial port, add ttyS2 to /etc/securetty.

Note : the beagle board I have was not configured as USB host. I had to modify it to be able to use mouse and keyboards (see ). I you do not want to do this, you'll have to install a Vnc server on the beagle to access desktop.

Current Issues
date +"%m%d%y%H%M" -s MMDDYYHHMM
 * 1) Swap disabled: change /dev/hda5 -> /dev/mmcblk0p5 in /etc/fstab (artifact of qemu install to /dev/hdaX)
 * 2) RTC seems to be not enabled: use ntpdate when ethernet works, or issue