This post is to show a real example for cross compiling SDL library for target arm board and include all necessary steps from downloading the library to installation of the compiled package to the root file system for target board.


For this real example, I worked with below settings.


Host machine: Ubuntu 12.04 x86-64 bit

HW: Beaglebone black(BBB) with 4GB uSD card

OS: Ubuntu 13.04 (http://rcn-ee.net/deb/rootfs/raring/ubuntu-13.04-console-armhf-2013-07-22.tar.xz)

Toolchain for cross compile: Refer to below Step 0.






For the first time you need to get prebuilt image for Ubuntu 13.04 version and prepare bootable SD card.


Step 0: Preparing toolchain and building Linux kernel for BBB


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

After running ./build_kernel.sh , there will be toolchain installed at linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux and also linux kernel binary can be found.


Step 1. For flashing uSD card with Ubuntu 13.04 image, refer to the following link

http://elinux.org/BeagleBoardUbuntu


If you follow the guide in the above link without any error, u can have the uSD burned with bootable image and with it in uSD card slot, you can boot Ubuntu 13.04 on BBB.


Step 2. Now its time to do cross compile SDL.


For this, you need to prepare root file system for BBB before compilation of SDL and you can find the prebuild root file system file in the above file.


Unpack image:

tar xJf ubuntu-13.04-console-armhf-2013-07-22.tar.xz
cd ubuntu-13.04-console-armhf-2013-07-22
sudo tar xfv armhf-rootfs-ubuntu-raring.tar -C ~/rootfs/

Ok. root file system is ready. 


Step 3. Next step is downloading SDL package.

cd ~/rootfs/home/ubuntu
wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar xvfz SDL-1.2.15.tar.gz
cd SDL-1.2.15

For proper compilation and installation, you need to make sure that proper toolchain for BBB (refer to step 0) and inform path to tool chain to Configure script.


Step 4. Configuring and compiling SDL

Below is a script doing configuration and make for my setting. Some modification of this script may be needed to different setting.

Write down a shell script with below content and run it.

Note: Need to replace <user> in the above box with proper name to your system.



Step 5: Installation SDL to target root file system

Now if there is no error after running this script than you can install SDL package to target root file system running below command:


sudo make install


All setup is completed. As like this, you can install other libraries too, for example SDL_image library. 

End.


Next post will be how to make a sample SDL project which will run on target board with help of CMake.




Posted by kevino
,