Difference between revisions of "BeagleBoardDebian"

From eLinux.org
Jump to: navigation, search
(updated SD Card Section)
m (updated preparation and install debian sections)
Line 72: Line 72:
 
==Preparation==
 
==Preparation==
  
To stay organized create working directory.
+
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/initrd.gz
 
  wget ftp://ftp.us.debian.org/debian/dists/lenny/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.24-1-versatile
 
  wget ftp://ftp.us.debian.org/debian/dists/lenny/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.24-1-versatile
 
  
 
==Install Debian==
 
==Install Debian==
Line 82: Line 83:
 
To install (ARM EABI) Debian inside QEMU:
 
To install (ARM EABI) Debian inside QEMU:
  
  sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.24-1-versatile -initrd initrd.gz -m 256 -hda /dev/sde -append "root=/dev/ram mem=256M"
+
  sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.24-1-versatile -initrd initrd.gz -m 256 -hda /dev/sdX -append "root=/dev/ram mem=256M"
Note: sudo access is required to access /dev/sde directly.
+
Note: root/sudo access is required to access /dev/sde directly & verify /dev/sdX with fdisk -l
  
 
==Running Debian==
 
==Running Debian==

Revision as of 14:50, 23 August 2008


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.

QEMU

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.

Format SD Card

You will need a 1GB SD card or greater.

Base Install : ~455MB
Default Gnome : ~MB

Currently (Aug 15, 2008) ext2load doesn't seem to work in the current u-boot beagle board git repo. For the moment follow the LinuxBootDisk guide to setup a 50-100MB FAT partition on your SD Card to use u-boot's fatload.

Using fdisk and dosfstools on your SD card "/dev/sdX" or use fdisk -l to find device name.

fdisk /dev/sdX

Delete all partitions and create a new 50MB FAT partition for uImage

Disk /dev/sdX: 2038 MB, 2038431744 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008e471

  Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-247, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 247): +50M

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): a
Partition number (1-4): 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

Format the 1st partition with dosfstools

 mkfs.msdos -F 32 /dev/sdX1

For reference, a 2GB sd card will look like this:

Disk /dev/sdb: 2038 MB, 2038431744 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008e471

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1           7       56196    c  W95 FAT32 (LBA)

NOTE: For some reason, on my 256 MB SD card, I had to have End >= 5 AND odd for /dev/sde1 (ie. 6 did not work)

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.24-1-versatile

Install Debian

To install (ARM EABI) Debian inside QEMU:

sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.24-1-versatile -initrd initrd.gz -m 256 -hda /dev/sdX -append "root=/dev/ram mem=256M"

Note: root/sudo access is required to access /dev/sde directly & verify /dev/sdX with fdisk -l

Running Debian

sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.24-1-versatile -m 256 -hda /dev/sde -append "root=/dev/sda2 mem=256M"

Note: Time will be incorrect.

login as root, change password
apt-get install ntpdate
ntpdate pool.ntp.org
reboot.. relogin change password...

Install default deb packages for linux-image & linux-headers

wget ..(currently building, but not needed as long as you build in the modules you need into your uImage.)

Stop QEMU and remount SD card to copy uImage to FAT partition:

cd /media/disk-1/
wget http://www.rcn-ee.com/code/beagle/debian/lenny/Linux-2.6.22.18-omap3/gcc-4.2/uImage

Beagleboard

Insert SD Card and power up Beagleboard.

Boot

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

setenv bootcmd 'mmcinit; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000'
setenv bootargs 'console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 rootfstype=ext3 rw rootdelay=5 nohz=off'
boot

To force the Beagleboard to always boot the sd card image:

setenv bootcmd 'mmcinit; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000'
setenv bootargs 'console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 rootfstype=ext3 rw rootdelay=5 nohz=off'
saveenv
boot

Note: 'rootwait' only works with newer kernels, for 2.6.22.18-omap3 use 'rootdelay=5', otherwise this error:

VFS: Cannot open root device "mmcblk0p2" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00        512 mtdblock01f00        512 mtdblock0 (driver?)
1f01       1920 mtdblock11f01       1920 mtdblock1 (driver?)
1f02        128 mtdblock21f02        128 mtdblock2 (driver?)
1f03       5120 mtdblock31f03       5120 mtdblock3 (driver?)
1f04     254464 mtdblock41f04     254464 mtdblock4 (driver?)


Debian on Beagleboard

Debian on BeagleBoard uses the following configuration:

  • Console log = Serial Terminal
  • User Console = HDMI port + usb (keyboard,etc)

Current Issues

  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 date MMDDHHMMYYYY

Building a Native Debian Kernel with QEMU

Install Dependencies

apt-get install git-core kernel-package fakeroot build-essential curl libncurses-dev

u-boot

wget -nc http://beagleboard.googlecode.com/files/u-boot_beagle_revb.tar.gz
tar -xf u-boot_beagle_revb.tar.gz
cd u-boot/
make CROSS_COMPILE= distclean
make CROSS_COMPILE= omap3530beagle_config
make CROSS_COMPILE= 

Note: this should eventually error out. The goal isn't to build a native u-boot but just the u-boot's 'mkimage' such that a u-boot compatible uImage can be build later.

Add /tools/ to $PATH

PATH=/home/<user>/u-boot/tools:"${PATH}"

Linux Kernel

wget -nc http://www.beagleboard.org/uploads/2.6_kernel_revb-v2.tar.gz
wget -nc http://www.rcn-ee.com/code/beagle/debian/lenny/2.6_kernel_revb-v2-debian-gcc-4.3.1-armel-v1.patch
tar -xf 2.6_kernel_revb-v2.tar.gz

Patch Kernel

cd 2.6_kernel/
patch -p1 < ../2.6_kernel_revb-v2-debian-gcc-4.3.1-armel-v1.patch

Setup Kernel .config

make CROSS_COMPILE= distclean
make CROSS_COMPILE= omap3_beagle_defconfig

Create Debian linux-image* & linux-headers* Package

make-kpkg --cross_compile - clean
CONCURRENCY_LEVEL=1 fakeroot make-kpkg --cross_compile - --initrd kernel_image kernel_headers

Create U-boot uImage

make CROSS_COMPILE= uImage

Issues:

Debian's gcc-4.3 will fail to build a bootable uImage, so use gcc-4.2 as gcc thru 'update-alternatives'

Successfully Built Images

Example Debian Kernel Images