环境:Fedora 10
编译器:4.3.3
首先设置环境变量:
在/etc/bashrc文件中最后加入
export WORK_DIR=/work/cross
export ROOTFS_DIR=$WORK_DIR/rootfs
export ARCH=arm
export PKG_CONFIG_PATH=/opt/qt-embedded/lib:$ROOTFS_DIR/usr/local/lib/pkgconfig:$ROOTFS_DIR/usr/lib/pkgconfig:$ROOTFS_DIR/usr/X11R6/lib/pkgconfig
export PATH=/opt/qt-embedded/bin:$PATH
复制这一块在命令行里:(先创建一个放依赖库的地方)
if [ ! -e "$ROOTFS_DIR/usr/local/include" ]; then /
mkdir -p $ROOTFS_DIR/usr/local/include;fi;/
if [ ! -e "$ROOTFS_DIR/usr/local/lib" ]; then /
mkdir -p $ROOTFS_DIR/usr/local/lib; fi;/
if [ ! -e "$ROOTFS_DIR/usr/local/etc" ]; then /
mkdir -p $ROOTFS_DIR/usr/local/etc; fi;/
if [ ! -e "$ROOTFS_DIR/usr/local/bin" ]; then /
mkdir -p $ROOTFS_DIR/usr/local/bin; fi;/
if [ ! -e "$ROOTFS_DIR/usr/local/share" ]; then /
mkdir -p $ROOTFS_DIR/usr/local/share; fi;/
if [ ! -e "$ROOTFS_DIR/usr/local/man" ]; then /
mkdir -p $ROOTFS_DIR/usr/local/man; fi;/
if [ ! -e "$ROOTFS_DIR/usr/include" ]; then /
mkdir -p $ROOTFS_DIR/usr/include; fi;/
if [ ! -e "$ROOTFS_DIR/usr/lib" ]; then /
mkdir -p $ROOTFS_DIR/usr/lib; fi;/
if [ ! -e "$ROOTFS_DIR/usr/etc" ]; then /
mkdir -p $ROOTFS_DIR/usr/etc; fi;/
if [ ! -e "$ROOTFS_DIR/usr/bin" ]; then /
mkdir -p $ROOTFS_DIR/usr/bin; fi;/
if [ ! -e "$ROOTFS_DIR/usr/share" ]; then /
mkdir -p $ROOTFS_DIR/usr/share; fi;/
if [ ! -e "$ROOTFS_DIR/usr/man" ]; then /
mkdir -p $ROOTFS_DIR/usr/man; fi;
开始:
1.解压zlib-1.2.3
cd zlib-1.2.3
export CC=$ARCH-linux-gcc
./configure -shared --prefix=$ROOTFS_DIR/usr
make
make install
2.解压glib-2.24.2
cd glib-2.24.2
echo ac_cv_type_long_long=yes>$ARCH-linux.cache
echo glib_cv_stack_grows=no>>$ARCH-linux.cache
echo glib_cv_uscore=no>>$ARCH-linux.cache
echo ac_cv_func_posix_getpwuid_r=yes>>$ARCH-linux.cache
echo ac_cv_func_posix_getgrgid_r=yes>>$ARCH-linux.cache
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=$ARCH-linux.cache
make
make install
3.解压libxml2-2.2.7
cd libxml2-2.2.7
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --with-python=$ROOTFS_DIR/usr
make
make install
4.解压gstreamer-0.10.30.3
cd gstreamer-0.10.30.3
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --disable-valgrind --disable-largefile
make
make install
5.解压liboil-0.3.17
cd liboil-0.3.17
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
6.解压alsa-lib-1.0.23
cd alsa-lib-1.0.23
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --disable-python
make
make install
7.解压gst-plugins-base-0.10.30.2
cd gst-plugins-base-0.10.30.2
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --disable-valgrind --disable-x --disable-gnome_vfs --disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples
make
make install
8.解压libid3tag-0.15.1b
cd libid3tag-0.15.1b
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
9.解压libmad-0.15.1b
cd libid3tag-0.15.1b
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
sed 's/-fforce-mem//g' Makefile>Makefile.new
mv Makefile.new Makefile
make
make install
10.解压orc-0.4.9(这个不用,这个有点问题,不明。我编译了这个,下面编译就不行,有的人说要编译,不过可跳过)
cd orc-0.4.9
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
11.解压gst-plugins-good-0.10.25(编译这个的时候出现了两个错误,找不到答案,找到的人请说一下)
cd gst-plugins-good-0.10.25
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --disable-valgrind --disable-x --disable-cairo --disable-gdk_pixbuf --disable-annodex --disable-oss4 --disable-oss --disable-shout2 --disable-soup --disable-examples
make
make install
12.解压gst-plugins-ugly-0.10.16
cd gst-plugins-ugly-0.10.16
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
13.解压gst-plugins-bad-0.10.20(编译这个的时候出现了两个错误,找不到答案,找到的人请说一下)
cd gst-plugins-bad-0.10.20
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --disable-sdl --disable-apexsink --without-x --disable-librfb --disable-examples
make
make install
14.解压gst-ffmpeg0.10.11
cd gst-ffmpeg0.10.11
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --enable-shared --disable-silent-rules -v --with-ffmpeg-extra-configure="--prefix=$ROOTFS_DIR/usr --cross-prefix=$ARCH-linux- --cpu=armv4 --arch=arm --host-cc=gcc --enable-cross-compile --target-os=linux --extra-cflags=-I/work/cross/rootfs/usr/include --extra-ldflags=-L/work/cross/rootfs/usr/lib"
15.解压tslib
在/etc里创建ts.conf
#内容#######################################################ts.conf#################################################################### # Uncomment if you wish to use the linux input layer event interface
module_raw input
# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
# module_raw collie
# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
# module_raw corgi
# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
# module_raw ucb1x00
# Uncomment if you're using an HP iPaq h3600 or similar
# module_raw h3600
# Uncomment if you're using a Hitachi Webpad
# module_raw mk712
# Uncomment if you're using an IBM Arctic II
# module_raw arctic2
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
#内容#######################################################ts.conf####################################################################
cd tslib
aclocal
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=arm-linux.cache
make
make install
15.解压libpng-1.4.3
cd libpng-1.4.3
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
16.解压jpeg-8b
cd jpeg-8b
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
17.解压expat-2.0.1
cd expat-2.0.1
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
18.解压dbus-1.2.24
cd dbus-1.2.24
CFLAGS=-I/work/cross/rootfs/usr/include LDFLAGS=-L/work/cross/rootfs/usr/lib ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --with-x=no ac_cv_have_abstract_sockets=yes --with-xml=expat --disable-silent-rules --enable-dnotify=no --enable-inotify
make
make install
19.解压qt-everywhere-opensource-src-4.6.3
在/opt 创建qt-embedded文件夹
修改 /opt/qt-everywhere-opensource-src-4.6.3/mkspecs/qws/linux-arm-g++/qmake.conf
#修改################################qmake.conf#########################################
#
# qmake configuration for building with arm-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = arm-linux-gcc
QMAKE_CXX = arm-linux-g++
QMAKE_LINK = arm-linux-g++
QMAKE_LINK_SHLIB = arm-linux-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-ar cqs
QMAKE_OBJCOPY = arm-linux-objcopy
QMAKE_STRIP = arm-linux-strip
QMAKE_INCDIR += /work/cross/rootfs/usr/include
QMAKE_LIBDIR += /work/cross/rootfs/usr/lib
QMAKE_LFLAGS_RELEASE += '-Wl,-rpath-link,/work/cross/rootfs/usr/lib'
load(qt_config)
#修改################################qmake.conf#########################################
cd qt-everywhere-opensource-src-4.6.3
./configure -prefix /opt/qt-embedded -embedded arm -xplatform qws/linux-arm-g++ -fast -force-pkg-config /
-no-opengl -qt-freetype -depths 16,18,24 -little-endian /
-qt-mouse-tslib /
-nomake tools -nomake docs -opensource -confirm-license -no-largefile /
-qt-sql-sqlite -no-qt3support -no-xmlpatterns /
-multimedia -audio-backend -phonon -phonon-backend -svg /
-webkit -no-javascript-jit -script -no-scripttools -no-declarative /
-qt-gif -qt-libtiff -system-libpng -qt-libmng -system-libjpeg -no-openssl /
-system-zlib -no-nis -no-cups -dbus -no-mmx -no-3dnow -no-sse -no-sse2 /
-no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info
make
make install
20.解压zinnia-0.06
cd zinnia-0.06
./configure --host=$ARCH-linux --prefix=/opt/qt-embedded
make
make install
21.解压freetype2-2.4.3(这个用于编译poppler的,因为编译poppler出现问题,所以这个可以不编译)
./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr
make
make install
22.解压fontconfig-2.8.0(这个用于编译poppler的,因为编译poppler出现问题,所以这个可以不编译)
cd fontconfig-2.8.0
./configure CC=arm-linux-gcc --with-arch=$ARCH --with-freetype-config=/work/cross/rootfs/usr/bin/freetype-config --enable-libxml2 --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr make
make install
23.解压poppler-0.14.4(这个用于编译poppler的,因为编译poppler出现问题,所以这个可以不编译)
cd poppler-0.14.4
export POPPLER_QT4_CFLAGS="-I/opt/qt-embedded/include"/
export POPPLER_QT4_LIBS="-L/opt/qt-embedded/lib" /
export POPPLER_QT4_TEST_CFLAGS="-I/opt/qt-embedded/include" /
export POPPLER_QT4_TEST_LIBS="-L/opt/qt-embedded/lib" /
CFLAGS="-I/work/cross/my_root/rootfs/usr/include" /
CXXFLAGS="-I/work/cross/my_root/rootfs/usr/include" /
LDFLAGS="-L/work/cross/my_root/rootfs/usr/lib"/
./configure --host=$ARCH-linux --prefix=/opt/qt-embedded --disable-utils --disable-gtk-test --disable-poppler-qt --disable-gdk --disable-poppler-glib --disable-largefile --disable-libopenjpeg --disable-libpng --disable-splash-output --disable-cairo-output --disable-abiword-output
24.解压qt-mobility-opensource-src-1.0.2
cd qt-mobility-opensource-src-1.0.2
CC=arm-linux-gcc /
CXX=arm-linux-g++ /
AR=arm-linux-ar /
AS=arm-linux-as /
RANLIB=arm-linux-ranlib /
LD=arm-linux-ld /
STRIP=arm-linux-strip /
./configure -prefix /opt/qt-embedded -modules location -examples -release
make
make install
25.解压QSerialDevice_v0.2.0
cd QSerialDevice_v0.2.0
创建qserialdevice.pro
#内容#################################qserialdevice.pro###########################
#
#PROJECT = Serial Device Liblary
TEMPLATE = lib
CONFIG -= debug_and_release debug
QT -= gui
OBJECTS_DIR = ../build/lib/qserialdevice/obj
MOC_DIR = ../build/lib/qserialdevice/moc
include(qserialdevice.pri)
DESTDIR = ../build/lib/qserialdevice/release
TARGET = qserialdevice
VERSION = 0.1.0
#内容#################################qserialdevice.pro######################
cd /opt/QSerialDevice_v0.2.0/qserialdevice
qmake
make
cp -v *.h /opt/qt-embedded/include
cp -vP ../build/lib/qserialdevice/release/* /opt/qt-embedded/lib
26.解压nmealib
cd nmealib
创建一个新的Makefile
#内容##########################nmealib##################################
CC = arm-linux-gcc
BIN = lib/libnmea.a
MODULES = generate generator parse parser tok context time info gmath sentence
SAMPLES = generate generator parse parse_file math
OBJ = $(MODULES:%=build/nmea_gcc/%.o)
LINKOBJ = $(OBJ) $(RES)
SMPLS = $(SAMPLES:%=samples_%)
SMPLOBJ = $(SAMPLES:%=samples/%/main.o)
INCS = -I include
LIBS = -lm -Llib -lnmea
.PHONY: all all-before all-after clean clean-custom doc
all: all-before $(BIN) samples all-after
all-before:
mkdir -p build/nmea_gcc
clean: clean-custom
rm -f $(LINKOBJ) $(BIN) $(SMPLOBJ) $(SMPLS)
doc:
$(MAKE) -C doc
remake: clean all
$(BIN): $(LINKOBJ)
ar rsc $@ $^
ranlib $@
build/nmea_gcc/%.o: src/%.c
$(CC) $(INCS) -c $< -o $@
samples: $(SMPLS)
samples_%: samples/%/main.o
$(CC) $< $(LIBS) -o build/$@
samples/%/main.o: samples/%/main.c
$(CC) $(INCS) -c $< -o $@
#内容##########################nmealib###################################
make
cp -rv include/* /work/cross/rootfs/usr/include
cp -v lib/libnmea.a /work/cross/rootfs/usr/lib
27.解压emd到/opt
export EMD_RUNNING_DIR=/opt/emd/emdesktop-running-environment
qmake
make
cd ..
cp -v wenquanyi/* /opt/qt-embedded/lib/fonts
cp -Rv emdesktop-running-environment /opt
cd emd
把wenquanyi字体拷贝到/opt/qt-embedded/lib/fons里面
把emdesktopclient里面的.so文件全COPY 到/opt/qt-embedded/lib
把emdecoration 里面的.so文件全COPY 到/opt/qt-embedded/plugin/decorations
这样就编译完,最后做文件系统,把emdesktop-running-environment 和qt-embedded复制到文件系统的/opt里,把/work/cross/rootfs/里的usr的内容加入到文件系统的usr里面,
我这里用了天嵌的root_qt_4.5_2.6.30.4_20100601.tar.bz2 的文件系统
删除了/opt/qt-4.5
把原有关qt-4.5的所有文件路径改为qt-embedded。
修改bin/qt4文件的最后那里,把原文件-qws前面的改为./opt/emdesktop-running-environment/emdesktop
重新启动
新桌面出来了
参考
http://blog.csdn.net/z642010820/archive/2010/10/14/5939999.aspx
http://www.qtcn.org/bbs/read.php?tid=28994&page=1