Quick Guide for compiling TVPad apps and programs

Now that everybody can have root access to their TVPads, here are the basic steps to create / compile your own apps. Most of these steps are thanks to pakeonoahu who was my mentor when I started all this.

A Linux machine is required. I installed Ubuntu within a VirtualBox VM for this.

For those who are going to try this, please provide feedback in case something needs to be changed / corrected. I did these steps like 2 years ago I think, I may have forgotten something.

Some free Qt apps can be found here for test purposes. I was able to run one of these on my TVPad. The TMP app was the first and only app that I fully created in Qt, all my other custom apps were some hacked version of TVPad's own apps.

Have fun!


-------------------------
Cross-Compile OpenSSL
-------------------------

- Download OpenSSL source code from http://www.openssl.org/source/
- Run: tar xvf openssl-1.0.1h.tar.gz
- Run: cd openssl-1.0.1h/
- Run: ./Configure os/compiler:arm-none-linux-gnueabi-gcc -static


-------------------------
Setting up Qt environment
-------------------------

On Linux:
- Download the TCC89XX LINUX SDK.
- Extract the compiler and install it on /opt , ie: /opt/armv6/codesourcery
- Set your path in your .bashrc: PATH=$PATH:/opt/armv6/codesourcery/bin
- Link the codesourcery compiler because of the embeded QT callling for arm-linux-g(xx) when compiling:

ln -s arm-none-linux-gnueabi-g++ arm-linux-g++
ln -s arm-none-linux-gnueabi-gcc arm-linux-gcc
ln -s arm-none-linux-gnueabi-ar arm-linux-ar
ln -s arm-none-linux-gnueabi-as arm-linux-as

- Because QT on the TVPad is 4.5.3, download "qt-embedded-linux-opensource-src-4.5.3.tar.gz" and "qt-x11-opensource-src-4.5.3.tar.gz".
- Run: mkdir qt;cd qt
- Run: tar zvxf ../qt-embedded-linux-opensource-src-4.5.3.tar.gz
- Run: tar zvxf ../qt-x11-opensource-src-4.5.3.tar.gz
- Run: export QT4DIR=$PWD/qt-x11-opensource-src-4.5.3
- Run: export QTEDIR=$PWD/qt-embedded-linux-opensource-src-4.5.3
- Run: cd qt-embedded-linux-opensource-src-4.5.3/

For SSL Support:
- Download the latest OpenSSL source code and extract it somewhere: tar zxvf openssl-1.0.1h.tar.gz
- Run: cd openssl-1.0.1h/
- Run: ./Configure os/compiler:arm-none-linux-gnueabi-gcc -static
- Run: make

- Run: OPENSSL_LIBS='-L/usr/local/ssl/lib -lssl -lcrypto' ./configure -embedded arm -xplatform qws/linux-armv6-g++ -v -openssl-linked -no-qt3support -debug -L /usr/local/ssl/lib -I /home/ubuntu/dev/openssl-1.0.1h/include

Note: If configure fails for any reason and you need to re-run it again, then make sure you run 'make confclean' before running ./configure again.

- Run: make
- Run: sudo make install

- If everything went well you will have it installed in /usr/local, add this to your PATH. For example:

echo "PATH=$PATH:/usr/local/Trolltech/QtEmbedded-4.5.3-arm/bin" >> ~/.bashrc
source ~/.bashrc


-----------------
Compiling Qt code
-----------------

On Linux:
- Run: qmake -project
- Run: qmake
- Run: make

Note: You can also use Qt Creator on Windows and then cross-compile your apps on Linux. I used Qt Creator 2.5.2 with Qt SDK 4.5.3 for that purpose.


----------------------------
Compiling general C/C++ code
----------------------------

On Linux:
- Inside your source directory, check Makefile to see if it will take variable from stdin, for example if it takes the CC option:

make CC="/opt/armv6/codesourcery/bin/arm-none-linux-gnueabi-gcc -static"

- Add the -static parameter for static linked library.

- When the source code use "configure" to create the Makefile, just run "./configure --help", it will show you the variable/options to change ARCH (ie: --arch=arm, --enable-static, or "--cross-prefix=PREFIX use PREFIX for compilation tools []" or
"--enable-cross-compile assume a cross-compiler is used").
- After the Makefile is created, just type in "make" to compile, if everything went well, you will have your static linked binary.
- Strip the binary to make it smaller.
- For example:

CC="/opt/armv6/codesourcery/bin/arm-none-linux-gnueabi-gcc -static" ./configure --host=arm-linux ; make
arm-none-linux-gnueabi-strip strace
Sign In or Register to comment.