Flash BeagleBone Black using Linux

BeagleBone Black

BeagleBone Black

Today I received my BeagleBone Black! For 45$ you get more power and even HDMI. There is also a serial debug port now on a distinct header connected to UART0 of the CPU. The user can connect to this serial port with a TTL converter (like the FTDI-USB-Cables) and a terminal emulator. Set the baudrate of 115200 and you should be able to see U-Boot, the boot process and a login prompt in the end. Everything worked fine, except when I tried to connect using SSH it failed with an error:

$ ssh
ssh_exchange_identification: Connection closed by remote host

I could no figure out how to resolve this on the currently running firmware so I followed a tip on the mailing list to just upgrade the firmware. On linux this is normally a fairly easy process, one has just to decompress the image and pipe it to a SD-Card.

unxz --stdout BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img.xz | dd of=/dev/mmcblk0

Unfortunately the original MicroSD-Card image is 4 GiB in size! Since I had only a 1 GiB MicroSD-Card at hand, I had to shrink the image first.The image contains a whole disk image including a partition table. The command file shows that there is one big partition with an Linux file system on it. This partition needs to be shrunk. Therefor I create a device using losetup (offset is blocksize * partition offset, in this case 512 * 144585), check the file system  resize it and finally resize the partition (204800 4k blocks, means partition must be at least 1638400 sectors long). In the end, we can truncate the file.

$ unxz BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img.xz
$ file BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img
BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img: x86 boot sector; partition 1: ID=0xc, active, starthead 1, startsector 63, 144522 sectors; partition 2: ID=0x83, starthead 0, startsector 144585, 6988275 sectors, code offset 0x0
$ sudo losetup -f --offset 74027520 BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img
$ sudo e2fsck -f /dev/loop0
$ sudo resize2fs /dev/loop0 800M
resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/loop0 to 204800 (4k) blocks.
The filesystem on /dev/loop0 is now 204800 blocks long.

$ sudo losetup -d /dev/loop0
$ sudo fdisk BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img
Use the commands d, 2, n, p, 2, 144585, 1782989, w

$ truncate -s 912890368 BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img
$ sudo dd if=BBB-eMMC-flasher-2013.04.13-DDR3-400MHz.img of=/dev/mmcblk0 bs=4MB

Insert the SD-Card to your BeagelBone Black, press and hold the Boot-Button just above the SD-Card while applying power. The LED’s start to blink and after about 50 minutes my board indicated success by a solid lit of all 4 LED’s. Finally, latest Ångström release with working SSH 🙂


Leave a Comment