This post describe how to build the latest Qt version for BeagleBone Black on a Linux 64bit PC.

Before starting Qt building for your BBB you should read prevoius articles in this blog.

After configuring my BBB running on uSD, I turn off the BBB and mount the uSD on my PC:

mount /dev/sdx1 /mnt/bbbhf

Where sdx1 is the uSD device connected to your PC.

Now you need to download the proper toolchain and extract it. I'm using gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz downloaded from:

mkdir /opt/arm-toolchain
tar -C /opt/arm-toolchain -xvJf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz

You also need the cross-compile-tools. I used the following link:

but it seems unavailable at the moment so you can use the tar.gz I downloaded before:


after downloaded and extracted where you prefer:

cd cross-compile-tools
./fixQualifiedLibraryPaths /mnt/bbbhf/ /opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++

this command adjusts some libraries symbolic links on the uSD.

It's time to download and extract Qt 5.5.1, then:

cd qt-everywhere-opensource-src-5.5.1
cp -r qtbase/mkspecs/devices/linux-beagleboard-g++ qtbase/mkspecs/devices/linux-bbbhf-g++
vi qtbase/mkspecs/devices/linux-bbbhf-g++/qmake.conf

in qmake.conf file you must replace:

COMPILER_FLAGS          = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp


  COMPILER_FLAGS          = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard

Now you can configure and build Qt...

./configure -opensource -confirm-license -no-pch -prefix /opt/qt551-bbbhf -release -force-debug-info -device linux-bbbhf-g++ -make libs -nomake tests -nomake examples -device-option CROSS_COMPILE=/opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/bbbhf -v -qt-zlib

... and take a coffee...

After build completed you must install the libraries but you should consider that all Qt libs and build tools will be installed un the uSD and should require up to 1GB. So if you want to flash the uSD to internal BBB eMMC memory you must be under 4GB of total space. Because I don't need all the Qt module, I installed that way:

make module-qtbase-install_subtargets module-qtscript-install_subtargets module-qtserialport-install_subtargets module-qtsvg-install_subtargets

If all the operations completed successfully you will find all in /mnt/bbbhf/opt/qt551-bbbhf .

Now you can flash the uSD (if you want to) to your BBB as explained in a previous blog post.


... to be continued...


BeagleBone Black There are a lot of good tutorial on internet to start using BeagleBone Black (BBB) but after some tests and works I got "my way" to use BBB and I'll explain you how I do.

The first good starting point website is the official one: .

When you receive your BBB for the first time you already have a working Debian OS on your board but I like to start with a new and clean installation.

Get the image

You can download the official stable BBB image from but I usually don't need a graphic environment so I prefer the "testing images" from At the time of writing this post (06/12/2015) there are the following versions:

  • Jessie Snapshot lxqt

    • Flasher: (lxqt-4gb) (BeagleBone Black/Green 4GB eMMC)
      • Flasher version with LXQt Desktop Environment for the BBB with 4G eMMC (the newer BBB version)
    • Flasher: (lxqt-2gb) (BeagleBone Black 2GB eMMC)
      • Flasher version with LXQt Desktop Environment for the BBB with 2G eMMC (the previous BBB version)
    • microSD/Standalone: (lxqt-4gb) (BeagleBone/BeagleBone Black/BeagleBone Green)
      • Standalone version with LXQt Desktop Environment for the BBB with 4G eMMC (the newer BBB version)
  • Jessie Snapshot console

    • Flasher: (console) (BeagleBone Black/Green eMMC)
      • Flasher version with a console environment for the BBB (all BBB version)
    • microSD/Standalone: (console) (BeagleBone/BeagleBone Black/BeagleBone Green)
      • Standalone version with a console environment for the BBB (all BBB version)

I usually don't need a graphic environment so I alway use the "console" version. The main differences between "flasher" and "standalone" versions are that with flasher version the system automatically install on the BBB internal memory when booting from SD card while the standalone version can run directly from SD card without modifying the internal BBB memory. I always start with the standalone version so that I can boot from SD card, add or remove same packages, set my configurations and the when I'm ok I flash my custom image on the BBB. That way I also have my custom image on the SD card and I can save it on my PC with "dd" command on linux (I'll explain leater, don't worry).

Ok, let's start downloading the microSD/Standalone: (console) (BeagleBone/BeagleBone Black/BeagleBone Green) version and extract the image:

xz -d bone-debian-8.2-console-armhf-2015-11-29-2gb.img.xz

Now you only need to flash the image in a 2GB uSD card and run on the BBB.


dd if=bone-debian-8.2-console-armhf-2015-11-29-2gb.img of=/dev/sdd oflag=sync bs=1M

this operation may take several minutes without any progress messages so wait with patience...

That's all!

Now you can boot your BBB with your new uSD card. Remember that the image we used isn't a "Flasher image" so nothing will be written on the BBB's eMMC. To start the BBB from uSD card you must press the USER/BOOT Button while connecting power tho the BBB. (You can find the required button in the BBB image included on the top of this post).

Whatever you do in the running BBB system (updating system, changing configuration files, adding packages etc...) will be on the running uSD so if you shutdown the BBB, extract the uSD and mount it on your PC you can see the changes.

When you've done with all your settings on the BBB's running image you can edit uEnv.txt file to enable the "flasher" script so that next boot the uSD image will be flashed on the eMMC internal memory.

To the end of uEnv.txt you can find:


You only need to remove the # on the beginning of the line:


Next time you will boot your BBB from uSD (by pressing the USER/BOOT button while powering on) the BBB leds will start blinking in sequence for a while during flashing to eMMC memory process.

When blinking stops you can power off the BBB, remove the uSD and power on again.

I like to play with the BeagleBone Black (BBB) board. Sometimes I need to edit or add files to the image before running on the board so it's useful to be able to mount the image directly on my Linux PC to work on it.

First download the image from To download and use a BBB image you can follow the instruction on the post: "Getting started with BeagleBone Black".

After you extracted the image you must use fdisk to find the offset we'll use to mount the image partition:

fdisk bone-debian-8.2-console-armhf-2015-11-29-2gb.img

Press 'p' to print image detail and you get:

Command (m for help): p

Disk bone-debian-8.2-console-armhf-2015-11-29-2gb.img: 1782 MB, 1782579200 bytes
184 heads, 31 sectors/track, 610 cylinders, total 3481600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x77b67e54

                                           Device Boot      Start         End      Blocks   Id  System
bone-debian-8.2-console-armhf-2015-11-29-2gb.img1   *        2048     3481599     1739776   83  Linux

Command (m for help): 

you need the partition start sector: 2048 . Then you must multiply it with the sector size (512):

2048 * 512 = 1048576

that number must be used as offset to mount the image:

mkdir /mnt/bbb-image
mount -o loop,offset=1048576 bone-debian-8.2-console-armhf-2015-11-29-2gb.img /mnt/bbb-image

That's all.

Now whatever you do in the mounted partition will be available when you'll run the image on a real BBB.

For example I usually mount the image partition as explained to have a local sysroot to build Qt libs for my BBB. In a next article I'll explain better how to built Qt.

If you need convert to/from Base64 in your C/C++ project you can do that using openssl functions.

Convert to Base64

unsigned char *base64(const unsigned char *input, int length)
    BIO *bmem, *b64;
    BUF_MEM *bptr;
    b64 = BIO_new(BIO_f_base64());
    bmem = BIO_new(BIO_s_mem());
    b64 = BIO_push(b64, bmem);
    BIO_write(b64, input, length);
    BIO_get_mem_ptr(b64, &bptr);
    unsigned char *buff = (unsigned char *) malloc(bptr->length);
    memcpy(buff, bptr->data, bptr->length - 1);
    buff[bptr->length - 1] = 0;
    return buff;

You can call base64 as:

unsigned char *buff;
// ...
// allocate buff with the byes you need to convert to Base64
// ...
int buff_len;
// ...
// set buff_len with the size of buff
// ...
unsigned char *b64_buff = base64(buff, buff_len);

The result b64_buff will be NULL terminated. Because of the memory allocation is inside base64(...) you must remember to call "free" when you don't need b64_buff anymore.

Convert from Base64

unsigned char *unbase64(unsigned char *input, int length, int *unbase_len)
    BIO *b64, *bmem;
    unsigned char *buff = (unsigned char *)malloc(length);
    memset(buff, 0, length);
    b64 = BIO_new(BIO_f_base64());
    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
    bmem = BIO_new_mem_buf(input, length);
    bmem = BIO_push(b64, bmem);
    *unbase_len = BIO_read(bmem, buff, length);
    return buff;

You can call unbase64 as:

unsigned char *b64_buff;
// ...
// allocate b64_buff with the byes you need to convert from Base64
// ...
int b64_buff_len;
// ...
// set b64_buff_len with the size of b64_buff
// ...
int buff_len=0;
unsigned char *buff = unbase64(b64_buff, b64_buff_len, &buff_len);

You will get the buff pointer as return and buff_len will be written with it's lenght. Because of the memory allocation is inside unbase64(...) you must remember to call "free" when you don't need buff anymore.