Labels

20/10/2010

Install Qwt in Ubuntu

(link to Install Qwt in Gumstix)

System info:
Ubuntu 10.04 (lucid)
Kernel 2.6.32-26-generic
Qwt: 5.21

Qwt library contains lots of GUI components, such as 2D plot widget.

Download .tar.gz file, extract it. go to that folder:
(PS: qwt-6.0.0-rc3 is quite buggy, use qwt-5.2.1)

$ cd qwt-6.0.0-rc3
$ qmake
$ make

Then, error occurs:


cd src/ && /usr/bin/qmake /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src/src.pro -unix -o Makefile
cd src/ && make -f Makefile 
make[1]: Entering directory `/home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/src'
compiling qwt_abstract_scale_draw.cpp
In file included from qwt_abstract_scale_draw.h:13,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_global.h:13:21: error: qglobal.h: No such file or directory
In file included from qwt_scale_div.h:14,
                 from qwt_abstract_scale_draw.h:14,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_interval.h:15:20: error: qdebug.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:14,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_scale_div.h:15:19: error: qlist.h: No such file or directory
In file included from qwt_abstract_scale_draw.h:15,
                 from qwt_abstract_scale_draw.cpp:10:
qwt_text.h:14:21: error: qstring.h: No such file or directory
qwt_text.h:15:19: error: qsize.h: No such file or directory
qwt_text.h:16:19: error: qfont.h: No such file or directory
In file included from qwt_abstract_scale_draw.cpp:11:
qwt_math.h:26:20: error: qpoint.h: No such file or directory
qwt_math.h:27:19: error: qmath.h: No such file or directory

...

When I installed Qt4 creator, it didn't install qt library and source files into the Ubuntu library system. When I use qt creator to compile a program, it uses it's own library files, not the system library files. When I "make" qwt, it is looking for the system library files (and head files .h)

Search the qt4 development installation files, which will install all qt4 library file and source file into system library.

$ apt-cache search qt4-dev

libqwt5-qt4-dev - Qt4 widgets library for technical applications (development)
libsmokeqt4-dev - development files for Qt 4 Smoke library
pyqt4-dev-tools - Development tools for PyQt4
python-qt4-dev - Development files for PyQt4
freecad-doc - FreeCAD documentation
libntrack-qt4-dev - Development package for libntrack-qt4
libqglviewer-qt4-dev - an OpenGL 3D viewer library based on Qt4 - development files
libqwtplot3d-qt4-dev - 3D plotting library based on Qt4/OpenGL (development)
libsoqt4-dev - Qt4 GUI component toolkit for Inventor - development
libsource-highlight-qt4-dev - Syntax highlighting library for Qt (development files)
libtelepathy-qt4-dev - Qt 4 Telepathy library (headers and static library)
libtulip-qt4-dev - Tulip graph library - Qt/OpenGL GUI development files
libvtk5-qt4-dev - Visualization Toolkit - A high level 3D visualization library
libavahi-qt4-dev - Development headers for the Avahi Qt 4 integration library
libpoppler-qt4-dev - PDF rendering library -- development files (Qt 4 interface)
libqt4-dev - Qt 4 development files
libqt4-qt3support - Qt 3 compatibility library for Qt 4
libqt4-sql - Qt 4 SQL module
qt4-dev-tools - Qt 4 development tools
qt4-doc - Qt 4 API documentation
qt4-doc-html - Qt 4 API documentation (HTML format)


$ sudo apt-get install libqt4-dev

then try install again:

$ qmake qwt.pro
$ make
$ sudo make install

done!

run Qt4 creator, no qwt widget!
google a round, need to copy libqwt lib file to Qt plugin folder:
$ cp /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer/libqwt_designer_plugin.so /home/czhang/qtsdk-2010.04/bin/designer

run Qt4 creator, still no new widget!

$ cd /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/designer/plugins/designer
$ ldd libqwt_designer_plugin.so

linux-vdso.so.1 =>  (0x00007fff92bff000)
libqwt.so.6 => not found
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f4205968000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f420571b000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f42049a1000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f42044cb000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f4203c76000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4203a59000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f4203745000)
libm.so.6 => /lib/libm.so.6 (0x00007f42034c1000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f42032aa000)
libc.so.6 => /lib/libc.so.6 (0x00007f4202f27000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f4202d21000)
librt.so.1 => /lib/librt.so.1 (0x00007f4202b19000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f420283b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f42025b4000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f420236c000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f4202163000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f4201f47000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f4201d3d000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f4201b08000)
libz.so.1 => /lib/libz.so.1 (0x00007f42018f0000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f42016de000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f42013a8000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f42011a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4206076000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f4200f75000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f4200d6f000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f4200b46000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f420092a000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f4200725000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f420051f000)


this means the libqwt lib files (libqwt.so.6 libqwt.so.6.0 etc) has not been installed in system library, which is in /usr/lib64 (I am using 64bit Ubuntu)
$ sudo cp -a /home/czhang/qtsdk-2010.04/qwt-6.0.0-rc3/lib/* /usr/lib64
$ ldd /home/czhang/qtsdk-2010.04/bin/designer/libqwt_designer_plugin.so

linux-vdso.so.1 =>  (0x00007fff823ff000)
libqwt.so.6 => /usr/lib/libqwt.so.6 (0x00007f38ab037000)
libQtScript.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtScript.so.4 (0x00007f38aab6e000)
libQtXml.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtXml.so.4 (0x00007f38aa921000)
libQtGui.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtGui.so.4 (0x00007f38a9ba7000)
libQtCore.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtCore.so.4 (0x00007f38a96d1000)
libQtDesigner.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtDesigner.so.4 (0x00007f38a8e7c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f38a8c5f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f38a894b000)
libm.so.6 => /lib/libm.so.6 (0x00007f38a86c7000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f38a84b0000)
libc.so.6 => /lib/libc.so.6 (0x00007f38a812d000)
libQtSvg.so.4 => /home/czhang/qtsdk-2010.04/lib/libQtSvg.so.4 (0x00007f38a7ecd000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f38a7cc8000)
librt.so.1 => /lib/librt.so.1 (0x00007f38a7abf000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f38a77e1000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f38a755b000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f38a7312000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f38a7109000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f38a6eee000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f38a6ce3000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f38a6aae000)
libz.so.1 => /lib/libz.so.1 (0x00007f38a6897000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f38a6684000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f38a634e000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f38a614a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f38ab569000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f38a5f1b000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f38a5d16000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007f38a5aec000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f38a58d0000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f38a56cc000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f38a54c5000)

run Qt4 creator, sweat, see them!

After add a Qwt widget, built project, get some error messages:


error: undefined reference to 'QGraphicsItemPrivate::height() const'            libQtSvg.so.4
error: undefined reference to 'QListData::detach(int)'                                    libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setWidth(double)'       libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::width() const'              libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::setHeight(double)'      libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetHeight()'              libQtSvg.so.4
error: undefined reference to 'QGraphicsItemPrivate::resetWidth()'               libQtSvg.so.4
error: undefined reference to 'QListData::detach_grow(int*, int)'                  libQtSvg.so.4
error: collect2: ld returned 1 exit status

google around, found i need to add link to QtSvg in .pro file

LIBS += -L/usr/local/lib -lQtSvg

build program, good.


*==============================*
The following QWT installation guide is contributed by Tulga. After a long struggle on fighting with QWT, Tulga installed QWT successfully on Ubuntu :) good job!

"anyone needs fully operational qwt install guide on qwt?? I made one! I'm ready to share with all of you my 2 day nervebraking job. In the end: this whole thing is so easy, when you have right information! The only thing, that above tutorial is missing is the "sudo apt-get install libqt4-dev" command. We need to make sure that this package is installed, otherwise the MAKE command was failing for me, and i think for some other people. This package is not installed automatically with QT4, so we need to finish it manually."

QWT installation on QT steps (in 7 minutes!):


sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools

By Tulga:
1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-6.0.0-rc5.tar.bz2
3. cp qwt-6.0.0-rc5.tar.bz2 /home/tulga/
4. tar -xjvf qwt-6.0.0-rc5.tar.bz2
5. apt-cache search qt4-dev //Unnecessary, just to see
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
12. cd /etc/ld.so.conf.d/
13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:
/usr/local/qwt-6.0.0-rc5/lib
14. sudo ldconfig
15. ldconfig -p | grep qwt
16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-6.0.0-rc5/include
LIBS += -L/usr/local/qwt-6.0.0-rc5/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer. 

Post your opinions on above steps. I would like to hear them!

*==============================*

After tried Tulga's method, some steps need to be correct. Meanwhile, I am still using qwt.5.2.1, because qwt.6.0.0 has made some changes. For example, qwt_data.h is changed to be QwtSeriesData.h. I don't want to change my code which based on qwt-5.2.1.
Here is Tulga's method version 2:


sudo apt-get install libqt4-core libqt4-dev libqt4-gui
sudo apt-get install build-essential libqt4-dev zlib1g zlib1g-dev qt4-dev-tools

1. Install QT programm (and make sure that all dependencies are installed --> will ask during setup) (Will be installed in /home/tulga/)
2. Download qwt-5.2.1.tar.bz2
3. cp qwt-5.2.1.tar.bz2 /home/tulga/
4. tar -xjvf qwt-5.2.1.tar.bz2
5. apt-cache search qt4-dev //Unnecessary, just to see
6. sudo apt-get install libqt4-dev //This is vital part of successful MAKE
7. qmake
8. make
9. sudo make install
10. sudo cp /home/tulga/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
11. ldd libqwt_designer_plugin.so //Unnecessary, just to see
12. cd /etc/ld.so.conf.d/
13. sudo gedit qwt.conf //After opening GEdit write following, in the end save the file and close:
/usr/local/qwt-6.0.0-rc5/lib
14. sudo ldconfig
15. ldconfig -p | grep qwt
16. sudo cp /home/tulga/qwt-6.0.0-rc5/designer/plugins/designer/libqwt_designer_plugin.so /home/tulga/qtsdk-2010.05/bin/designer/
(add:
$ sudo cp -a /home/czhang/qwt-5.2.1/lib/* /usr/lib64
$ ldd /home/czhang/qwt-5.2.1/designer/plugins/designer/libqwt_designer_plugin.so)
17. Add following codes in the end of .pro file in Qt, before build
LIBS += -L/usr/local/lib -lQtSvg
INCLUDEPATH += /usr/local/qwt-5.2.1/include
LIBS += -L/usr/local/qwt-5.2.1/lib -lqwt
18. EnjoY! QWT Designer plugin is in QT Designer.



===============================
The following installation guide from Uwe.

1) Download qwt-5.2.1.tar.bz2
2) tar xfj qwt-5.2.1.tar.bz2
3) cd qwt-5.2.1
4) qmake
5) make
6) su -c "make install" ( Boys, what's so hard about doing this ? )

Now the designer plugin should be copied into the plugins/designer directory of your Qt install directory. All other files can be found in /usr/local/qwt-5.2.1.

The following steps are Linux or Qt basics:

7) The Qwt designer plugin ( or any application using Qwt ) needs to see the Qwt library. Read about ldconfig or LD_LIBRARY_PATH how to do so. Don't continue before "ldd /plugins/designer/libqwt_designer_plugin.so" shows a valid path for libqwt.so.

When using LD_LIBRARY_PATH note, that an environment variable is only valid for the process itsself and its child processes. Until you have understood what this means better start the designer/creator manually from the shell, where you have set LD_LIBRARY_PATH.

8) Add the following to your application project file


INCLUDEPATH += /usr/local/qwt-5.2.1/include
LIB += -L/usr/local/qwt-5.2.1/lib -lqwt



11/10/2010

Touch Screen (Gumstix)

Calibrate the screen:
$ cd /usr/bin
$ ts_calibrate

when I run my Qt project, the mouse curse is still incorrect. That's because the Qt does know which touch screen library can be used.
//$ export QWS_DISPLAY="VNC:LinuxFB"
$ export QWS_MOUSE_PROTO="tslib:/dev/input/touchscreen0"

Hint 1: in /~ directory, ".profile" contains commands to be executed after log on.
Therefore, I can add these two export files in ".profile" to load these two command lines automatically when I log in. Alternative, ".bashrc" file does the same job as ".profile" does.

Hint 2: In almost Linux system (except Ubuntu), system checks /etc/inittab file first when start pc. You can tell which run level is the default from it. Normally rc5 is the default run level. You can add you own applications in rc5.d/S99xxx. The system will run these applications automatically (before log in step).
EDIT:
system will run rcS.d first, then rc5.d

a) applications should be added after "rm nologin"

#! /bin/sh
#
# rmnologin     This script removes the /etc/nologin file as the last
#               step in the boot process.
#
# Version:    @(#)rmnologin  1.00  22-Jun-1998  miquels@cistron.nl
#

if test -f /etc/nologin.boot
then
        rm -f /etc/nologin /etc/nologin.boot
fi

# add from here
export QWS_DISPLAY="VNC:LinuxFB"
export QWS_MOUSE_PROTO="tslib:/dev/input/touchscreen0"
/home/czhang/m4 -qws &

: exit 0

b) applications should followed by '&' to make sure they all run on the background, and not affect the login step.

/home/czhang/m4 -qws &


Note: Qt has a build in vnc. we can remotely view the program running on gumstix screen.
I installed vncviewer on my ubuntu machine, and run as:
$ vncviewer 10.0.0.xx      (gumstix IP address)


----------------------------
To use standard USB mouse in gumstix, use following command:
$ export QWS_MOUSE_PROTO= Auto


Remove Title Bar from Qt Application

in each window program, add

    // remove window frame
    Qt::WindowFlags flags = windowFlags();
    if (flags.testFlag(Qt::FramelessWindowHint))
       return;
    flags |= Qt::FramelessWindowHint;
    setWindowFlags(flags);
    //show();

This code need to add each window which need to remove title bar.

08/10/2010

Running Qt in Gumstix

first of all, make sure your can create a bootable microSD card. Follow the instruction:

http://www.gumstix.net/Overo/view/Overo-Setup-and-Programming/Creating-a-bootable-microSD-card/115.html


http://www.gumstix.org/create-a-bootable-microsd-card.html


Overo and verdex pro COMs will boot directly from a properly prepared microSD card. This section will outline how to partition and format a bootable microSD card.

To create a bootable microSD, compatible with the·OMAP3 boot ROM, set a special geometry using the·fdisk "Expert mode".  These steps also work for verdex pro COMs.
Important Notes:

- When creating a bootable microSD card for an·Overo COM,·you MUST use expert mode. This sets the correct cylinders, heads and sectors for the microSD card before you partition it.
- Gumstix recommends using a microSDHC card for Overo COMs. Only use microSD cards for verdex pro COMs.

The example below shows the steps required to set up a new microSD card of any size.  The numbers shown are given for a particular 2GB microSD card.  You will be directed to make a simple calculation to determine the correct values for your microSD card.
First, insert your card into the development machine's flash card slot. You may need to use a microSD to SD card adaptor to fit your slot. example the device name will be /dev/sde.  Please substitute the proper device name for your machine. You can use 'mount' or 'df' to see where the card mounts on your machine. Let's unmount the device's existing file system before we get started with fdisk:

$ sudo umount /dev/sde1

Partitioning the Card
Now, launch fdisk and create an empty partition table. Note that the argument for fdisk is the entire device (/dev/sde) not just a single partition (i.e. /dev/sde1):

# sudo fdisk /dev/sde

Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)


Let's first look at the current card information:

Command (m for help): p
Disk /dev/sde: 2032 MB, 2032664576 bytes
64 heads, 63 sectors/track, 984 cylinders
Units = cylinders of 4032 * 512 = 2064384 bytes
Disk identifier: 0x00aa8e5c
Device Boot      Start         End      Blocks   Id  System
Note the card size in bytes. We will need it later in the process.
Now go into "Expert" mode:
Command (m for help): x


Next, set the geometry to 255 heads, 63 sectors and a calculated value for the number of cylinders required for the particular microSD card. To calculate the number of cylinders, take the 2032664576 bytes reported above by fdisk, divide by 255 heads, 63 sectors and 512 bytes per sector: 2032664576 / 255 / 63 / 512 = 247.12 which we round·down to 247 cylinders.

Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 984): 247


Return to fdisk's main mode and create a new partition 32 MB FAT partition:
Expert command (m for help): r
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-247, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-247, default 15): +32M


Change the partition type to FAT32:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))


Mark it bootable:
Command (m for help): a
Partition number (1-4): 1


Now, create an ext3 partition for the rootfs:
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (6-247, default 6): 6
Last cylinder or +size or +sizeM or +sizeK (6-247, default 247): 247

To verify your work, print the partition info:
Command (m for help): p
Disk /dev/sde: 2032 MB, 2032664576 bytes
255 heads, 63 sectors/track, 247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00aa8e5c
Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *           1           5       40131    c  W95 FAT32 (LBA)
/dev/sde2               6         247     1943865   83  Linux


Finally, write the new partition table to the card and then exit:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks


Formatting the New Partitions
Format the first partition as an FAT file system (the -n parameter gives it a label of FAT).  You can change or omit this if you like.
$ sudo mkfs.vfat -F 32 /dev/sde1 -n FAT
mkfs.vfat 2.11 (12 Mar 2005)


Format the second partition as an ext3 file system:
$ sudo mkfs.ext3 /dev/sde2
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
121920 inodes, 485966 blocks
24298 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=499122176
15 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done                          
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: ^[done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Installing the Boot Files
There are three files required on the first (FAT) partition to boot your Overo.
1) MLO: the boot-loader loader - this small program is loaded into the OMAP3 processor's static RAM. It does some minimal configuration of system memory and I/O pins and then loads the second file.
2) u-boot.bin: the boot loader
3) uImage: the Linux kernel

Note: For verdex pro, MLO is not required.
You can build these yourself or download pre-built images. but these three files must be named as stated above.

After building or downloading these files, mount the FAT partition of your microSD card. The following example assumes you mount it at /media/card.
$ sudo mount /dev/sde1 /media/card


Due to constraints of the mask boot ROM in the OMAP processor, MLO MUST be written first.
$ sudo cp MLO-overo /media/card/MLO


Copy u-boot and the Linux kernel to the card:
$ sudo cp u-boot.bin /media/card/u-boot.bin
$ sudo cp uImage.bin /media/card/uImage


Now you can unmount the FAT partition.
$ sudo umount /dev/sde1


At this point you have a bootable FAT partition. Lastly, untar your desired root filesystem on the ext3 partition that you created above.  Do not untar your COM rootfs onto your development machine!  This example assumes that you have mounted it at /media/card:
$ sudo mount /dev/sde2 /media/card


Untar your desired rootfs.
$ cd /media/card
$ sudo tar xvaf /path/to/console-image.tar.bz2


Unmount the ext3 partition.
$ sudo umount /dev/sde2


U-boot Environment Refresh
U-boot comes with a default set of environment variables that can change as new versions are released.  If you are updating u-boot, clear your current set of u-boot environment variables the first time you boot with the new version.  Do this by breaking into u-boot and typing the following commands. (Overo ONLY).
$ nand erase 240000 20000
$ reset
To make additional changes to the environment, break into u-boot again, make the changes and type 'saveenv' to save.  This also eliminates the "*** Warning - bad CRC or NAND, using default environment".


====================================================================

PS! The order you copy MLO, u-boot and uImage to microSD FAT partition is very important. Otherwise, you may not boot from microSD card successfully.

Then, copy two files from your build directory to microSD card:
 directory: /build/czhang/overo-oe/tmp/deploy/glibc/images/overo
 files:  uImage-2.6.34-r90-overo.bin
             Angstrom-omap3-console-image-glibc-ipk-2010.7-test-20101005-overo.rootfs.tar.bz2 (extract to sd card)


****************************************************************************

Problem occur:

after boot from microSD card (which contain pre-make overo image from internet), Ethernet does not work, because i cannot see the light turns on after i plugged Ethernet cable.

in Overo kernel, check the loaded module
$ lsmod
Module Size Used by
libertas_sdio 13860 0
libertas 168952 1 libertas_sdio
lib80211 6848 1 libertas
ipv6 238492 16
ads7846 10328 0

Hmm, eth0 module hasn't been loaded.

try
$ modprobe smsc911x
smsc911x: Driver version 2008-10-21.
smsc911x-mdio: probed
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
net eth0: MAC Address: 00:15:c9:28:c3:60
net eth0: SMSC911x/921x identified at 0xd0c3a000, IRQ: 336

great, loaded. right, i need to add eth0 module while the overo booting.

$ cd /etc
$ cat modules
### This file is automatically generated by update-modules"
#
# Please do not edit this file directly. If you want to change or add
# anything please take a look at the files in /etc/modutils and read
# the manpage for update-modules.
#
### update-modules: start processing /etc/modutils/ipv6
ipv6

### update-modules: end processing /etc/modutils/ipv6

$ cd /etc/modutils
$ cat > smsc911x ; create a eth0 module file
$ cat smsc911x ; add command in this file
smsc911x
(Ctrl+D to save it)

$ update-modules

reboot gumstix, done!

copy my own build overo image to microSD card, boot gumstix, the eth0 still not work!!
the reason is that the latest version of bb recipes includes the smsc911x in kernal, not a module. take a look in:
$ cd /etc/network
$ cat interfaces
#auto eth0
#iface eth0 inet dhcp
#iface eth1 inet dhcp
(eth0 has been disabled)

$ vi interfaces ; learn how to drive vi, un-comment eth0
auto eth0
iface eth0 inet dhcp
#iface eth1 inet dhcp ; gumstix does not have eth1

reboot gumstix, done.

Note: sometimes, the eth0 will down after I stopped program. To enable the eth0 manually, try:
$ ifconfig eth0 up
$ ifconfig eth0 10.0.0.xxx netmask 255.255.255.0

or

$ udhcpc

sometimes "udhcpc" does not work.
I am using
$ifdown eth0
$ifup eth0

to enable the Ethernet.


take a look if the kernel has "rsync", because i need use it to copy Qt arm-lib files from my build machine.
try if you can install "rsync" with opkg command, which is similar to yum or apt-get
$ opkg install rsync
can't install rsync
try
$ opkg update
$ opkg install rsync
still can't install.

go back to build machine, build rsync package myself.
$ cd /build/czhang/overo-oe
$ source build/profile
$ bitbake rsync

after that, i should be able to see a rsync.ipk file in:
/build/czhang/overo-oe/tmp/deploy/glibc/ipk/armv7a/rsync_3.0.6-r0.6_armv7a.ipk


Go to Gumstix, copy this package to /~

Then
$ cd ~
$ opkg install rsync_3.0.6-r0.6_armv7a.ipk

Then copy all Qt ARM-lib file to gumstix lib folder
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-opensource-src-4.7.0/lib/* /usr/lib

copy my Qt executable file to gumstix
$ cd ~
$ scp czhang@10.0.1.202:/build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm/m4/m4 .
$ pwd
/home/root
$ /home/root/m4
error while loading shared libraries: libqextserialport.so.1: cannoy

ok, need to copy serial port arm-lib to gumstix
$ rsync -av czhang@10.0.1.202://build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport/build/libqextserialport* /usr/lib

run again
$ /home/root/m4

great, see my program on the touch screen.

next step is to calibrate the touch screen and import some pictures.



07/10/2010

Subversion Control - svn

subversion stores all versioned data in a central repository.

assume I got a Qt project in /home/czhang/project1

firstly, create a repository:
$ mkdir /home/czhang/svn
$ svnadmin create /home/czhang/svn/repos
$ ls /home/czhang/svn/repos
conf/ dav/ db/ format hooks/ locks/ README.txt

import project folder into repository:
$ svn import ~/project1 file:///home/czhang/svn/repos/project1 -m "initial import"

now the repository contains all 'project1' files. I won't see these files in /home/czhang/svn/repos, they are all stored within a database.
Note that the original /home/czhang/project1 directory is unchanged. Subversion is unaware of it. (in fact, i can even delete that directory if i wish.) To start manipulating repository data, I need to create a new "working copy" of the data, a sort of private workspace.

$ svn checkout file:///home/czhang/svn/repos/project1 ~/svn_project

now I have a personal copy of part of the repository in a new directory name "svn_project".
I can edit Qt project from this folder and then commit those changes back to the repository.

!!! in Qt, make sure in "Projects" tag --- "Build Settings" --- "General": un-tick "Shadow build". 
otherwise, project will be built in wrong directory.

To reverse back to older version project, close this project, and go to the personal project folder which I am working in. Use command:
$ svn info                ; check version information
$ svn co up -r 1       ; reverse back to version 1
or
$ svn up -r 1            ; if it has already been checked out

Then use svn over ssh to checkout all program files to another pc (eg. server)

$  svn co svn+ssh://czhang@10.0.0.124/home/czhang/svn/repos/m4 /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm

!!! remember, all resource files only can be put into
    qt-everywhere-opensource-src-4.7.0/projects
    otherwise, it won't compile for arm processor
    if there isn't a "projects" folder, create one.

go to folder "m4"
$ qmake  m4.pro
$ make
arm-linux-g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -D_TTY_POSIX_ -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../mkspecs/qws/linux-arm-g++ -I. -I../../../include/QtCore -I../../../include/QtNetwork -I../../../include/QtGui -I../../../include -I/home/czhang/Downloads/qextserialport -I.moc/release-shared-emb-arm -I.uic/release-shared-emb-arm -o .obj/release-shared-emb-arm/mainscr.o mainscr.cpp
In file included from mainscr.cpp:7:
globleVar.h:6:28: error: qextserialport.h: No such file or directory
In file included from mainscr.cpp:7:
globleVar.h:49: error: expected initializer before ‘*’ token
mainscr.cpp: In member function ‘void MainScr::on_pushButton_clicked()’:
mainscr.cpp:108: error: ‘serialPort’ was not declared in this scope
mainscr.cpp: In member function ‘void MainScr::openSerialPort()’:
mainscr.cpp:136: error: ‘serialPort’ was not declared in this scope
mainscr.cpp:136: error: expected type-specifier before ‘QextSerialPort’
mainscr.cpp:136: error: expected `;' before ‘QextSerialPort’
mainscr.cpp:144: error: ‘BAUD115200’ was not declared in this scope
mainscr.cpp:145: error: ‘PAR_NONE’ was not declared in this scope
mainscr.cpp:146: error: ‘FLOW_OFF’ was not declared in this scope
mainscr.cpp:147: error: ‘DATA_8’ was not declared in this scope
mainscr.cpp:148: error: ‘STOP_1’ was not declared in this scope
mainscr.cpp: In member function ‘void MainScr::strSend(QString)’:
mainscr.cpp:156: error: ‘serialPort’ was not declared in this scope
mainscr.cpp: In member function ‘QString MainScr::strReceive()’:
mainscr.cpp:162: error: ‘serialPort’ was not declared in this scope
make: *** [.obj/release-shared-emb-arm/mainscr.o] Error

take a look m4.pro
$ gedit m4.pro



#-------------------------------------------------
#
# Project created by QtCreator 2010-08-04T16:44:30
#
#-------------------------------------------------

QT       += core gui

TARGET = m4
TEMPLATE = app


SOURCES += \
    mainscr.cpp \
    main.cpp \
    cyclescrdialog.cpp \
    engscrdialog.cpp \
    manopdialog.cpp \
    globleVar.cpp \
    pwdialog.cpp

HEADERS  += \
    mainscr.h \
    cyclescrdialog.h \
    engscrdialog.h \
    manopdialog.h \
    globleVar.h \
    pwdialog.h

FORMS    += \
    mainscr.ui \
    cyclescrdialog.ui \
    engscrdialog.ui \
    manopdialog.ui \
    pwdialog.ui

LIBS += -lqextserialport
unix:DEFINES = _TTY_POSIX_
win32:DEFINES = _TTY_WIN_
INCLUDEPATH += /home/czhang/Downloads/qextserialport

at the last line, the path of qextserialport is still in old directory. change it to be:

INCLUDEPATH += /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport

$ make clean
$ make m4.pro
...
arm-linux-g++ -Wl,-rpath-link,/build/czhang/qt-everywhere-opensource-src-4.7.0/lib -fno-exceptions -Wl,-O1 -Wl,-rpath,/usr/lib -Wl,-rpath,/usr/lib -o m4 .obj/release-shared-emb-arm/mainscr.o .obj/release-shared-emb-arm/main.o .obj/release-shared-emb-arm/cyclescrdialog.o .obj/release-shared-emb-arm/engscrdialog.o .obj/release-shared-emb-arm/manopdialog.o .obj/release-shared-emb-arm/globleVar.o .obj/release-shared-emb-arm/pwdialog.o .obj/release-shared-emb-arm/moc_mainscr.o .obj/release-shared-emb-arm/moc_cyclescrdialog.o .obj/release-shared-emb-arm/moc_engscrdialog.o .obj/release-shared-emb-arm/moc_manopdialog.o .obj/release-shared-emb-arm/moc_pwdialog.o    -L/build/czhang/qt-everywhere-opensource-src-4.7.0/lib -lqextserialport -lQtGui -L/build/czhang/qt-everywhere-opensource-src-4.7.0/lib -lQtNetwork -lQtCore -lpthread
/build/czhang/overo-oe/tmp/sysroots/x86_64-linux/usr/armv7a/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lqextserialport
collect2: ld returned 1 exit status
make: *** [m4] Error 1

add lib path:
$ gedit m4.pro

LIBPATH += /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/qextserialport/build

after that, use following command to check your program:
$ readelf -a m4 | less

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1

program m4 is in ARM format.


Next time, after I commit a new version of program, I just need to use 'svn up' to checkout.
$ cd /build/czhang/qt-everywhere-opensource-src-4.7.0/projects/m4_arm
$ svn up



06/10/2010

build cross compile tools for overo arm processor

First of all, I need to understand the open-embedded (OE) build system.
OE is a software framework to create Linux distributions. OE downloads the source code and cross compiles it for you as needed. OE builds everything from scratch including the cross compilation toolchain. 


The first part of this instruction is copy from

This section will show us how to set up an OE environment on our Linux development system.


The second part is all my set up steps afterwards.

In the meantime,  this website is very helpful.
(http://www.klc.net.nz/linux/?page_id=13)



Part 1

Prerequisites

Your build machine should be running a recent Linux distribution. Gumstix uses Ubuntu for development, and this is what we strongly recommend.
For those who need to use a different distribution, we recommend that you consult the OpenEmbedded documentation at:
Depending on your distribution, it is likely you will need to install additional software. If you would like to install these packages up front, the following list includes most of the necessary packages:
  • git
  • subversion
  • gcc
  • patch (this and gcc are often bundled with other developer tools in the build-essential package)
  • help2man (Centos 5 package available from atrpms repository)
  • diffstat
  • texi2html (texinfo on SUSE)
  • makeinfo (texinfo on Ubuntu)
  • ncurses-devel (libncurses5-dev on Ubuntu)
  • cvs
  • gawk
  • python-dev
  • python-pysqlite2 (python-sqlite2 on SUSE)
  • unzip
  • chrpath
  • ccache
Only the first two packages (git and svn) are required to be installed up front. Otherwise you can proceed and you will be prompted to install needed packages later in the process.
Note 1: If you are using an Ubuntu distribution, it is likely that /bin/sh is linked to /bin/dash. If this is the case, then you will need to change /bin/sh to link to /bin/bash. Neglecting to do this will cause target system init file corruption and your build image will not boot! Run "sudo dpkg-reconfigure dash" and answer no when asked whether you want to install dash as /bin/sh.

Build system checkout

First you'll want to check out the source files for OE build system (roughly 250 MB). With a typical DSL connection this step should take less than 20 minutes. You should have at least 10GB of free space on your hard drive in order to do a complete build of the kernel and root file system images.
These instructions will assume that you are installing the build system in your home directory under "overo-oe". If you decide to put it elsewhere you will need to make appropriate alterations to the steps below.
First we will create the "overo-oe" directory and cd into it:
$ mkdir -p ~/overo-oe
$ cd ~/overo-oe
Then we will install the OE metatdata, and check out the Overo branch (you can safely ignore the warnings you will get from the git commands):
$ git clone git://gitorious.org/gumstix-oe/mainline.git org.openembedded.dev
$ cd org.openembedded.dev
$ git checkout --track -b overo origin/overo
The next step installs BitBake:
$ cd ~/overo-oe
$ git clone git://git.openembedded.net/bitbake bitbake
$ cd bitbake
$ git checkout 1.10.2

Creating the OE configuration files and profile

We now will create a profile script and the configuration files required to tailor OE to our needs.
To make this a somewhat easier task, there is a template for the required files in the OpenEmbedded installation we just did.
Copy these files to your overo-oe directory:
$ cd ~/overo-oe
$ cp -r org.openembedded.dev/contrib/gumstix/build .
If you have followed the example installation and placed the build system in overo-oe in your home directory, you are now ready to proceed to the next step. If you have installed the build system in a different location you will need to edit overo-oe/build/profile and change the definition of OVEROTOP as appropriate.

Source code caching

As part of the build process OpenEmbedded downloads source code tarballs for the Linux kernel, compiler, and other software packages. By default this source code cache will be placed in overo-oe/sources. If you would like this cache to be located elsewhere, now is the time to edit build/conf/site.conf and set DL_DIR as appropriate.

Environment setup

OpenEmbedded requires some environment setup in order to function properly. There are a couple of ways to handle this requirement.

OPTION A: BASH PROFILE

You can set this up via your bash profile:
$ cp ~/.bashrc ~/bashrc.bak
$ cat ~/overo-oe/build/profile >> ~/.bashrc
With most distributions, adding this environment setup to ~/.bashrc will work for both GUI shells and login shells. If your distribution does not source .bashrc for login shells, you may need to use ~/.bash_profile instead of ~/.bashrc (or modify ~/.bash_profile so that it does source ~/.bashrc).
f you chose Option A for environment setup (bash profile method),·log out/log back in or close your terminal window and open a new one so that the environment changes you enabled above will take effect.

OPTION B: COMMAND LINE SOURCING

If you don't want to modify your standard terminal profile for some reason, you can do this environment setup on a per session basis by sourcing overo-oe/build/profile prior to issuing any build commands:
$ . ~/overo-oe/build/profile
or alternatively:
$ source ~/overo-oe/build/profile
If you chose Option B (command line sourcing), issue the command to source the environment setup.

Your first build

You can build a basic kernel and non-gui root file system image in one step with:
$ bitbake omap3-console-image
If your build machine is missing any essential packages, bitbake will notify you about them at this point. Install the recommended packages and try the bitbake command again. There are many other bitbake targets for different images.
You will also get a message from bitbake suggesting that you install the psyco JIT compiler for better performance. It isn't necessary to install psyco right now, though it is a good idea to install it at some point.
You may also notice another message complaining about not finding user.collection/packages/*/*.bb. Don't concern yourself with this -- you will create this directory later when you create your first package for your own code.
This initial build will take a bit of time since it will need to download all the source code and build the cross compilation tools. Subsequent builds will be much faster. When the build completes, you will find the root file system image and the kernel image in $HOME/overo-oe/tmp/deploy/glibc/images/overo.




Part 2

use oe to build overo system image file.

after bitbake omap3-console-image has been succeed

$cd /overo-oe/tmp/sysroots/x86_64-linux/usr/armv7a/bin/

This folder contains all cross compile tools. We gonna to use the same compile tools to compile Qt compiler and Qt libraries.

On our normal pc, Qt creator compiles programs for i386 processor. These programs could not run in gumstix, because it got ARM processor. In order to solve this problem, we need to re-compile these programs which created in normal pc for ARM processor.

We use the same oe cross compile tools to compile Qt libraries and Qt-ARM-compiler.


take a look all PATH:
$echo $PATH
/build/bitbake/bin:$/build/bitbake/bin:$/build/bitbake/bin:$/build/bitbake/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/czhang/bin

the cross compile tools  are not in the PATH, I need to create links for these tools. Review the PATH, at the very end, /home/czhang/bin is in the PATH. I decide to put links into this folder.



Meanwhile, (not very clear), during the compiling, the system only look for 'arm-linux-xxx'. Therefore, create links to link 'arm-linux-xxx' to 'arm-angstrom-linux-gnueabi-xxx'.

$cd ~/bin
$for A in `find . -name "arm-angstrom-linux-gnueabi-*"`; do ln -s $A `echo $A | sed s/arm-angstrom-linux-gnueabi-/arm-linux-/` ; done


Then
$make distclean
clean the pre-compile files.
$./configure -embedded arm -qt-mouse-tslib -qt-gfx-vnc -prefix /usr
install with touch screen and vnc application, and tell qmake to compile program in arm
$qmake