Monday, November 10, 2014

Working on Beaglebone Black, HackRF, GNURADIO + Ubuntu 14.04 ISO

Today I started work on building a working version of Ubuntu 14.04 LTS on Beaglebone Black with all the necessary stuff to run GNURADIO and HackRF.  I tried a pre-built version of this recently that kinda 1/2 worked.  So since I can't seem to get a fire lit under that version, I've decided to create my own.

Here is what I've done so far and it currently building as I write this.  So I'll post updates on this post as they occur beyond what I have so far.

MICROSD INSTALLATION (REALLY PRETTY SIMPLE!  Follow directions, requires access to a Linux OS)


NOT THIS>>>would have been nice by these packages aren't available in the ppa for 'armhf' devices :(


*** A note about Xwindows and SSH - BEGIN ***

I use a Windows 7 PC for my primary Desktop computer.  I use SecureCRT for SSH from this computer to various things I need to SSH to.

In order to see various GUI's from the BeagleBone Black that are run under 'X' There are a few things I need to do in order to see the 'X' windows generated by this BeagleBone and Ubuntu setup.

In secureCRT check 'Forward X11 Packets' under "Connection" > "Port Forwarding".  

Install "Xming":  Run xming on windows.  SSH into BBB and try running something that requires 'X'.  That's it.  Works.  Very simple.  The key is having a local (on windows)  "X server" running, and that your SSH client supports forwarding X11 Packets.

*** A note about Xwindows and SSH - END ***

Insert your new Ubuntu 14.04 LTS MicroSD (created USING THESE directions)
CONNECT YOUR DHCP Network RJ45 to the BBB.  (you'll need to locate the IP to SSH to from your DHCP/Router's list of connected devices mine shows up as 'ubuntu-armhf'.  SSH to it like you would any normal port 22 ssh connection.

SSH to your BBB (U: ubuntu, P: ubuntu)

sudo su -
apt-get update
apt-get install software-properties-common python-software-properties 
add-apt-repository ppa:gqrx/releases (you probably don't really need this)
apt-get update
apt-get upgrade
= Required for 'pybombs install'
apt-get install git
apt-get install python-qt4
apt-get install python-scipy
= SET A TEMP SWAP FILE (you may not really need this but I suspect we will since we'll be doing a fair
= amount of COMPILING next.  I tried without swap installed and with makewidth=4 (default) and the
= compiler ran out of memory.

= Running SWAP on a FLASH device is a BAD BAD idea.  Great way to use up the limited lifetime of read/writes 
= available on the device.  Once you are done with all the compiling you'll want to disable this again!!!!
= Now, let's set up your swapfile.
cd /
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile 
swapon /swapfile
swapon -s

Ok, now you have a 2GB swapfile and it is enabled. Let's make it permanent.

# vi /etc/fstab
(add at the last line):

/swapfile   none    swap    sw    0   0


(We'll remove this after we all done with compiling)
cd /usr/local/src
git clone && cd pybombs

EDIT: vi /usr/local/src/pybombs/config.dat
(CHANGE makewidth=4 to):

makewidth = 1 



NOTE: Your SSH TERM will be showing things that look like this...this is pretty normal.

NOTE: To return you can cd /usr/local/src/pybombs/;./ anytime ALSO if your x access isn't working you can install packages with: ./pybomb install <package name>

GNURADIO compile via '' takes HOURS like this 6-10 hours at least.  But it does complete! Probably could use 2-3 threads with the SWAP available, but I doubt it would much faster since there's only a SINGLE CORE.

SO after that error:

cd /usr/local/src/pybombs/src/gnuradio/build/volk
cmake ../ -DCMAKE_C_FLAGS="-march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon-vfpv4 -mtune=cortex-a15" -DCMAKE_ASM_FLAGS="-march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon-vfpv4 -mtune=cortex-a15"

cd ..

Back to building again....(hope this works)....stay tuned....

About 8 hours after that.....This completed.

make install

./pybombs env

vi ~/bashrc
(at the bottom add)
source /usr/local/src/target/
(save the file)

./pybombs install hackrf
./pybombs install gr-osmocom
./pybombs install osmo-sdr

Stop and see how things work now.... be back when I'm done checking the install out so far.

"minutes" ?  LOL try hours....

Ok so it's painfully obvious that this is REALLY not the best way to build for the ARM based OS.  All of this is seriously SLOW.  And by the time this done the SD card I'm using will probably be scrapped due to an overuse of read/write from the SWAP partition I've been using.  BUT....

If this is ultimately successful at least I'll be able to create an ISO image that I can reuse for the short term.

I think next steps will be to use one of my larger RISC based CPU Linux boxes and do cross-compiling to the ARM based system.  I have several 24 core, 24Gb Linux servers I can use to do this.  And these builds would probably complete in total within about 15 minutes instead of DAYS.

Anyway, I'm still waiting for volk_profile to work its magic while the single core BBB is crunching away on it.  More when that completes.

After all this...I'm FINALLY able to access the HackRF via GNURADIO on my Beaglebone Black!

I'll post more info soon!

For all users to have access to the attached hackrf device follow This Guide

FYI on my BBB with Ubuntu 14.04 I had to use:

cp /usr/local/src/pybombs/src/hackrf/host/libhackrf/53-hackrf.rules /etc/udev/rules.d/.


udevadm control --reload-rules

then sudo vi /etc/group 
next to the line with 'plugdev' I added 'ubuntu' to add the 'ubuntu' user to this group.
<save the file>


reboot now

And this worked as seen here:

ubuntu@ubuntu-armhf:~$ hackrf_info
Found HackRF board.
Board ID Number: 2 (HackRF One)
Firmware Version: git-44df9d1
Part ID Number: 0xa000cb3c 0x0056434c
Serial Number: 0x00000000 0x00000000 0x457863c8 0x2e3d991f

Now gnuradio-companion will be able to access the hackrf device when being run by the user ubuntu.

Any further posts about this will be in NEW posts.  This one is closed now.