BeagleBoardDebian

From eLinux.org
Revision as of 02:55, 10 May 2010 by Trevj (talk | contribs) (Recommended Beagle Software: typo)
Jump to: navigation, search

This page is about running a (ARM EABI) Debian distribution at BeagleBoard. BeagleBoard will boot the (ARM EABI) Debian distribution from SD card. Debian's NetInstall will be used to install Debian onto your Beagle.

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:

  • 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

Debian NetInstall

Development PC: Format SD Card

Planning to remove this section, pending Squeeze's Release...

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

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

sudo 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

sudo 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:

sudo 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.

Debian Squeeze

(Testing Release Summer 2010?)

Note: Squeeze hasn't been released, so if you get an error, retry in a couple hours..

https://code.launchpad.net/~beagleboard-kernel/+junk/debian-di

bzr branch lp:~beagleboard-kernel/+junk/debian-di
cd debian-di
./mk_mmc.sh --mmc /dev/sdX --distro squeeze --firmware
  • Options:
    • --distro : squeeze, lucid
    • --firmware : installs firmware
    • --serial-mode : debian-installer uses Serial Port

Note: The default options work for most people, but if you'd like to tweak boot settings, edit these before running the script.

NetInstall boot Settings:
gedit ./debian-di/scripts/dvi.cmd
gedit ./debian-di/scripts/serial.cmd

Normal Boot Settings:
gedit ./debian-di/scripts/dvi-normal-squeeze.cmd
gedit ./debian-di/scripts/serial-normal-squeeze.cmd

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.

usb0 howto

There's a lot of question on irc about this, it might make sense to add a wiki page going thru with linux/winxp etc.. --RobertCNelson 00:55, 23 April 2010 (UTC)

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? : <yes>
Partition disks: This partitioner doesn't have the inform.....? : <yes>
 Logical Volume Manager not available: <Continue>
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? : <yes>
No installable kernel was found in the defined APT sources? : 
 Continue without installing a kernel? : <yes>
Standard System
No BootLoader: <ok>

Development PC: Setup U-boot for Normal Boot

Planning to remove this section, pending Squeeze's Release... I moved the relevant data to: http://elinux.org/BeagleBoardDebian#U-boot_Scripts

Create a U-boot normal boot script:

DVI Port
sudo 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
sudo 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'
boot

Create U-boot *.scr file:

sudo 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.

Beagleboard: Install Latest Kernel

Script File:

Lenny:
wget http://rcn-ee.net/deb/kernel/beagle/lenny/v2.6.32.11-x13/install-me.sh
sudo /bin/bash install-me.sh

Squeeze:
wget http://rcn-ee.net/deb/kernel/beagle/squeeze/v2.6.32.11-x13/install-me.sh
sudo /bin/bash install-me.sh

Reboot with your new Kernel

Debian Configuration

U-boot Scripts

Create a U-boot normal boot script:

DVI Port
sudo 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
sudo 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'
boot

Create U-boot *.scr file:

sudo 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.

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.

SGX Video Acceleration

Use a "corporate email" and download the latest (3.01.00.02):

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/latest/index_FDS.html

Kernel Modules

Use the "build_sgx_module.sh" script in 2.6-stable, module source is now in the *.bin

https://code.launchpad.net/~beagleboard-kernel/+junk/2.6-stable

Copy the *.uImage and extract the matching *.modules.tar.gz from the deploy directory to your SD card.

Copy the GFX_Linux_SDK.tar.gz examples to either your SD card or another media (large file) then boot your omap board.

Run depmod:

sudo depmod -a omaplfb

Tweak 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

Startup Script

For 3.01.00.02

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

Contents of S60pvr.sh/pvr

#!/bin/sh

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

Test SGX with a DEMO

In GFX_Linux_SDK:

cd OGLES/SDKPackage/Binaries/CommonX11/Demos/ChameleonMan
./OGLESChameleonMan

Trouble Shooting

sudo rm /etc/powervr-esrev
sudo depmod -a omaplfb
sudo /etc/init.d/pvr restart

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