Ads 468x60px

##EasyReadMore##

30 5月, 2013

編譯 Tiny-X for ARM (未成功…)

Tiny-X是標準X-windows系統的簡化版,去掉了許多對設備的檢測過程,無需設置顯示卡Driver,很容易對各種不同硬件進行移植。Tiny-X專為嵌入式開發,適合用作嵌入式linux的GUI系統。Tiny-X圖形系統是由SuSE贊助的,開發人員是XFree86的核心成員Keith Packard。目前TinyX是XFree86自帶的編譯模式之一,只要通過修改編譯選項,就能編譯生成Tiny-X。

作為XFree86 4.0(ftp://ftp.xfree86.org/pub/XFree86/4.0)的子集,性能和穩定性都非常好,適合內存資源比較少的系統的X系統,它是以 XFree86為基準,所以構置或設定的方式與 xfree86 是相同的。一般的X Server都太過於龐大,因此Keith Packard就以XFree86為基礎,精簡了不少東西而成Tiny X Server,它的體積可以小到幾百Kb而已,非常適合應用於嵌入式環境。TinyX象X Window系統一樣採用標準的Client/Server體系結構,如下圖所示:

http://bbs.ednchina.com/BLOG_ARTICLE_5770.HTM

sudo apt-get install gcc glibc-6 build-essential
sudo apt-get install autoconf
sudo apt-get install linux-hearders-2.6.17-10-generic
sudo apt-get install bison flex
sudo apt-get install zlib1g-dev      #好像zlib-dev,zlib1-dev都被廢棄了
sudo apt-get install libexpat1-dev   #安裝開發包,不是安裝expat
sudo apt-get install libfontconfig-dev   #安裝開發包,不是安裝fontconfig
apt-get install libtool g++ libpam0g-dev libpng12-dev

下載freetype-2.2.1.tar.gz  libpng-1.2.16.tar.bz2  libjpeg-6b.tar.gz   zlib-

1.2.3.tar.gz

--- 安裝zlib
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3

make distclean
./configure --shared --prefix=/usr
make
make install
cd ..

--- 安裝libpng
tar jxvf libpng-1.2.16.tar.bz2
cd libpng-1.2.16
./configure --host=arm-linux --prefix=/usr
make
make install

--- 安裝jpeg-8 //http://www.ijg.org/files/
tar zxvf jpegsrc.v8.tar.gz
cd jpeg-8
./configure --host=arm-linux --prefix=/usr --enable-shared --enable-static
make
make install

--- 安裝freetype //http://www.freetype.org/download.html
tar zxvf freetype-2.4.2.tar.gz
cd freetype
./configure --prefix=/usr --host=arm-linux
sudo make install
make
make install

cp /usr/src/linux-headers-3.2.0-29-generic-pae/include/config/i2o/config.h /usr/include/linux/

cd xc/include/

http://pkgs.fedoraproject.org/repo/pkgs/termcap/

ncurses 交叉編譯./configure \
--prefix=$PWD/bulid \
--host=arm-linux \
--target=arm-linux \
--with-build-cc=cc \
--with-build-cpp=cpp \
--with-shared \
--with-normal
make
make install


http://ftp.gwdg.de/pub/xfree86/XFree86/4.8.0/source/

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

和 xc在同一個目錄下建立一個文件夾
mkdir arm
cd arm
lndir ../xc/

2cross.def和host.def配置文件
在xc/config/cf下建立cross.def和host.def文件如下

host.def

#define KDriveXServer YES
#define TinyXServer YES
#define XfbdevServer YES
#define CrossCompiling YES
#define ProjectRoot /opt/FriendlyARM/mini6410/linux/Tinyx
#define NothingOutsideProjectRoot YES
#define HasFreetype2 NO
#define HasFontconfig NO
#define HasLibpng NO
#define HasZlib NO
#define HasExpat NO
#define BuildXprintClients NO
#define TouchScreen YES
#define HasTsLib YES
#define BuildDocs NO
#define BuildXF86DRI NO
#define BuildGlxExt NO
#define BuildOSMesaLib NO
#define BuildLowMem NO
#define BuildIPv6 NO
#define HasMTRRSupport NO
#define UseX86Emu NO
#define XF86INT10_BUILD X86INT10_STUB
#define BuildAppgroup NO
#define BuildDBE NO
#define BuildLBX NO
#define BuildFonts YES
#undef BuildXF86RushExt
#define BuildXF86RushExt NO
#undef BuildRender
#define BuildRender YES

#define UseRgbTxt NO
#define BuildFontServer NO
#define BuildClients NO
#define BuildFonts YES
#undef BuildXF86RushExt
#define BuildXF86RushExt NO
#undef BuildRender
#define BuildRender YES
#define UseRgbTxt YES
#define BuildFontServer NO
#define OmitSnfSupport YES
#define XdecMultiDepthServer NO
#define XsunServer NO
#define Xsun24Server NO
#define XsunMonoServer NO
#define XsunLynxServer NO
#define XSavageServer NO
#define XIgsServer NO
#define XTridentServer NO
#define XchipsServer NO
#define Xmach64Server NO
#define Xi810Server NO
#define XSis530Server NO
#define XTrioServer NO
#define XipaqServer NO
#define XTS300Server NO
#define XItsyServer NO
#define XvesaServer NO
#define XDarwinServer NO
#define XF86CardDrivers fbdev
#define XInputDrivers mouse keyboard

cross.def

#undef Arm32Architecture
#undef i386Architecture
#undef Arm32Architecture
#undef Arm32Architecture
#define Arm32Architecture
#undef OptimizedCDebugFlags
#define OptimizedCDebugFlags -Os
#define ServerCDebugFlags -Os
#undef StandardDefines
#define StandardDefines -Dlinux -D__arm__ -D_POSIX_SOURCE
-D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#undef CcCmd
#define StdIncDir /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include
#define PreIncDir /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include
#undef PostIncDir
#define PostIncDir/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include
#define CcCmd arm-linux-gcc
#undef HasCplusplus
#define HasCplusplus NO
#undef CplusplusCmd
#define CplusplusCmd NO
#define DoRanlibCmd YES
#define RanlibCmd arm-linux-ranlib
#undef ExtraLoadFlags
#define ExtraLoadFlags
#define FbNoPixelAddrCode
#undef TermcapLibrary
#define TermcapLibrary -L../lib -lncurses

#define NCursesLibName -L../lib -lncurses
#undef LdPostLib
#undef LdCmd
#define LdCmd arm-linux-ld
#undef ExtensionOSDefines
#define ExtensionOSDefines
#define ServerXdmcpDefines
#define GzipLibrary -L../lib -lz
#include <cross.rules>

3修改部分文件
‧ 編輯armtinyx/programs/Xserver/hw/xfree86/common/compiler.h,刪除outb之類的
空函數。

第1435行開始
static __inline__ void
outb(unsigned short port, unsigned char val)
{
}
static __inline__ void
outw(unsigned short port, unsigned short val)
{
}
static __inline__ void
outl(unsigned short port, unsigned int val)
{
}
static __inline__ unsigned int
inb(unsigned short port)
{
return 0;
}
static __inline__ unsigned int
inw(unsigned short port)
{
return 0;
}
static __inline__ unsigned int
inl(unsigned short port)
{
return 0;
}

‧ 修改xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c
刪掉#include "asm/page.h" /* #define for PAGE_* */
添加# define PAGE_MASK (~(getpagesize() - 1))
‧ 修改xc/programs/Xserver/hw/tinyx/linux/tslib.c
修改成
if (n == 1)
{
if (event.pressure)
{
/*
* HACK ATTACK. (static global variables used !)
* Here we test for the touch screen driver actually being on the
* touch screen, if it is we send absolute coordinates. If not,
* then we send delta's so that we can track the entire vga screen.
*/

‧ 修改xc/config/cf/X11.tmpl,使其生成靜態庫文件

#ifndef NormalLibFS
#define NormalLibFS (!SharedLibFS | ForceNormalLib)
#endif
等之類修改成
#ifndef NormalLibFS
#define NormalLibFS YES
#endif
‧ 修改xc/programs/Xserver/hw/xfree86/common下的
xf86Configure.c
添加#define PATH_MAX 1024
‧ 修改/usr/local/arm/3.4/bin
將arm-linux-gcc,arm-linux-g++,arm-linux-ar,arm-linux-ld 都ln到
/usr/local/arm/3.4/arm-linux/bin下
ps: /usr/local/arm/3.4 指的是交叉編譯器的位置

4-加入触摸屏支持
(1)在host.def中应加入如下语句:
#define TouchScreen YES
#define HasTsLib YES
(2)并将tslib-1.0/src/tslib.h文件拷入armtinyx/programs/Xserver/hw/tinyX/linux(解决找不到tslib.h错误)
(3)将交叉编译好的tslib的lib文件夹(几个.so文件)拷贝到交叉编辑环境的arm-linux/lib下(解决ld找不到-lts错误)
注意:编译tslib的交叉编译器必须也要和编译tinyx一样是带软浮点的,不然执行上步会报出浮点不一样的错误
(4)在armtinyx/programs/Xserver/hw/tinyx/tinyx.h文件里添加
#define TOUCHSCREEN
(5)在/armtinyx/programs/Xserver/hw/tinyX/linux/tslib.c中对触摸屏的查找是根据TsNames数组来进行的,如果没有你的开发板上/dev下的触摸屏设备节点的话,将其添加到TsNames数组里。
static char *TsNames[] = {
  "/dev/event0",//我的/dev下的设备结点
  "/dev/ts",
  "/dev/touchscreen/0",
};
5-在/armtinyx/lib/X11/Imakefile
#if (BuildServersOnly || !BuildX11Lib) && !XnestServer && !BuildGLXLibrary && !BuildClients && !XdmxServer
修改为
#if (BuildServersOnly || !BuildX11Lib) && !XnestServer && !BuildGLXLibrary && !BuildClients && !XdmxServer && !TinyXServer
6-编译
make World
make install


ln -s /usr/local/arm/3.4/include /usr/local/arm/3.4/arm-linux/
‧ 在運行一會後,在另外一個term中運行下面語句
cd programs/Xserver/os
make lbxio.o

4編譯安裝

make  World CROSSCOMPILEDIR=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/bin

ftconfig.h), line 84: #error "Unsupported size of `int' type!"

vim ./lib/freetype2/freetype/config/ftconfig.h
将 (71行)
#define FT_CHAR_BIT  CHAR_BIT
改为
#define FT_CHAR_BIT 8

XF86DGA.c:22:40: fatal error: asm/page.h: No such file or directory

OS.c:14:42: fatal error: asm/page.h: No such file or directory

ln -s /usr/src/linux-headers-3.2.0-29/include/asm-generic/page.h /usr/include/asm-generic/
vim lib/Xxf86dga/XF86DGA.c
vim lib/Xaw/OS.c

tslib.c: In function 'TsRead':
tslib.c:86:10: error: 'KdTsCurScreen' undeclared (first use in this function)
tslib.c:86:10: note: each undeclared identifier is reported only once for each function it appears in
tslib.c:86:27: error: 'KdTsPhyScreen' undeclared (first use in this function)

vim programs/Xserver/hw/tinyx/linux/tslib.c
加上下列宣告
extern int KdTsCurScreen;
extern int KdTsPhyScreen;

看到這個算是編譯成功 ~~呼呼

Full build of XFree86 version 4.8.0 (15 December 2008) complete.

删掉#include "asm/page.h" /* #define for PAGE_* */
添加#define PAGE_MASK (~(getpagesize() - 1))


make install

在programs/Xserver 下生成了 Xfbdev

5運行TinyX
複製/usr/share/fonts/X11/75dpi下的字體到TinyX/lib/X11/fonts/75dpi下
運行

未成功…有空再重新編一下~

./Xfbdev -fp lib/X11/fonts/75dpi -fn -adobe-courier-bold-r-normal--8-80-75-75-m-50-iso8859-1 -fc -adobe-times-medium-i-normal—8-80-75-75-p-42-iso8859-1

./Xfbdev -fp lib/X11/fonts/75dpi -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-1 -fc -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-1

Xfbdev -fp /usr/share/fonts -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-1 -fc -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-1

即可
在/home/zhepeng/TinyX/lib/X11添加rgb文件

 

http://bingfeng.blog.edu.cn/2007/110139.html

http://blog.chinaunix.net/uid-136451-id-2879367.html

http://biancheng.dnbcw.info/linux/355450.html

http://bbs.chinaunix.net/thread-2102154-1-1.html

http://bingfeng.blog.edu.cn/2007/110128.html

0 意見:

張貼留言

 
Blogger Templates