Wednesday, May 14, 2014

Flashing BeagleBone Black (rev B, 2GB eMMC) with Ubuntu 14.04

You're supposed to be able to use "BBB-eMMC-flasher" images to flash new OS directly from SD card. For whatever reason this sometimes fails to work. People blame power supplies which probably is one reason but not this time. In my case when trying to use BBB-eMMC-flasher image BBB started flashing all four user leds in sync without ever even attempting to flash image to eMMC.



Therefore I was forced to boot operating system from SD card and use that to flash internal eMMC device.

Lets start by grabbing fresh Ubuntu SD card image from https://rcn-ee.net/deb/microsd/trusty/. I used bone-ubuntu-14.04-2014-05-06-2gb.img.xz, but there's probably newer available by time you read this.

Unpack compressed image with tool that understands "XZ" format and dump it to SD card -- 7zip, winrar, unxz, etc. Then we write image to SD card using dd. Also double check destination device name to prevent disaster.

unxz bone-ubuntu-14.04-2014-05-06-2gb.img.xz
dd bs=1M if=bone-ubuntu-14.04-2014-05-06-2gb.img of=/dev/sdc

Above commands work for Linux and other unix-like systems including Windows with Cygwin. Also make sure you unmount any existing partitions mounted from SD first to avoid corruption. If you're using Cygwin launch shell as elevated user and check device names first with "cat /proc/partitions". There's also Win32 Disk Imager which offers GUI.

Plugin SD card to BBB, press and hold S2 (BOOT) button, connect power cable, release S2 (BOOT) when two of "user" leds lit up.

Wait few minutes while BBB boots and then you should now be able to access it over IP. I plugged it to USB port of laptop, installed BBB Windows RNDIS drivers (http://beagleboard.org/static/Drivers/Windows/) and opened SSH connection to 192.168.7.2. With RNDIS drivers and DHCP enabled (enabled by default) your PC will get 192.168.7.1 IP from Beaglebone.

Login as "ubuntu" with password "temppwd".

Format USB stick using FAT32 and copy UNCOMPRESSED bone-ubuntu-14.04-2014-05-06-2gb.img to it as file with your PC. Connect this USB stick to BBB. Mount it and overwrite internal eMMC using new image. It's great that images are shipped as .xz, but operating system that uses them can't support .xz format without additional packages and you can't get them easily installed at this stage of install process...

mkdir /mnt/foo
mount /dev/sda1 /mnt/foo
dd bs=1M if=/mnt/foo/bone-ubuntu-14.04-2014-05-06-2gb.img of=/dev/mmcblk1

Remove USB stick, SD card and pull power from BBB rather than just reboot it. Reconnect power and it should be finally working as any other underpowered barebones headless Ubuntu install.

Almost. What you want to do next is resize root partition to fill entire eMMC, otherwise you're leaving few hunded megabytes of capacity unused and rev B internal 2GB eMMC is already a bit on small side for full blown Linux install. Below steps will of course work for SD card rootfs as well.

# Switch to root
sudo su -

# Delete and recreate root partition using entire disk
# internal eMMC is called mmcblk0 now as we don't have any SD cards connected
fdisk /dev/mmcblk0
# Delete partition #2 (type "d" and then "2")
# Create new partition (type "n" and hit enter four times to accept defaults)
# Write changes (type "w")

# Reboot so new partition table gets read
reboot

# Login again as root and resize root fs
resize2fs /dev/mmcblk0p2

Done.. Finally.

4 comments:

  1. Thanks! I was getting the 4 blinking leds with no write when using the flasher image. Your guide worked for me.

    ReplyDelete
  2. Wow! Thank you so much! I had the exact same issue! followed your steps and it worked like a charm... Instead of using ubuntu i tried it with Debian instead and everything worked great! Thank you very very much!

    ReplyDelete
  3. Cheers! I was also having issues with the 4 blinking leds when trying to use the flasher image. Your method worked great!

    ReplyDelete
  4. thank u so much....100% working

    ReplyDelete

Got something to say?!