Introduction: Open Source TV Box - GeekBox

“... you are a slave, Neo. Like everyone else you were born into bondage. Into a prison that you cannot taste or see or touch. A prison for your mind.” Morpheus - The Matrix (1999)

Ok. I must admit that is a theatrical introduction (perhaps too theatrical), but right now I feel this way, when I write this article (take this phrase with a large dose of self-irony).

So right now I work on Libre Office Writer (Open Source Project) witch is installed in Lubuntu (Linux OS distribution - Open Source Project) witch is installed on GeekBox (Open Source Project) with ARM processor. ( I know, processor is not Open Source… but it is an alternative to Intel architecture). Maybe one day I will write about some version of GeekBox that will use an OpenRisc processor.

Anyway, what is this(my) obsession about Open Source? In short it is about freedom, about who is making decisions (and when), about many years of frustrations… (and not only about price, or speed, or other technical issues)

I want to write about this device from the first time I was contacted by Geekbuying representative to consult me about writing an article about their new product: GeekBox. From the beginning I saw the possibility to use this TV Box as a general-purpose computer or personal computer.

At the time of discussion I did not know if what I thought is achievable, but I decided to try to see how far I can go with this goal. And right now, when I start to write this article I don't know where will I go. I write the article as I advance.

Therefore this article is an invitation... To try new things and to learn new ways, together.

So what is so special with this device, it's not another TV Box ? (a tv box with good technical specifications and good performance); … and powered by Android. I do not want to talk right now about performance. From the beginning I want to emphasize one major thing: It is a true open source device which is a proof (to me) that we can take our fate in our own hands. It's about product as a whole not only the hardware.

There are several similar products on the market (both price and performance) the differences (big differences) lies in how it was designed and the nature of the information they provide about device. And I will talk extensively about this in step “as Open Source Project”

Good. Now, I'm super excited about this device and I'd probably be able to continue in this way, but I am impatient to move forward, where things get really interesting.

Step 1: Specifications

So I quite rapidly over the chapter "Specifications". The numbers speak for themselves and presentation on the product website is clear.

RK3368 High Performance 64bit Octa Core SoC

RK3368 is an Integrated 64bit octa-core Cortex-A53 processor, made with 28nm HKMG techology, with PowerVR G6110 graphics chip:

  • Octa core Cortex-A53 processor, up to 1.5Ghz
  • High performance GPU up to 600Mhz, support OpenGL ES 3.1/OpenCL 1.2/DirectX 9.3
  • 4K*2K H264/H265 real-time video decoder
  • 4K*2K@60fps HDMI 2.0 with HDCP 2.2

An interesting thing to note is that there are clear signals that they are working on open source driver for PowerVR graphics. I do not know when it will be ready, but I look forward to this.

2GB RAM

It should be sufficient for both Linux and Android use.

16GB eMMC FLASH

Samsung eMMC 5.0 fastest embedded memory, with an interface speed of 400MB/s

For Android is ok, considering that we can add anytime a microSD or USB flash drive.

For Linux(as desktop replacement) I think we need a proper HDD (or SSD) which will be connected via SATA to LandingShip (of course, we can use also microSD or USB flash drive). Later edit: All applications which is about in the article fit in 5GB. Actually it seems to be sufficient flash memory for Linux common use.

Step 2: As TV Box

as Android TV Box

Also I will pass quickly over the chapter "as TV box". Probably is one of the best TV Box on the market today. I'm not a specialist in this area, I'm not a professional reviewer, so it's just a personal opinion.

Anyway it's nice to have a 40 inch tablet… :) … with wireless mouse… and wireless keyboard… and remote control...,

... and play “Pool Billiards Pro” with some of my guests. (so I will need at least another one to use as TV Box)

I could not test the capabilities of 4KUHD because I do not own a TV with this capability, but I can testify it works perfectly on my HD TV.

And do not tell anyone: I played Boom Beach after I arrived by accident to see some ads with "Dr. T", they are insane...


At that time I looked for some UHD Demo videos on YouTube app. Even if I saw them only on a full HD TV, it was quite an experience to see that little device working that way.

Finally, the performances were amazing in Android.

Step 3: LandingShip

It is a beauty (I'm in love) ... :) ... Indeed. And looks better in reality.

With this add-on we can turn our GeekBox into a nice development board, with 60 GPIOs and many peripherals.

But most importantly it seems to me that it is able to connect a 2.5 HDD (It is nice that LandingShip comes with all necessary nuts and bolts for both HDD and GeekBox).

  • Power - 5V DC-IN with Over-Voltage Protection
  • S/PDIF x 1
  • Headphone Jack
  • Mic x 2
  • Display Connector (MIPI-DSI 20-Pins 1.27mm Header)
  • Camera Connector (MIPI-CSI 20-Pins 1.27mm Header)
  • USB HOST x 1
  • Sata 2.5-Inch x 1
  • RTC Battery CR1220
  • IR Receiver
  • LEDs x 2 (Power Indicator, Sata R/W Indicator)
  • Buttons 2 x 2 User Buttons (Key1...4)
  • Buzzer
  • GPIOs 60-Pins 2.54mm GPIO Header

TIP. Keep in mind the extra power needed for HDD or other devices ... You may need to switch to a powerful power supply.

Step 4: As Open Source Project

We have a lot design information about this device. And not only about the main project, but for the other peripherals and modules.

Hardware Design Data:

Yes… we have schematics … so what? It seems that it is not quite open source hardware, because they did not provide us PCB design data… Well… you are right, is not full open source hardware. Anyway I think this files would not have been too useful for us. I suppose they were made with an expensive proprietary CAD EDA software.

TODO: Make a gEDA version of the project with 4 layers (try 2 layers also). This project hardware design can be starting point for some new (open source) devices (...right now I am thinking about a rugged HMI for a SCADA system).

Firmware:

Windows tools:

Linux tools:

Also we have Linux version for tools (actualy I use Ubuntu 15.10 64-bit for flashing GeekBox ROM).
I think it will work to flash GeekBox from another GeekBox(with Linux installed). I have not tried it yet, because I not have two GeekBox ... yet.

GitHub Geekbox repositories:

Forum:

Forum is very useful. I used to make first steps with geekBox. There is an active and friendly community there. Also we can meet there ( there will be my user)

Step 5: Flashing Lubuntu

Flashing (or installing) Lubuntu.

This step is made on host (in my case a laptop i3-M330 with 8GB and Ubuntu 64-bit). I insist on this because it is easy to confuse where are we actually working (or did it happen only to me?).

Even if GeekBox comes preinstalled with dual boot Android / Ubuntu, after I played around with this setup, I rushed to install only Ubuntu, to benefit from the full storage space only for Lubuntu.

For that task I downloaded an install upgrade tools for Linux. Obviously there are equivalent tools for windows. Both seems are well documented here:

I will follow the Linux way:

sudo ./upgrade_tool

Step 6: First Steps in Lubuntu

Lubuntu – first steps on geekBox.

First I rewrite password for geekbox user:

sudo passwd geekBox 

After that I installed synaptic ... it is more convenient for me to work with synaptic.

sudo apt-get update 
sudo apt-get synaptic

Also I installed KGrab in order to make screen-shots of my work. And GIMP to crop and edit these screen-shots.

Tip. If your monitor not well detected by geekbox you can look in file:

/sys/class/display/HDMI/modes 

And edit:

/sys/class/display/HDMI/mode

Also I installed Baobab and BleachBit:

sudo apt-get update
sudo apt-get install baobab
sudo apt-get install bleachbit

I highly recommend you to install both... you will see later why :)

Step 7: As Desktop Replacement

We always have to do paperwork so here is one of the best free and open source office suite.

Libre Office - "Moved by Freedom. Powered by Standards" - I like their motto

I will put a screenshot with every application.

  • Writer
  • Calc
  • Impress
  • Draw
  • Math
  • Base
sudo apt-get install libreoffice

or with synaptic.

For reading pdf files I installed Okular. "Okular - more than a reader" - yes installation was worth.

sudo apt-get install okular

Step 8: As Programming Workstation

For my tests I chose to try Qt Creator and Lazarus. I use Synaptic Package Manager to search and install them from repository.

QTCreator:

To put things in context I must say something about project used as test. It is a small project of mine called "Project Phoenix". In short it is a small IDE that which aims to help me to compile an edit from same interface code for different microcontrollers(like atmega, sam, stm32), using different libraries (including Aduino cores and Arduino libraries) and different compilers, and different flash tools.

So It is a "real" project not a "dummy" test, and I will probably use this platform to continuing the development. I think it would be an interesting thing to have a project first available on ARM and secondary to others platform.

Lazarus: - "Write once compile anywhere"

For Lazarus I do not have a project in progress right now... but certainly is a framework that I love.

Step 9: As Embedded Development Workstation

USBASP + AVRDUDE

To make avrdude(and later Arduino) work with USBASP in Lubuntu we need to create a file with the following name: /etc/udev/rules.d/99-USBasp.rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="geekbox" MODE="0660"<br>

Arduino IDE

I met some errors when installing arduino from synaptic (It was probably my network), so after:

sudo apt-get autoclean
sudo apt-get clean 
sudo apt-get autoremove 
sudo apt-get -f install

... everything was ok.

I ran blink example on my Arduino Mega 2560 clone without any problem. Then I installed my custom boards for Atmega16/32/1284. In fact is one board ... just MCU is changed... and sometimes quartz... see photo above (number 5).

As we can see Arduino package is a "little" outdated. Even so it works well with Atmega based boards.

Next step: TODO: compile latest Arduino IDE from source. I have already made some steps as training: I have compiled 64-bit version on my Ubuntu laptop.

AVR-GCC

Installing Arduino package also will install avr-gcc... which is a nice side effect. Otherwise we can install it separately.

avr-gcc --version
avr-gcc (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MCU 8051 IDE

... an old friend ... :) the name speaks for itself. Test project compiled ok.

SDCC

It is required by MCU 8051 IDE, but it is useful anyway... so

sdcc --version
SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.3.0 #8604 (Dec 30 2013) (Linux)

GCC ARM NONE EABI

in fact package name gcc-arm-none-eabi as we can see in screenshot from synaptic. Bare metal compiler for embedded ARM chips using Cortex-M0/M0+/M3/M4, Cortex-R4/R5/R7 and Cortex-A* processors.

My usage is for STM32 MCUs and Atmel SAM3 MCUs.

arm-none-eabi-gcc --version

yes.. is there:

arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Step 10: As EDA Workstation

Electronic design automation (EDA)

The design of electronic circuits and PCBs are among my main preoccupations. And only with Free and Open Source Software. So I installed my favorite programs for this activity:

gEDA Project:

  • gschem
  • pcb
  • gerbv

Above I put screenshots with gshem and pcb with a real project: a small board for atmega MCU's wich was manufactured last year (third image). Even if the project was not developed on GeekBox it is interesting to see how it behaves and how it feels.

KiCad - one of the best:

Even if I put two screenshots with kicad running on GeekBox, worth a visit to "Made With KiCad".

Fritzing - a good result on GeekBox.

All three applications can be found in repository and can be installed with synaptic or command line:

sudo apt-get update
sudo apt-get install kicad
sudo apt-get install geda
sudo apt-get install fritzing

Step 11: Mad Experiments

As a mad scientist and I have to do some mad experiments... Now, you can imagine Kowalski from "The Penguins Of Madagascar" or Doctor T from Boom Beach Game... :)

So I installed DOSBox and afterwards I installed Norton Commander and FoxPro 2.6. Craziness ... there a screen saver in Norton Commander ... some flying floppy disks. I have not seen this for over 15 years. I have to put some screenshots with it. Done. Image number 5.

If you think installing DOSBox and FoxPro seems useless and foolish ...well... think again. Recently I had to help a friend to keep alive an IT system (old system). This is composed of dozens of computers who had installed a special board (custom board, made localy with 10-15 years ago) that can be used only with a dedicated application made under FOXPRO26. So therefore I needed to remember some foxpro/dbase commands. (In 1991, in a data center, I used dBase II for CP/M on a 8080 machine named TPD - acronym from "Terminal de Pregatire a Datelor", in English: Terminal for Data Preparation.)

Conclusion.

I can use this little beauty also to accomplish this kind of exotic tasks... Like my Linux main system. Another point to geekbox as an open source design. Another point for open source model... Meanwhile I put the DOSBox on my Android phone ... DOSBox was compiled for Android too. Another point for open source... and counting...

Step 12: Mad Experiments - More Madness...

So... I was trying to work with QT Creator. Not only a simple setup and run some tests. I am trying to see how it feels to work effectively. And I started to work on an (not so)old project of mine called "Project Phoenix". Everything was going well, without the slightest problem. I was very happy that a project that was started a while ago in Windows, I continued on Linux(Ubuntu - Intel processor), and now I can work on Lubuntu installed on ARM device. Hooray! It's party time! So I felt the need to put some music on headphones.

I connected the headphones to stereo jack from landingship...run VLC... and nothing... Back to forum and read about it: "You need to add the driver supports it !Please refer to the principle diagram(http://www.mediafire.com/view/9imdguxbdbmsbp5 /Landingship_V1.23.pdf)"...not right now ... I have something else to do...

No big issue. I pulled the drawer and find an old USB soundcard (ok... It looks more like a box.. so it' s a soundbox) "M-330 7.1 Channel USB 2.0 Sound Box". It's bigger than geekbox (look at image 3).

So I plug this USB device ... VLC is running and playing some mp3 ... I go to Audio -> Audio Device and select 3rd device that magically appeared there... And I discovered that I left VLC at full volume... :) ...but it worked just perfect.

I have compiled the project, I run and CPU Usage reach maximum 12%. And Memory Usage 598 MB of 2000 MB.

So... I edit this instructable right now using GeekBox... I make a screenshot to prove that ... and I have a feeling that I don't now where I work ... on target machine ... or host machine ... madnes... more madness...

Step 13: Conclusions

This article is more like a drive test than a step-by-step or "how to..." instructable.

Also it is a tribute to open source and free software philosophy. Philosophy which now has generated projects like this, an open source hardware project.

After I settled a bit with whole setup, including 2 mice, 2 keyboards, 2 usb hubs, 1 monitor(DVI+VGA input), and 1 desk... things went very fluent. Many times I was not aware on what machine I work.

The computer that I use now as the "main" computer is a laptop with this configuration (I put it here to have a intuitive perception about this comparation):

  • Processor: Intel® Core™ i3 CPU M 330 @ 2.13GHz × 4
  • Graphics: Intel® Ironlake Mobile
  • Memory: 8 GB
  • OS: Ubuntu 15.10 64bit
  • HDD: 500GB - 7200RPM
  • ... and work at speed of light with this version of Ubuntu.

So I was surprised by how it feels GeekBox by comparison with system described above. The only drawback is the lack of video acceleration (in Lubuntu, for Android is a different story).

TODO: Try to use /experiment with binary android GPU driver. I know that is not the right way for an open source follower ... but I want to try this...

There are so many things that can be done further! I want to try them all, but sure I will not have time to do everything... I want to build my own Ubuntu system from scratch, to try another distro like Arch Linux and Gentoo Linux

Working with GeekBox as development / experimental board also leads me to another direction... What happens if I will use this project as a blueprint for my own project ... I will gradually change components, hardware and software... one by one .. step by step... in some iterations I will make another project .. with another processor.. another platform... maybe less powerful... maybe more open... Now I have more courage to start something like that.

And that is the main advantage of GeekBox project (and other similar projects): Learn to master development of a project as a whole, hardware, software, toolchain, peripheral, drivers, libraries, schematic design, PCB design an so on... It may seem overwhelming at first sight, but working on steb by step and piece by piece, appears possible even for one person to manage a project like this. Sky is the limit...

Step 14: In the End

I do not want to end without clarify some things which may be misinterpreted.

I am very glad that there is an alternative to the Intel platform, and that alternative can compete in this way. But I don't think Intel is the enemy. On the contrary, Intel is one of the big players friendly to open source world.

"Intel has a long history of producing or commissioning open source drivers for its graphics chips, with the exception of their PowerVR-based chips." - https://en.wikipedia.org/wiki/Free_and_open-sourc...

OOPS! PowerVR is "our" PowerVR G6110 ? Yes... "The owls are not what they seem." Twin Peaks TV Series -1990 - (Season 2, Episode 1).

And so we come again to the main drawback of using Linux on GeekBox: PowerVR GPU. So let's recap:

  • GeekBox use RK3368 SoC by RockChip
  • RK3368 use:
    1. Cortex A53 by ARMand
    2. PowerVR SGX6610 by Imagination Technologies.

What's up with PowerVR?

"PowerVR is a popular 3D graphics engine found in phones, netbooks, and laptops, for which we currently have no free software driver capable of doing 3D graphics acceleration. If you are interested in working on this project, please introduce yourself and help with building the wiki page detailing the work that needs to be done, including making free firmware for the PowerVR graphics processor." - Free Software Foundation - High Priority Reverse Engineering Projects

So ... So we blame it on Imagination Technologies? Again, do not rush...Imagination Is Hiring A PowerVR Linux, Open-Source Driver Developer - article by Michael Larabel - 14 July 2015.

We do not know at this time how and when open source drivers will be available, but surely we can realize:

Things are moving very quickly in this area... so: Go Open Source or die. It is not my wish. It's just an observation. It is not important whether we like it or not. It will happen. Sooner or later. Sooner. Already happening...

Some interesting links:

The Real End:

I began this article with a quote from the Matrix, and I will end this article with a quote from Matrix: ... :)

"I know you're out there. I can feel you now. I know that you're afraid... you're afraid of us. You're afraid of change. I don't know the future. I didn't come here to tell you how this is going to end. I came here to tell you how it's going to begin. [...] Where we go from there is a choice I leave to you."