Debian 7 on BeagleBoard (rev C5)


This is based on a tutorial I wrote as part of my thesis, which can be found here. The original one was for installing Ubuntu 11.10, this time I decided to go with Debian 7. I've skipped a few parts aimed at beginners, so if you're looking for that you can find in on my thesis blog.

Required supplies


STEP I – Update

Your BeagleBoard should come preloaded with X-Loader and U-Boot. However, there is no way to tell if they’re out of date, so just to be sure I suggest updating them.

1) Get the processor flashing script.

git clone git://github.com/RobertCNelson/flasher.git
cd flasher

2) List all the possible options for the script. This will also check for missing dependencies. If there's anything missing, apt-get install it.

./mk_mmc.sh --help

3) Plug in you SD card and find the location of your sd card.

sudo ./mk_mmc.sh --probe-mmc

You will see something like:

Are you sure? I Don't see [/dev/idontknow], here is what I do see...
fdisk -l:
Disk /dev/sda: 500.1 GB, 500107862016 bytes 
Disk /dev/sdb: 3957 MB, 3957325824 bytes
mount:
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)

dev/sdb is my SD card. Your’s might have a different name and size. Notice that /dev/sda is 500GB, that’s my hardrive, do not accidentally format yours!

4) Run the script that creates the SD card for you.

sudo ./mk_mmc.sh --mmc /dev/sdb --uboot beagle_cx

If you get stuck or need to know all your options run the script with an --help flag.

5) Take out the SD card out of your computer, then:

  1. Plug Serial Cable in and Start Serial terminal program
  2. Place MMC card in BeagleBoard
  3. Push and Hold User Button
  4. Plug-in Power
  5. Wait for U-boot countdown to finish, Let Off User Button
  6. Wait for Flashing/script to end
  7. Power down, remove and reformat MMC card to be used for STEP 2

You can use screen straight from the terminal.

screen -U /dev/ttyUSB0 115200

STEP I – Update (???)

Your BeagleBoard should come preloaded with X-Loader and U-Boot. However, there is no way to tell if they’re out of date, so just to be sure I suggest updating them.

1) Get the processor flashing script.

git clone git://github.com/RobertCNelson/omap-image-builder.git
cd omap-image-builder/tools

2) List required options for the script. This will also check for missing dependencies. If there's anything missing, apt-get install it.

./setup_sdcard.sh --help

3) Plug in you SD card and find its location in /dev.

sudo ./setup_sdcard.sh --probe-mmc

You will see something like:

Are you sure? I Don't see [/dev/idontknow], here is what I do see...
fdisk -l:
Disk /dev/sda: 500.1 GB, 500107862016 bytes 
Disk /dev/sdb: 3957 MB, 3957325824 bytes
mount:
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)

dev/sdb is my SD card. Your’s might have a different name and size. Notice that /dev/sda is 500GB, that’s my hardrive, do not accidentally format yours!

4) Run the script that creates the SD card for you.

sudo ./setup_sdcard.sh --mmc /dev/sdb --dtb omap3-beagle

If you get stuck or need to know all your options run the script with an --help flag.

5) Take out the SD card out of your computer, then:

  1. Plug Serial Cable in and Start Serial terminal program
  2. Place MMC card in BeagleBoard
  3. Push and Hold User Button
  4. Plug-in Power
  5. Wait for U-boot countdown to finish, Let Off User Button
  6. Wait for Flashing/script to end

You can use screen straight from the terminal.

screen -U /dev/ttyUSB0 115200

STEP II – Install Debian7 on Card

In this step you will load up the SD card with actual Ubuntu OS.

1) Insert the SD card into your computer.

2) Get the OS image. Use Robert Nelson's github omap-image-flasher.

wget http://ynezz.ibawizard.net/beagleboard/wheezy/debian-7.6-console-armhf-2014-08-13.tar.xz

3) Unpack image.

unxz -c debian-7.6-console-armhf-2014-08-13.tar.xz | tar xv

4) Install using the script included in the archive. The script will take 10-15 minutes to complete, so be patient.

cd debian-7.6-console-armhf-2014-08-13
sudo ./setup_sdcard.sh --mmc /dev/sdb --uboot beagle_cx

If you want to see the list of uboot choices available to you just run the script without any flags.

sudo ./setup_sdcard.sh

5) OPTIONAL. To have S-Video output instead of DVI use this:

sudo ./setup_sdcard.sh --mmc /dev/sdb --img beagle_cx --svideo-ntsc

Or if you’re using PAL format:

sudo ./setup_sdcard.sh --mmc /dev/sdb --img beagle_cx --svideo-pal

You should now have an SD card with the OS installed on it. Plug it into your Beagleboard, connect the screen, mouse, keyboard, wifi card, etc. Power on. After the kernel loads you should be able to use the command line interface. It will probably ask for a username/password, the default is below.

username:debian
password:temppwd

STEP III – Setup Networking

Wire up the BeagleBoard and start it up.

WEP

If you have WEP encription on your router connecting is quite easy.

1) Check if the wireless device is connected and detected.

iwconfig

You will see something like:

lo no wireless extensions.

eth0 no wireless extensions.

wlan0 Iunassociated ESSID:off/any
Mode:Managed Channel=0 Access Point: 00:00:00:00:00:00
Bit Rate=0 kb/s Tx-Power:off
Retry:on RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

2) If you don’t know your network’s name do a scan.

sudo iwlist wlan0 scan

Look for the ESSID you want to connect to and remember it.

3) Connect, substituting ESSIDNAME with the name of your network and PASSWORD with password for that network.

sudo iwconfig wlan0 essid ESSIDNAME key s:PASSWORD

WPA/WPA2

If you have WPA, this gets slightly more complicated. In short you’ll need to use wpa_supplicant and a configuration script.

1) Create a WPA config file using nano.

sudo nano wireless-wpa.conf

Insert text below:

# config file using WPA/WPA2-PSK Personal key.

ctrl_interface=/var/run/wpa_supplicant

network={
    ssid=”your router id”
    scan_ssid=1
    key_mgmt=WPA-PSK
    psk=”your router password″
}

Exit (press Ctrl-X, then Enter).

2) Now create a script that will apply the config file to the wpa_supplicant process.

sudo nano wireless-wpa.sh

Insert text below:

#!/bin/sh
iface=wlan0

#shut down interface
ifconfig $iface down

#set ad-hoc/management of wireless device
iwconfig $iface mode Managed

#enable interface
ifconfig $iface up

#stop any persistent wireless wpa2 sessions
pkill wpa_supplicant

#apply WPA/WPA2 personal settings to device
wpa_supplicant -B -Dwext -i $iface -c ./wireless-wpa.conf -dd

#obtain an IP address
dhclient -v -1 $iface

Exit (press Ctrl-X, then Enter).

3) Change permissions for the files you’ve just created.

sudo chmod 755 wireless-wpa.sh
sudo chmod 644 wireless-wpa.conf

4) Next run the shell script from the command line.

sudo ./wireless-wpa.sh

You’ll have to run this script every time you restart in order to use the wireless.

5) You should now be connected, but make sure anyway.

ping -c 3 www.google.com

If it gives you no errors, you’re in. If it fails on you, this is the place to start looking for solutions.