Updating BBB to the Latest Image
NOTE: This was done on Mac OSX 10.9 with tcsh
Download the latest Debian image
http://beagleboard.org/latest-images
Or refer to this page for more upto date info http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Releases http://elinux.org/BeagleBoardDebian
NOTE: "console" version contains minimal system without the FAT partition which contains drivers, etc. "lxde" version contains everything including the desktop GUI, but the image is huge.
Or use images from ErleRobotics which has everything pre-installed and configured. http://erlerobotics.com/blog/updating-the-software/
Find out you SD card device's name
df -h
Unmount the disk partition (but not the disk itself)
The partition was /dev/disk7s1
on my system. Change it to your SD card device's name.
diskutil unmount /dev/disk7s1
Write the image to the SD Card by decompressing it with xzcat|gzcat|zcat and piping the decompressed data to dd.
NOTE: Both flasher and SD bootable images available on beagleboard.org contain multiple partitions, so you need to write over the whole disk (/dev/disk7 in my case), NOT just the single partition that you found above (/dev/disk7s1 in my case). This is because the loader on Beaglebone must be able to find uEnv.txt
file on a FAT partition which is the first partition (the Linux OS sits on a separate ext4 partition). So in this example, if you've found your SD card disk was mounted at /dev/disk7s1, specify /dev/disk7 as the of target (as of=/dev/disk7
option to the dd command)
Ubuntu snappy core image from Erle Robotics.
Not polished yet. Use with caution and know there are limitations such as need for chroot, etc.
gzcat erle-snappy-25-08-2015.img.gz | sudo dd of=/dev/disk5 bs=1m
Standard bootable minimal Debian image for BBB.
Debian 7.x (Wheezy) images are not very useful with latest APM codebase because of the gcc and glibc version incompatibilities. Use Debian 8.x (Jessie) based image if possible.
# Console version
xzcat bone-debian-7.8-console-armhf-2015-07-28-2gb.img.xz | sudo dd of=/dev/disk5 bs=1m
# GUI version
xzcat bone-debian-7.8-lxde-4gb-armhf-2015-07-28-4gb.img.xz | sudo dd of=/dev/disk6 bs=1m
To Flash eMMC, use eMMC flasher image
xzcat BBB-eMMC-flasher-debian-7.5-2014-05-14-2gb.img.xz | sudo dd of=/dev/disk7 bs=1m
NOTE: Small letter 'm' is used for BSD based systems like Mac OSX to specify block size for the dd command. On Linux, use bs=1M
instead of bs=1m
.
xzcat BBB-eMMC-flasher-debian-7.5-2014-05-14-2gb.img.xz | sudo dd of=/dev/disk7 bs=1M
Wait around 15 min for dd to finish copying the image.
GUI option
Image need to be decompressed first.
unxz --keep BBB-eMMC-flasher-debian-7.5-2014-05-14-2gb.img.xz
Then select the decompressed image in Pifiller and the SD card to copy the image. Pifiller
OR you can copy the decompressed image using dd command as above.
dd if=BBB-eMMC-flasher-debian-7.5-2014-05-14-2gb.img of=/dev/disk7s1 bs=1m
Again, on Linux, use bs=1M
instead of bs=1m
which is for BSD based systems like Mac OSX.
dd if=BBB-eMMC-flasher-debian-7.5-2014-05-14-2gb.img of=/dev/disk7s1 bs=1M
Flashing the image to eMMC on BBB
- Insert the SD card to BBB
- Only connect the power to BBB (Must use external power supply. USB power will NOT work!
- http://makezine.com/projects/beaglebone-black-update-to-debian-for-osx/
- Power Jack is standard 5VDC with 2.1mm center post, 5.5mm outer barrel. It must be supplied with 5VDC+/-.25V at 1A (2A recommended with cape)
- Push and hold the boot button while plugging in the power
- Wait for the flashing to stop (all 4 LEDs should be lit when finished)
- Remove SD card and reboot BBB
Booting off of SD Card
When using debian or ubuntu snappy bootable images, there's no need to flash the eMMC as you can simply insert the SD and boot off of it.
Connecting to BBB
Install the drivers on host Mac
You need to install FTDI and RNDIS drivers on your Mac first. The driver installers are located on the FAT disk that gets mounted on your Mac when BBB is atteched via USB.
NOTE: On older version of the disk image, unmount the FAT disk from you Mac to use the USB as network IF or serial console instead of Mass Storage class device. This is not needed with latest images.
By default, BBB will assign 192.168.7.2 to it's USB interface (usb0). On the host machine, assign 192.168.7.1 to the USB interface of the BBB. Login via ssh if the network interface comes up.
ssh root@192.168.7.2
# The root password is blank for default beaglebone OS images.
Or login via serial console:
screen /dev/tty.usbmodem* 115200
If using bootable images
The user and the password for the ubuntu image is 'ubuntu'. Setup USB network virtual adopter to an unused IP address (192.168.7.1 in the following example), and the host PC will be the DHCP server and assign address to BBB.
ssh ubuntu@192.168.7.2
(password: ubuntu)
For Debian Wheezy image
ssh debian@192.168.7.2
(password: temppwd)
Add User Account
Add user account and add it to admin group for sudo privilegde
sudo adduser userid
sudo /usr/sbin/usermod -G admin userid
Configuring Basic Network
Use Ethernet to connect to the Internet as using usb0 to connect to the Internet via Internet Sharing is tricky.
Connect Ethernet cable and do the following
ifconfig eth0 up
dhclient eth0
If not using DCHP, setup network interface and setup routing manually
ifconfig eth0 10.0.0.111
ifconfig eth0 netmask 255.255.255.0
route -n
route add default gw 10.0.0.1
Expand Partition
If your SD Card is larger than the OS image.
Easy Way
cd /opt/scripts/tools/
git pull
sudo ./grow_partition.sh
sudo reboot
Hard Way
To do it manually, expand the partition first and then expand the filesystem on it.
sudo su
lsblk
df -hT
fdisk
Delete p2 and p1 partitions and create a new p1 starting at the same block as the original p1, ending at the last block to claim the maximum size it can take up on the disk.
w
Exit fdsik and reboot
reboot
Once rebooted, use resize2fs to expand the filesystem to fit the partition size.
/sbin/resize2fs /dev/mmcblk0p1
Now the main filesystem mounted at / should takeup the entire available disk.
Ubuntu Snappy Image Notes
If using Ubuntu Snappy image, chroot in order to workaround the small boot partition and use the unused disk space on the SD
cd trusty
su
chroot .
http://erlerobotics.com/blog/creating-a-chroot-out-of-ubuntu-snappy-core/
Updating Packages
Cleanup apt and add rcn-ee for easier kernel compilation.
sudo vim /etc/apt/sources.list
# comment out the following line
deb [arch=armhf] http://debian.beagleboard.org/packages wheezy-bbb main
# download and install keyring for rcn-ee
wget https://rcn-ee.com/repos/debian/pool/main/r/rcn-ee-archive-keyring/rcn-ee-archive-keyring_2015.10.22~bpo90+20151022+1_all.deb
sudo dpkg -i rcn-ee-archive-keyring_2015.10.22~bpo90+20151022+1_all.deb
# add rcn-ee repos
sudo sh -c "echo 'deb [arch=armhf] http://repos.rcn-ee.com/debian wheezy main' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb-src [arch=armhf] http://repos.rcn-ee.com/debian wheezy main' >> /etc/apt/sources.list"
# Update packages
sudo apt-get update
sudo apt-get upgrade
# Remove unneeded stuff
sudo apt-get remove apache2
# etc.
Set the time from NTP
Beaglebone doesn't have battery to keep the internal clock ticking while the power is off (it will reset everytime you boot)
apt-get install ntpdate
sudo /usr/sbin/ntpdate -b -s -u asia.pool.ntp.org
# Generate locale to avoid spurious perl warnings.
# `apt-get upgrade` should do this for you.
locale-gen en_US en_US.UTF-8
# Update and upgrade
apt-get update
apt-get upgrade
Install basic packages
apt-get install vim less git zip cpufrequtils
# Also install other packages you use
# Reboot to make sure deamons are reloaded
reboot
Adjust CPU Clock
Make sure you reset the CPU Frequency back to 1GHz (1,000 Hz)
cpufreq-info
Edit the config file. This file may not exist, in which case you should just create it.
vim /etc/default/cpufrequtils
# Add the following line to the file and save
GOVERNOR="performance"
OR do this in apm4-startup.sh
cpufreq-set -f 1000MHz
Reboot and confirm the change
shutdown -r now
# Check to see if the setting is reflected.
cpufreq-info
More Network Setup
Change Hostname
vim /etc/hostname
vim /etc/hosts
Change the network settings loaded at boot
vim /etc/network/interfaces
WiFi on Erle Images
If you are ssh'ing via the wifi, BBB will be the DHCP host and the IP of the BBB would be 10.0.0.1 on the wireless network, and your PC will most likely have 10.0.0.2.
SSID: erle_snappy
KEY: holaerle
Enable Internet Sharing on Mac for the BBB interface
For example, share the internet from WiFi to BBB Ethernet over USB interface. - First, setup internet sharing on Mac for RNDIS/Ethernet Gadget or BeagleBone Intefrace (Ethernet over USB enabled via the driver above) - Manually Set the Mac USB interface's IP to 192.168.7.1 - On BBB, use DHCP to obtain IP, etc. from the Mac.
On Debian Wheezy
sudo /sbin/dhclient usb0
On older installations
dhclient usb0
route add default gw 192.168.2.1
echo "nameserver 192.168.2.1" >> /etc/resolve.conf
On even older OS versions, install udhcpc and run it on usb0
apt-get install udhcpc
udhcpc -i usb0
OR automate it as a shell script
#!/bin/sh
################
# DHCP Version
#echo "Starting DHCP Client"
#/sbin/dhclient usb0
#echo "Using Google DNS Servers"
#echo "nameserver 8.8.8.8" >> /etc/resolv.conf
################
# FIXED IP Version
echo "Setting Fixed IP Address"
/sbin/ifconfig usb0 192.168.2.2
echo "Setting default gateway to Mac's internet sharing"
/sbin/route add default gw 192.168.2.1
#echo "Setting DNS Server. Only need to do this once"
#echo "nameserver 192.168.2.1" >> /etc/resolv.conf
When you run this script or run dhclient
, your ssh session will terminate since the IP address will change. Type ~.
to terminate ssh and reconnect:
ssh root@beaglebone.local
Updating Kernel
NOTE: Don't do this with Erle Images as they've customized the kernel. For their config file, see: https://github.com/erlerobot/kernels/tree/master/bbb/3.8.13.x/PREEMPT/bone64
Debian Wheezy:
NOTE: Don't do this unless you know what you are doing. Especially if you are running non-STABLE kernel (i.e. v4.x)
# On beaglebone default debian images:
apt-get update
cd /opt/scritps/tools/
git pull
./update_kernel.sh
reboot
apt-get install linux-headers-$(uname -r)
On Erle images:
Above doesn't work, so do it from a Linux/Mac desktop machine
git clone git://github.com/beagleboard/kernel.git
cd kernel
git checkout 3.8-rt
./patch.sh
cp configs/beaglebone kernel/arch/arm/configs/beaglebone_defconfig
wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin
cd kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- beaglebone_defconfig -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage-dtb.am335x-boneblack -j4
# build any kernel modules:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/home/YOUR_USERNAME/export/rootfs modules_install
# Outdated
#git clone https://github.com/RobertCNelson/stable-kernel
#cd stable-kernel
#git checkout v3.8.x
#apt-get install u-boot-tools
#./build_kernel.sh
OR
cd /opt/scripts/tools/
# See where these scripts are coming from
git remote show origin
git pull
sudo apt-get install lsb-release
sudo sh -c "echo 'deb [arch=armhf] http://repos.rcn-ee.com/debian wheezy main' >> /etc/apt/sources.list"
sudo sh -c "echo '#deb-src [arch=armhf] http://repos.rcn-ee.com/debian wheezy main' >> /etc/apt/sources.list"
# sudo apt-get update
wget https://rcn-ee.com/repos/debian/pool/main/r/rcn-ee-archive-keyring/rcn-ee-archive-keyring_2015.10.22~bpo90+20151022+1_all.deb
sudo dpkg -i rcn-ee-archive-keyring_2015.10.22~bpo90+20151022+1_all.deb
# Remove outdated ppa to prevent update_kernel.sh from choking.
#apt-get ppa-purge
#ppa-purge http://ppa.launchpad.net
vim /etc/apt/sources.list.d/snappy-dev-tools-wheezy.list
# comment out http://ppa.launchpad.net/
./update_kernel.sh --kernel 3.8.13-bone70
Other Kernel Options
# latest stable kernel
sudo ./update_kernel.sh --stable-kernel
# latest kernel
sudo ./update_kernel.sh --beta-kernel
# RT kernel
sudo ./update_kernel.sh --ti-rt-kernel
# RT kernel for BBB
sudo ./update_kernel.sh --bone-rt-kernel
# RT kernel for BBB Long Term Support
sudo ./update_kernel.sh --bone-rt-kernel --lts
# Specific kernel version (if you haven't added rcn-ee.net repos to apt, this will get you the latest sub-version, not the exact version you specify)
sudo ./update_kernel.sh --kernel 3.8.13-bone70
Or Manually Update the Kernel
NOTE: Don't do with with Erle Images
Check for the latest kernel builds here: https://rcn-ee.net/deb/wheezy-armhf/
As of 2015-10-28, https://rcn-ee.net/deb/wheezy-armhf/v3.8.13-bone70 is the latest version with kernel header available. The latest Erle debian image runs customized version of v3.8.13-bone64.
# The following is obsolete
# wget https://rcn-ee.net/deb/wheezy-armhf/v3.8.13-bone70/install-me.sh
# sh install-me.sh
# The usual kernel update method doesn't work on Beaglebone
#apt-get update
#apt-cache search linux-image | grep <branch>
#apt-get install linux-image-<specific version>
#reboot
Reboot To see if you have the latest kernel
shutdown -r now
uname -r
# You should see `3.8.13-bone70`
# Or do:
uname -a
# You shuld see something like: `Linux beaglebone 3.8.13-bone74 #1 SMP Wed Aug 12 01:42:28 UTC 2015 armv7l GNU/Linux`
If using an older OS image
Building the RT Kernel manually.
Rerefences
- http://dev.ardupilot.com/wiki/building-for-beaglebone-black-on-linux/
- http://beagleboard.org/getting-started
- http://elinux.org/Beagleboard:BeagleBoneBlack
- http://elinux.org/Beagleboard:BeagleBoneBlack_Debian
- http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Releases
- http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Expanding_File_System_Partition_On_A_microSD
- http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#2014-05-14_GPG_error:_Disable:_http:.2F.2Fdebian.beagleboard.org_repo:
- http://elinux.org/BeagleBoardDebian#Install_Latest_Kernel_Image
- http://elinux.org/BeagleBoardDebian#BeagleBone_Black
- http://elinux.org/Building_BBB_Kernel
- https://github.com/erlerobot/kernels/tree/master/bbb/3.8.13.x/PREEMPT/bone64
- https://github.com/beagleboard/linux/tree/3.8
- https://github.com/notro/fbtft/wiki/BeagleBone-Black
- https://github.com/gkaindl/beaglebone-ubuntu-scripts/
- http://erlerobotics.gitbooks.io/erle-robotics-erle-brain-a-linux-brain-for-drones/content/en/software/ardupilot/installing.html
- http://erlerobotics.com/blog/updating-the-software/#debian
- http://avedo.net/653/flashing-ubuntu-13-04-or-debian-wheezy-to-the-beaglebone-black-emmc
- http://www.dummies.com/how-to/content/how-to-flash-your-beaglebone-microsd-card.html
- http://blogspot.tenettech.com/?p=2932
- http://askubuntu.com/questions/307/how-can-ppas-be-removed