EBC Updating the Beagle OS
Embedded Linux Class by Mark A. Yoder
In this class we run The Debian Distribution on BeagleBone Black. Debian now ships on the eMMC of the Bone. Here's how to tell what version you are running and how to update it.
Finding the version of the running OS
Attach your Bone to your Linux host via the USB cable. Once it's booted, on your host run:
host$ ssh -X email@example.com Warning: Permanently added '192.168.7.2' (ECDSA) to the list of known hosts. Last login: Wed Aug 6 11:24:41 2014 from yoder-linux.local bone$ cat /etc/dogtag BeagleBoard.org BeagleBone Debian Image 2014-08-05
I'm running the 5-Aug-2014 version Debian. If /etc/dogtag doesn't exist, or is older than shown here, you need to update your image.
Updating your SD image
The Bone can boot from either the built in eMMC (either 2G or 4G depending on which version of BeagleBone Black you have), or from the micro SD card. For this class we'll be booting from the SD card. It's faster to flash, and if you mess up something it's easier and quicker to recover. Booting to newer versions of the OS on the SD card require the eMMC be updated. Yup, that's right, to boot from the SD card you need to update the eMMC. Here's I'll show you how to install a minimal image on the eMMC and then a full image on an SD card.
Installing a minimal image on the eMMC
Plug your SD card into a reader on your Linux host and run Disks.
Select the SD Drive then unmount any partitions that have mounted. Note at the top of the Disks window is the path to the device. In my case it’s /dev/sdb. We’ll use this path in a moment
Go to http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Releases and scroll to the newest date. You have the option to select console or lxde. console is the minimal image, so select it. It should be a quick download (a minute or so on a quick connection) since it's only 58M or so. Download it. Your file name may look different than mine, but that's OK if it starts with BBB-eMMC-flasher. Next, unzip it with:
host$ unxz BBB-eMMC-flasher-debian-7.6-console-armhf-2014-08-05-2gb.img.xz
This takes about a minute. Then copy it to the SD card. Make sure your of=/dev/sdb matches what you noted above since it may differ from mine.
host$ sudo dd if=BBB-eMMC-flasher-debian-7.6-console-armhf-2014-08-05-2gb.img of=/dev/sdb bs=8M
The dd takes 5 to 10 minutes.
Once you have your SD card flashed label it. All SD cards look the same so it's a good habit to label a card once it's flashed. Once labeled, put it in the Bone and while holding down the S2 button (the one nearest the SD card slot) and power it up using an external 5V supply (the USB power may not be enough). The USER LEDs should start flashing. What's happening is the Bone is booting off the SD card and then copying itself to the eMMC.
After 10 minutes or so the LEDs will stop flashing and all turn off. Once this happens, power off the Bone, and eject the SD card.
You Bone is ready to boot from the new image in the eMMC, but let's not boot from it yet.
Installing a full image on the SD card
We need to repeat the above steps with a different image for the SD card. I suggest you use a different SD card, but the same one can be used.
Return to http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Releases and scroll to the newest image. This time when you see console and lxde, select microSD/Standalone: (lxde). It's almost 10 times the size of the minimal image.
Once downloaded, unzip (via unxz) and flash (via dd) like you did before.
Once you have your SD card flashed, put it in the Bone and power it up. This time it will boot off the SD card, but won't copy anything to the eMMC. The USB drive, etc. should appear as before. Connect to it and look around. Does /etc/dogtag show the right version?
bone$ cat /etc/dogtag BeagleBoard.org BeagleBone Debian Image 2014-08-05
This prints out how much disk is free.
host$ ssh -X 192.168.7.2 Warning: Permanently added '192.168.7.2' (ECDSA) to the list of known hosts. Last login: Wed Aug 6 11:24:41 2014 from yoder-linux.local bone$ df -h Filesystem Size Used Avail Use% Mounted on rootfs 3.5G 1.9G 1.5G 57% / udev 10M 0 10M 0% /dev tmpfs 100M 896K 99M 1% /run /dev/mmcblk0p2 3.5G 1.9G 1.5G 57% / tmpfs 249M 0 249M 0% /dev/shm tmpfs 249M 0 249M 0% /sys/fs/cgroup tmpfs 100M 0 100M 0% /run/user tmpfs 5.0M 0 5.0M 0% /run/lock /dev/mmcblk0p1 96M 72M 25M 75% /boot/uboot /dev/mmcblk1p2 1.7G 1.3G 322M 81% /media/Angstrom /dev/mmcblk1p1 70M 54M 16M 78% /media/BEAGLEBONE
The first line is the one we’re interested in. If the Size is much smaller than the size of your SD card, you need to resize your partition. Just enter:
bone$ cd /opt/scripts/tools/ bone$ ./grow_partition.sh bone$ reboot
This clever script will figure out how big the partition can be and grow it to that size. A reboot is necessary.
Congratulations, you are now running the latest Debian image.
Embedded Linux Class by Mark A. Yoder