Thursday, March 25, 2010

QT Media Player on mini2440

To run the media player example in QT we require cross-compile Gstreamer as back-end
cross compiling gstreamer was made comparatively easy for me,thanks to Mr. Felipe Contreras blog.

This is the link to his blog.

For my board mini2440 I cross compiled the following source and installed in "/opt/gst" in my root filesystem.
  • glib
  • gstreamer
  • liboil
  • gst-plugin-base
  • gst-plugin-good
  • gst-plugin-ugly

Now you cross compile QT4.6 with phonon enabled,and linking the gstreamer library.

export PKG_CONFIG_PATH=/opt/gst/lib/pkgconfig

./configure -prefix /opt/qt-4.6/build -debug -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -optimized-qmake -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-feature-CURSOR -no-sm -no-xinerama -no-xshape -webkit -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb -qt-kbd-tty -confirm-license -qt-mouse-tslib -phonon -I /opt/gst/lib/glib-2.0/include -I /opt/gst/include/glib-2.0 -I /opt/gst/include/gstreamer-0.10/gst -L /opt/gst/lib -L /opt/gst/lib/gstreamer-0.10 -force-pkg-config -v


After doing 'make install' the libraries are installed on '/opt/qt-4.6/build'

create '/opt/qt-4.6/build' in mini2440 filesystem copy QT related libraries.
create '/opt/gst/lib' in mini2440 copy the contents of the '/opt/gst/lib' on PC to mini2440 filesystem's '/opt/gst/lib'

once this is done cross compile the QT MediaPlayer example in QT Source tree, and copy it on the board and run it.


please don't forget to update the 'LD_LIBRARY_PATH' in the environment variable.


export LD_LIBRARY_PATH=$QTDIR/lib:/opt/gst/lib

Please see my previous blog on crosscompiling QT for mini2440 board for details.



Wednesday, February 10, 2010

Adding new driver on Linux2.6.30 source tree

Introduction:

This section deals with adding new driver onto the Linux source tree,I have added Lumidigm Venus Driver as character driver.

step 1: copy the driver source code(vcom.c) and into character folder of Linux source tree.

step 2: Edit the Kconfig file in the char folder and add the following line.
config LUMIDIGM
bool "Limidigm fingerprint USB driver"
depends on ARCH_S3C2440
default m if ARCH_S3C2440
help
say Y here to select,otherwise say N.
The Above configuration will give the option to the user for select/deselect Lumidigm driver,for S3C2440 Architecture with default as driver selected.
And help will display "say Y here to select,otherwise say N."

step 3: Edit Makefile in the char folder and add the following line
obj-$(CONFIG_LUMIDIGM) += vcom.o
prefix "CONFIG_" before "LUMIDIGM" flag as set in KConfig file.
save the configuration and do a menuconfig to verify the changes.

on menuconfig we will see the "[*] Limidigm fingerprint USB driver" in Device Drivers ---> Character devices --->

Friday, December 11, 2009

Qt Application development on mini2440

Introduction

This blog emphasize on building QT based GUI application for embedded linux , Its describes on setting up the IDE for QT ,cross compiling QT 4.5 libraries for embedded application on mini2440 board in particular.


Setting QT Creator (IDE).

Qt Creator is a new cross-platform integrated development environment (IDE) tailored to the needs of Qt developers, Qt SDK includes the tools you need to build cross-platform applications with Qt in a single install.

Qt libraries

Qt Creator IDE

Qt development tools


Use the below link to download Qt SDK.

http://get.qt.nokia.com/qtsdk/qt-sdk-linux-x86-opensource-2009.05.bin

Login as root to the host machine and run the the binary file on the command promt.

LinuxHost>chmod +x qt-sdk-linux-x86-opensource-2009.05.bin

LinuxHost>./qt-sdk-linux-x86-opensource-2009.05.bin

Now once the installation is complete,run the QT Creator by clicking on desktop icon.


Navigate Tools->Options

Select the Qt installation path, in my case it is PATH “/opt/qtsdk-2009/qt”.

Now click on rebuild button to configure it,on success Qt creator will check the 'Debugging Helper'

The IDE is set to develop QT application for the Host machine.



Cross compilation of QT 4.5.3 for mini2440 board.

  1. Download the compressed package

http://qt.nokia.com/downloads/embedded-linux-cpp

now extract qt-embedded-linux-opensource-src-4.5.3.tar.gz to an appropriate folder and configure the source,it is assumed that the cross compiler is installed and the path is updated in the environment variable.



\path-to-mini2440\>tar -zxvf qt-embedded-linux-opensource-src-4.5.3.tar.gz

\path-to-mini2440>cd qt-embedded-linux-opensource-src-4.5.3

\path-to-mini2440\qt-embedded-linux-opensource-src-4.5.3>:



2. Compile the qt-embedded-linux-opensource-src-4.5.3. Remove some unnecessary features, keep most of the commonly used functions, and add support for the tslib touch screen recalibration.

./configure \
-prefix /new_disk/Hiteg/qt/build/ //specify the directory for installation,
-release -shared \
-fast \
-pch \
-no-qt3support \
-qt-sql-sqlite \
-no-libtiff -no-libmng \
-qt-libjpeg \
-qt-zlib \
-qt-libpng \
-qt-freetype \
-no-openssl \
-nomake examples -nomake demos -nomake tools \
-optimized-qmake \
-no-phonon \
-no-nis \
-no-opengl \
-no-cups \
-no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm \
-no-xinerama -no-xshape \
-no-separate-debug-info \
-xplatform qws/linux-arm-g++ \
-embedded arm \
-depths 16 \
-no-qvfb \
-qt-gfx-linuxfb \
-no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb\
-qt-kbd-usb \
-confirm-license \
-qt-mouse-tslib

$ make (or gmake)
$ make install (or gmake install)
3.Build filesystem, copy necessary Qt libraries to the filesystem directory:
cd $rootfs #$rootfs is the filesystem directory

mkdir new_disk/hiteg/qt/build –p && cd new_disk/hiteg/qt/build
cp /new_disk/hiteg/qt/build/lib/libQtCore.so ./
cp /new_disk/hiteg/qt/build/lib/libQtGui.so.4 ./
cp /new_disk/hiteg/qt/build/lib/libQtNetwork.so.4 ./
mkdir fonts

copy the fonts that you want to implement in your Qt:

cp /mnt/qt/build/lib/fonts/xxxxx.qpf fonts


Installing tslib library on mini2440


  1. Where to download tslib source code.
    addr1 http://www.zelow.no/floppyfw/download/Development/src/(I suggest use this one)
    addr 2 http://mail.pdaxrom.org/download/1.1.0beta3/src/

2. How to compile
We've to manual set some enviroment virables. and correctly configure the source code. I show you a build file wrote myself:
#step 1 play a trick
echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.autogen

#step 2 set the enviroment
export CC=/cross-compile/bin/arm-linux-gcc
export CXX=/cross-compile/bin/arm-linux-g++
export CONFIG_SITE=arm-linux.autogen
#step 2
./configure --build=i386-linux --host=arm-linux --target=arm --disable-inputapi --prefix=/new_disk/Hiteg/qt//build

do make and make install,you will get what you want under ./build. Actually you can set the prefix as your root_fs befor hand then after the "make install" these file are stay on position.


3. Copy the libraries to the standard library path in file system and make it available to the application.

3.1 initialize the environment setting first, you'd better place them in /etc/profile or other place you like.
QTDIR=/new_disk/Hiteg/qt-arm/build
LD_LIBRARY_PATH=$QTDIR/lib
TSLIB_CONSOLEDEVICE=none
TSLIB_FBDEVICE=/dev/fb0
TSLIB_TSDEVICE=/dev/input/event0
TSLIB_CALIBFILE=/etc/pointercal
TSLIB_CONFFILE=/usr/local/etc/ts.conf
QWS_SIZE=240x320
QWS_DISPLAY="LinuxFb:mmWidth135:mmHeight155"
QWS_MOUSE_PROTO="Tslib:/dev/input/event0"
TSLIB_PLUGINDIR=$QTDIR/lib/ts
export USER LOGNAME PS1 PATH
export QTDIR
export LD_LIBRARY_PATH
export TSLIB_CONSOLEDEVICE
export TSLIB_FBDEVICE
export TSLIB_TSDEVICE
export TSLIB_CALIBFILE
export TSLIB_CONFFILE
export QWS_SIZE
export QWS_DISPLAY
export QWS_MOUSE_PROTO
export TSLIB_PLUGINDIR


Monday, September 14, 2009

Porting uClinux 2.6 on AX4510


This section is about porting uClinux on ARM 7 based S3c4510 samsung processor.




About AX4510
This is ARM7 Development Board based on Samsung S3C4510B Microcontroller
  • Dimensions: 177 x 130 mm
  • 5.0V DC or USB power supply
  • 4 M bytes Flash(2M x 16bit)
  • 16 M bytes SDRAM(2M x 32bit)
  • 2K x 8 EEPROM
  • 2x RS232
  • USB connecter
  • 10M/100M Ethernet interface connector(RJ45)
  • IDE44 port: for 2.5" hard disk
  • LCD port
  • 2 PS2 port
  • 4 key buttons
  • Reset button
  • 4 LEDS
  • Beeper
  • 20-pin JTAG interface connector
  • all the pins of CPU expand out


About uClinux
uClinux as an operating system includes Linux kernel releases for 2.0 2.4 and 2.6 as well as a collection of user applications, libraries and tool chains,it basically meant to support processor without Memory Management unit.


Essential Tools and Source for Download.
arm-elf-tools-20040427.sh
GCC 2.95.3 with linux 2.6 patch and binutil 2.14 based ARM-ELF toolchain which is made based linux 2.6.5-hsc2 is available for kernel and userland applications compile.It compiles the 2.4 kernel and applications.

uClinux-dist-20040218.tar.gz distribution, this is a full source package, containing kernel, libraries and application code.

linux-2.6.9 vanilla kernels and adds patches relevent to AX4510 http://www.kernel.org/pub/linux/kernel/2.6/linux-2.6.9.tar.bz2

uClinux patch for linux-2.6.9

http://www.uclinux.org/pub/uClinux/uClinux-2.6.x/linux-2.6.9-uc0.patch.gz

MMU less ARM patch -
Name: Hyoks patch
http://opensrc.sec.samsung.com/download/linux-2.6.9-uc0-hsc0.patch.gz


Steps to build the image and downloading to ram.
1.extract uClinux distribution and remove all the existing linux kernel versions.
  • tar -zxvf uClinux-dist-20040408.tar.gz
  • cd uClinux-dist-20040408
  • rm -rf linux-2.0.x linux-2.4.x linux-2.6.x
2. Extract these patches and apply them one after another.
  • gunzip -d linux-2.6.9-uc0.patch.gz
  • gunzip -d linux-2.6.9-uc0-hsc0.patch.gz
  • \linux-2.6.x> patch -p1 < ../linux-2.6.9-uc0.patch
  • \linux-2.6.x> patch -p1 < ../linux-2.6.9-uc0-hsc0.patch
3. Copy relevent configuration files in vendor directory
  • \uClinux-dist-20040408>cp linux-2.6.x/arch/armnommu/configs/espd_4510b_defconfig vendor/Samsung/4510B/config.linux-2.6.x
  • \uClinux-dist-20040408>cp vendor/Samsung/4510B/config.vendor-2.4.x vendor/Samsung/4510B/config.vendor-2.6.x
4. edit 'vendor/Samsung/4510B/rc' file in uClinux-dist directory, change '/dev/ram0' to '/dev/ram1'

5. Edit the Kernel linker file to include the ROMFS

edit file 'linux-2.6.x/arch/armnommu/arch/kernel/vmlinux-lds.S', Add the below lines

  • 81 *(.got) /* Global offset table */
  • 82
  • 83 romfs_start = .;
  • 84 romfs.o
  • 85 romfs_end = .;


6. Configure the kernel using menuconfig,
Block devices --->Default RAM disk size (kbytes) to 2100
General setup ---> (root=/dev/ram0 initrd=,2100k keepinitrd) Default kernel command string

Note:
start address of ramdisk can be determined only compilation of uclinux,
this information can retrieved from System. map file after it is build. so I needed to recompile the uClinux with the updated ramdisk start address.
  • make lib_only
  • make user_only
  • make romfs
  • make image
  • make all
7. image.ram is created in images folder of the distibution and this can be downloaded to ram using tftp.

  • \uClinux-dist-20040408>cd images/
  • \images>tftp 192.168.1.2
  • \images>put image.ram

Thursday, September 10, 2009

Configuring OPENSER as proxy

OpenSer is easily configurable and modular, the necessary configuration is done in openser.cfg. This take care of the incoming SIP messages and routing them to server address configured.The proxy also makes a few checks (and modifications) on the message and sends an error message if necessary.


Edit the Makefile, and at line 287 change this instruction:

Install: all mk-install-dirs install-cfg install-bin install-modules \
install-doc install-man

To

Install: openser mk-install-dirs install-cfg install-bin install-modules \
install-doc install-man

Now, making sure that you have super-user privileges, execute:

> make install
Setting up the OpenSER proxy
Edit openser.cfg

# ----------- global configuration parameters ------------------------

#Uncomment these lines to enter debugging mode
debug=9 # debug level
Fork=no
Log_stderror=yes


check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
listen= ip this pc will listen on
port=5060
children=4
fifo="/tmp/openser_fifo"
load modules and set parameters

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/openser/modules/mysql.so"

loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"

loadmodule "/usr/local/lib/openser/modules/registrar.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 0)

# -- rr params --
# add value to ;lr param to make some broken UAs happy

modparam("rr", "enable_full_lr", 1)
Changes in main routing logic
replace
if (method=="REGISTER") {..}
with
if (method=="ACK") {
route(1);
exit;
} if (method=="INVITE") {
route(3);
exit;
} else if (method=="REGISTER") {
route(2);
exit;
};


Add the route[2] and route[3] function for proxy behaviour in openser.cfg


route[2] {
#rewrinting the host allows the registrar to know that the message is destined for it
rewritehost("192.168.1.103"); # openser server ip address
if(!t_relay_to_udp("192.168.1.103","5060")) {
sl_reply_error();
};
exit;
}

route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
lookup("aliases");
if (uri!=myself) {
route(1);
exit;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
exit;
};


Now use this configuration script in 'usr/local/etc/openser/'

Thursday, August 27, 2009

Porting openSER 0.9.5 Server on LN2410 baord

About SIP

SIP is an application-layer protocol used to establish, modify, and terminate sessions or multimedia calls. These sessions can be conferences, e-learning, telephony over the Internet, and similar applications.


The SIP protocol supports five features for establishing and closing multimedia sessions.

  • User location: Determines the endpoint address used for communication.

  • User parameters negotiation: Determines the media and parameters to be used.

  • User availability: Determines if the user is available or not to establish a session.

  • Call establishment: Establishes the parameters for caller and callee, and informs on call progress (ringing, ringback, congestion) to both parties.

  • Call management: Session transfer and closing.

SIP Operation Theory

The entire SIP signaling flows through the SIP proxy server. On the other hand, the media signaling, transported by the RTP protocol, flows directly from one endpoint to another.


SIP Entities

  • UAC (user agent client)—Client or terminal that starts the SIP signaling.

  • UAS (user agent server)—Server that responds to the SIP signaling coming from a UAC.

  • UA (user agent)—SIP terminal (IP phone, ATA, softphone).

  • Proxy Server—It receives requests from a UA and transfers them to another SIP proxy if this specific terminal requested is not under its domain.

  • Redirect Server—This receives requests and sends back to the caller including data about the destination, instead of sending directly to the callee.

  • Location Server—This provides the callee's contact addresses to Proxy and Redirect Servers.



Openser-0.9.5 is older version of opensips and is compatible with gcc 2.95 cross compiler used for building the filesystem of LN2410, hence this version is used for porting openser on LN2410 board

Requirements
----------------
a. cross-2.95.3.tar.bz2(gcc cross compiler version 2.95)
b. Openser-0.9.5
c. flex 2.5.33

Flex cross compilation
a. Download flex source code and follow the steps to configure and build the library.
(It is assumed that cross compiler is installed and path is set in shell enviroment.)
tar -zxvf flex-2.5.4a.tar.gz (http://flex.sourceforge.net/)
cd flex-2.5.4
mkdir /home/guest/flex_lib
this folder is used save flex library.
b. ./configure --prefix=/home/guest/flex_lib --build=i686-pc-linux-gnu --host=arm-linux --target=arm-linux CC=arm-linux-gcc
c. Changes in Makefile
CC = arm-linux-gcc
AR = arm-linux-ar
RANLIB = arm-linux-ranlib

d. make prefix=/home/guest/flex_lib all
e. make prefix=/home/guest/flex_lib install

openser-0.9.5 cross compilation

a. download openser-0.9.5 and perform the steps to cross compile and build the executable
tar -zxvf openser-0.9.5_src.tar.gz (http://www.openser-project.org/pub/openser/)
b. Changes in Makefile.def
RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
OS = linux
ARCH = arm
OSREL = 2.6.13.2
#set some vars from the environment (and not make builtins)
CC := arm-linux-gcc
line # 301
DEFS+= $(extra_defs) \
-DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
-DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
-DCFG_DIR='"$(cfg-target)"'\
-DPKG_MALLOC \
-DSHM_MEM -DSHM_MMAP\

line# 847
LIBS= -L/home/guest/flex_lib/lib/ -L /lib -lfl -ldl -lresolv
c. mkdir /openser_lib
d. make prefix=/openser_lib skip_modules="mysql" modules
e. make prefix=/openser_lib install
f. copy the /openser_lib to LN2410 filesystem
cp /openser_lib /media/disc/ -rf

g. changes in /etc/openser/openser.cfg

# ----------- global configuration parameters ------------------------

debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)


check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/openser_fifo"

h. run openser on LN2410
./openser_lib/sbin/openser -m 8
you check the server process using the ps command

Using the server
There are plenty of soft-phone available on the net(e.g ekiga,twinkle) you can select any one of them,install on the PC, for windows user you can use windows messenger client to communicate with other softphone.

Communication can achived in siple steps.
1. Register the Softphones to server.
2. call the other softphone using the uri (sip:2000@192.168.1.103)
note: The server configuration allows registeration is without authentication hence you can register using any user id.

Kermit for Serial communication

Kermit handles both modem and TCP/IP connections,I have used it for serial communication on LN2410,it is simple configure and use compared to minicom.

Download Kermit from below link.
http://www.columbia.edu/kermit/ck80.html#source

To build and install follow the steps below.
1. mkdir Kermit
2. mv /path-tokermit-source/cku211.tar.gz Kermit
3. tar -zxvf cku211.tar.gz
4. make linux
5. make install

create a file ".kermrc" in /root/ folder with the following details and save it.

Contents of ".kermrc" file begins
set line /dev/ttyS0 /* Kermit uses Serial port 0*/
set speed 115200 /* Baud rate on which this operate*/
set carrier­watch off
set handshake none
set flow­control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5

Contents of ".kermrc" file ends

Now connect LN2410 board to PC and type kermit on command line. type connect on command line to get the uboot shell type 'Ctrl' + '\' and 'u' keys to return to kermit prompt

To send a file to LN2410 type 'send /filename' on command promt