Home

  • BeagleBone Black and Linux Kernel 3.8 with Android support

    BeagleBone Black and Linux Kernel 3.8 with Android support

    Building Kernel 3.8 (with Device Tree)

    cd ~/
    git clone git://github.com/RobertCNelson/linux-dev.git
    cd linux-dev/
    git checkout origin/am33x-v3.8 -b tmp
    ./build_kernel.sh

    If ./build_kernel.sh fails with ‘undefined references’ to some functions in files like ‘menubox.c’ try running: sudo apt-get install libncurses5 libncurses5-dev libelf-dev libncurses5 libncursesw5-dev and then retry with ./build_kernel.sh.

    Setting up Kernel 3.8.x for Android

    Once in the Kernel Configuration Utility (kConfig) scroll down, and enter, ‘Device Drivers’.

    Beaglebone Black - Kernel Config for AndroidMake sure the ‘Staging drivers’ are enabled, or enable them (an asterisk will appear between brackets)

    Beaglebone Black - Kernel Config for Android

    Then, enter ‘Staging drivers’ -> ‘Android’. Enable all Android drivers. I recommend you to include them into the kernel, and not build them as module.

    Beaglebone Black - Kernel Config for Android

    Exit ‘kConfig’ and the Kernel will begin building.

    Beaglebone Black - Kernel Config for Android

    When it is done you will see something like

    Beaglebone Black - Kernel Config for Android

    Next: U-Boot for BeagleBone Black

  • Increasing Java Heap size in Android from source code

    Under /frameworks/base/core/jni/ there is a file called AndroidRuntime.cpp where the Dalvik VM parameters are set. You can do a search over the file for “dalvik.vm.heapsize” and you will find out something like this:

    /*
    * The default starting and maximum size of the heap. Larger
    * values should be specified in a product property override.
    */
    strcpy(heapstartsizeOptsBuf, "-Xms");
    property_get("dalvik.vm.heapstartsize", heapstartsizeOptsBuf+4, "4m");
    opt.optionString = heapstartsizeOptsBuf;
    mOptions.add(opt);
    strcpy(heapsizeOptsBuf, "-Xmx");
    property_get("dalvik.vm.heapsize", heapsizeOptsBuf+4, "16m");
    opt.optionString = heapsizeOptsBuf;
    mOptions.add(opt);

    change “16m” for any other value, taking into account, the available memory in your device. For example, setting the heap size to 48m it is a good choice in a Beagleboard xM or Beaglebone Black, both with nearly 512Megabytes of RAM.

  • Installing busybox (for Android) on BeagleBoard

    Busybox

    BusyBox provides several stripped-dowUnix tools in a single executable file. It runs in a variety of POSIX environments such as Linux, and Android. Some of these tools are

    • ssty
    • su
    • gzip
    • ping
    • netstat
    • tar
    • arp
    • wc
    • microcom

    Why is busybox necessary on a BeagleBoard running Android?

    The default Android build does not have many useful tools like stty, so there it is where this swiss army knife comes to rescue.

    Installing busybox

    1. Download ‘busybox’ from http://benno.id.au/android/busybox
    2. Connect to the board using ADB. ./adb shell
    3. Create a busybox directory inside data. mkdir /data/busybox
    4. Exit ADB. exit
    5. Push the downloaded file to the board. ./adb push busybox /data/busybox/busybox
    6. Enter Shell again. ./adb shell
    7. And change permission in order to let any app execute busybox. chmod 777 /data/busybox/busybox
  • Beagleboard xM & native FTDI VCP driver

    Beagleboard xM & native FTDI VCP driver

    Adding the driver to the Kernel

    cd ~/rowboat-android/kernel
    make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
    make ARCH=arm CROSS_COMPILE=arm-eabi- omap3_beagle_android_defconfig

    Up to this point everything goes as normal. Now let’s add the FTDI support as a driver (NOT as a module). FTDI published a very detailed tutorial that can be found at http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_132_Adding_FTDI_Devices_VCP_Driver_Support_to_Android.pdf.
    make ARCH=arm CROSS_COMPILE=arm-eabi- menuconfig
    If ‘menuconfig’ is not present in the host (Ubuntu), install it using the following code:
    sudo aptitude install lib32ncurses5-dev
    As the documentation presented by FTDI says, it is necessary to enable a few things:

    1. “Device Drivers” -> “USB Support” -> pres ‘y’ over “Support for Host-side USB”
    2. “Device Drivers” -> “USB Support” -> “USB Serial Converter support” -> press ‘y’ over “FTDI Single Port Serial Driver”

     

     
    Now save this configuration and build the Kernel using
    make ARCH=arm CROSS_COMPILE=arm-eabi- -j4
    When connecting a FTDI device to the BB xM with this modified Kernel, you will see a ttyUSBx directory inside /dev.

    Connecting the FTDI device to the Beagleboard

    First of all it will be very useful to connect the Beagleboard Serial port to the host machine and establish a connection using Minicom (or something like that). Once you got there it will be very easy to see if the driver was properly included, and the device is recognized.
    See the following screenshot. It shows the device console before the FTDI converter was connected and after that. The device was recognized perfectly, and ttyUSB0 was created under /dev.

     

    A simple test from shell

    If you have busybox on Android you can make a simple test in order to see if the driver is well configured (In case you don’t have busybox, you can follow my post on how to install busybox on BeagleBoard).

    1. Connect RX and TX on the FTDI IC
    2. Connect to board using ADB. ./adb shell
    3. Setup ttyUSB0. /data/busybox/busybox stty -F /dev/ttyUSB0 115200
    4. Open microcom (similar to minicom) /data/busybox/busybox microcom -s 115200 /dev/ttyUSB0
    5. Write something and it will be echoed. If you disconnect the RX and TX, what you send it will not be echoed.

     

    Writing to ttyUSB from C

    Init the ttyUSB interface

    system("/data/busybox/busybox stty -F /dev/ttyUSB0 115200");
    The ttyUSB interface can also be initiated from /init.rc file at the end of “on boot” section.

    Getting a File Descriptor

    FILE * usbdev = fopen("/dev/ttyUSB0", "rw+");

    Read and Write from the File Descriptor

    char message[20]; /* buffer of data to send */
    char rMessage[20]; /* receive buffer */
    fwrite(message, sizeof(char), 8, usbdev);
    fread(rMessage, sizeof(char), 8, usbdev);

    Closing the File Descriptor

    fclose(usbdev);

    Writing to ttyUSB from Java

    Connecting to ttyUSB from Java requires a little bit of extra work. By default, a device under “dev” has permissions only for root. And if your Java app it is not running with root (or your base board is not rooted) you have to change permissions to ttyUSB0 in order to let other apps to write and read from the file (using JNI, of course).
    This can be done using several methods, for example:
    chmod 777 /dev/ttyUSB0

  • ADB over Ethernet in BeagleBoard

    Setting up device

    First of all we need to ensure that we have an Ethernet connection up and running. Connect your PC to the Beagleboard using a USB to Serial converter. USB side on your host and Serial on the RS232 debug port of the Beagleboard.
    Then connect using minicom (or any other term program) at 115200bps 8N1. This will let you access a simple linux shell. At the prompt type:
    root@android:/ # netcfg
    You should see something like

    lo   UP      127.0.0.1/0
    sit0 DOWN
    usb0 UP      192.168.1.118/24

    if not, try running netcfg eth0 dhcp or netcfg usb0 dhcp in order to obtain a connection.
    Once the connection is established, we will change the ADB TCPIP port and then restart ADB Daemon (adbd)

    root@android:/ # setprop service.adb.tcp.port 5555
    root@android:/ # stop adbd
    root@android:/ # start adbd

    Setting up host

    Back on your host machine, start ADB in TCPIP mode and then connect to your device like this

    $ sudo ./adb tcpio 5555
    $ sudo ./adb connect 192.168.1.118

    Once you are connected you can check that everything is working running an adb command like:

    $ sudo ./adb devices
    List of devices attached
    192.168.1.118:5555 device

    or

    $ sudo ./adb logcat

  • How to setup a Blackberry 10 for development over WiFi

    How to setup a Blackberry 10 for development over WiFi

    On the device


    On the home screen, swipe down from the top of the screen.

    Tap Settings > Security and Privacy > Development Mode.

    Tap Development Mode from the list of security options.

    Tap the Use Development Mode toggle switch. If prompted, type the password for your device, and tap OK.

    On the Host (Using Google ADT + Blackberry SDK)

    Right click on the project -> BlackBerry Tools -> Configure Targets -> run “BlackBerry Development Setup Wizzard”

    press “Next” and  check “Device connected using Wi-Fi”. Complete “IP Address” with your BB10’s IP and “Password” with your device password.

    Once the wizzard connected to your device, it will ask for your BlackBerry Code Signing Keys. You can get your keys filling out the BlackBerry Signing Key Order Form.

    It is recommend to save your Signing Keys and Developer Certificate once they were generated.
    In order to run code on the device, a device token must be generated and uploaded to the BB10.

    Uploading the Debug Tokens is the last step in the Wizzard. Then a summary appears, and we are done!

     

  • FT232R (Java) Driver for Android OS 3.1+

    FT232R Driver
    PS2Pad (Test app for FT232R Driver)
    Testing the Driver using a Motorola Xoom

  • Android 4.1.2 Image for Beagleboard XM

    This Image can be loaded into an SD Card (4GBytes min). It can run entirely from the SD Card, or the Android OS can run from a USB Flash, and U-Boot, X-Loader and the Kernel on the SD Card.

    Configure U-Boot

    For running entirely from the SD Card

    Setup U-BOOT for Android and Kernel on SD Card

    ./mkbootscr

    For running Android OS from a USB Drive

    Setup U-BOOT for Android on USB and Kernel on SD Card

    ./mkbootscrUSB

    copy rootfs.tar.bz2 to USB Drive and untar (all these commands should be executed as Administrator)

    Create SDCard

    Note: Script not yet optimized for configuration with USB Drive (it is not necessary to copy rootfs to SD Card when booting from USB)
    sudo ./mkmmc.sh /dev/sdb MLO u-boot uImage boot.scr rootfs.tar.bz2

    Files: Android Image for BeagleBoard xM

  • Basic SysInfo for Android

    Basic project used in a Beagleboard XM. It reports CPU, ABI, OS Version, Maunfacturer, Device, and more.
    Screenshot of the app in a Motorola RAZR i (Intel x86)

    Screenshot of the app in a Beaglebaord XM

    Project File:  Basic SysInfo

  • Setting up ADB on Beagleboard

    On your Beagleboard

    Enable USB Debugging on The Beagleboard

    1. Go to Settings’ app
    2. Developers Options
    3. Check “USB Debugging”
    4. Restart your Beagleboard

     

    On your Host Machine (Ubuntu)

    Allow device in udev

    vim /etc/udev/rules.d/51-android.rules
    Copy:

    SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0451", MODE="0666"

    Save and change permissions

    chmod a+r /etc/udev/rules.d/51-android.rules

    Turn off any existent ADB

    sudo killall adb

    Restart udev

    sudo service udev restart

    Start ADB and look for devices

    cd ~/adt-bundle-linux-x86_64/sdk/platform-tools
    sudo ./adb/ start-server
    sudo ./adb/ devices
    You should see something like:

    kimi@kimi-VAIO:~/adt-bundle-linux-x86_64/sdk/platform-tools$ ./adb devices
    List of devices attached
    20100720 device