Sunday, February 23, 2014

Getting around with Beaglebone Black

It is almost a year back since I got Beaglebone Black and thought I will play around with a bit. This blog is to share my experience with Beaglebone Black.

Getting it - I bought it from kits'n'spares site (if you are reading this blog from India, the link is http://shopping.kitsnspares.com/bon1/index.asp ). Looks like they have a tie up with online shopping giant element14 and we can get element14 items from kits'n'Spares. May be not all items are available but I found whatever I wanted so far. It's part number from element14 site is "BB-BBLK-000" and same was available from kits'n'Spares. The version I got is A5A.

Readme first - First thing to do after getting such a development board is to read about it and I am giving below the sites which I have gone through in the process.
  1. http://beagleboard.org/Products/BeagleBone+Black -> Getting started page at beagleboard.org
  2. http://elinux.org/Beagleboard:BeagleBoneBlack -> Wiki page for beaglebone black
  3. https://github.com/CircuitCo/BeagleBone-Black/ -> Design and technical documents at github
  4. https://github.com/jadonk/beaglebone-getting-started/tree/sysco-ch-signed-drivers/Drivers/Windows -> Drivers for Beaglebone Black with factory installed Angstrom image
  5. http://sourceforge.net/projects/androidonbeaglebonebtutorials/files/ -> Some tutorials
  6. http://elinux.org/Beagleboard:Android -> Getting android image and running it
  7. https://code.google.com/p/rowboat/wiki/JellybeanOnBeaglebone_WithSGX -> Building Android JB for beaglebone black - remember to set TARGET_PRODUCT=beagleboneblack in make commands
  8. http://processors.wiki.ti.com/index.php/TI-Android-JB-4.2.2-DevKit-4.1.1_DeveloperGuide -> Android developer guide at TI website
Power ON: Connected BBB (yes from now on, I will call Beaglebone Black in short as BBB) to my laptop serial port. I used a CP2012 USB to Serial convertor to connect debug serial port in BBB to laptop (J1 connector pint out is 1-GND, 4-Tx(BBB side), 5(Rx from BBB side). I could get the factory installed Angstrom up & running. Got the boot messages in in laptop using a terminal utility hercules. See images below



Running Android JB: Rather than trying a prebuilt image, I wanted to build the image myself. I followed the instruction in link #7. I just noted the steps below for easy reference (line proceeded with $ to be entered in Ubuntu 12.04 shell prompt; of course without the $ symbol).

Build environment:
  1. Ubuntu 12.04 64bit (I used Ubuntu 12.04 running in Virtualbox)
  2. Host is HP Pavilion 15-n003tx Laptop with Intel Core i5 4200U @ 1.6Ghz CPU, 8GB memory, 1TB HDD
  3. Ubuntu VM was configured with 2 CPU and 4GB memory, 150GB virtual HDD space
  4. Content of the build director came around 70GB (sorry I did not check the download size)
  5. It took me around 5hrs to download and build 

Build steps:
  1. $ sudo apt-get install git gnupg flex bison gperf build-essential \
  2.   zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  3.   libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  4.   libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  5.   python-markdown libxml2-utils xsltproc zlib1g-dev:i386
  6. $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
  7. $ sudo apt-get install minicom tftpd uboot-mkimage expect
  8. Download JDK from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u33-oth-JPR
  9. $ cp jdk-6u33-linux-x64.bin ~/
  10. $ cd ~
  11. $ chmod a+x jdk-6u33-linux-x64.bin
  12. $ ./jdk-6u33-linux-x64.bin
  13. $ export PATH="$HOME/jdk1.6.0_33/bin:$PATH"
  14. $ mkdir ~/bin
  15. $ PATH=~/bin:$PATH
  16. $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  17. $ chmod a+x ~/bin/repo
  18. $ mkdir ~/rowboat-android
  19. $ cd ~/rowboat-android
  20. $ repo init -u git://gitorious.org/rowboat/manifest.git -m rowboat-jb-am335x.xml
  21. $ repo sync $
  22. $ export PATH=<android source>/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
  23. $ cd u-boot
  24. $ make CROSS_COMPILE=arm-eabi- distclean
  25. $ make CROSS_COMPILE=arm-eabi- am335x_evm_config
  26. $ make CROSS_COMPILE=arm-eabi- 
  27. $ make TARGET_PRODUCT=beagleboneblack OMAPES=4.x
  28. $ cd <android source>
  29. $ make TARGET_PRODUCT=beagleboneblack fs_tarball
  30. $ mkdir ~/image_folder
  31. $ cp <android source>/kernel/arch/arm/boot/uImage ~/image_folder
  32. $ cp <android source>/u-boot/MLO ~/image_folder
  33. $ cp <android source>/u-boot/u-boot.img ~/image_folder
  34. $ cp <android source>/external/ti_android_utilities/am335x/u-boot-env/uEnv_beagleboneblack.txt ~/image_folder
  35. $ cp <android source>/out/target/product/beagleboneblack/rootfs.tar.bz2 ~/image_folder
  36. $ cp <android source>/external/ti_android_utilities/am335x/mk-mmc/mkmmc-android.sh ~/image_folder
  37. $ cd ~/image_folder
  38. $ sudo./mkmmc-android.sh <SD card device e.g.:/dev/sdc> MLO u-boot.img uImage uEnv_beagleboneblack.txt rootfs.tar.bz2
BBB booted successfully from Android.