Cross compiling Tiny-X (XFree86-4.8) for arm

 As a preparation I build the tslib for touchscreen functional in this application, so do it first.

If  the tslib was built and  the export of tslib paths was declared, then the cursor can move with press on in Tiny-X.

To build tslib, download it and extract

export PREFIX=/opt/arm
./autogen.sh echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache CC=arm-linux-gcc ./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache make make install

Modify /opt/arm/etc/ts.conf

De-commit line "module_raw input" to let it enable

module_raw input

Add a "ts_init.sh" file into /opt/arm/bin

#! /bin/sh
# ts_init.h

export TSLIB_ROOT=/opt/arm
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=$TSLIB_ROOT/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts export TSLIB_CONSOLEDEVICE=none export TSLIB_FBDEVICE=/dev/fb0 export LD_LIBRARY_PATH=$TSLIB_ROOT/lib

 

Copy the /opt/arm to board file system again.

Then test on the board with firstly export by file below with command ". /opt/arm/bin/ts_init.sh" (don't miss the ". " before words)

then try

/opt/arm/bin/ts_calibrate

 

 

http://www.xfree86.org/

Download Free86-4.8.0-src-(1~7).tgz

Extract this tgz, see a "xc" folder

optional can link a folder to xc as a work folder

mkdir tinyx
cd tinyx
lndir ../xc/ 

 

Create cross.def and host.def as below into xc/config/cf ( make sure cross-compiler path to be right and make your target path in definition of ProjectRoot)

/* $XFree86: xc/config/cf/cross.def,v 1.3 2002/04/04 14:05:33 eich Exp $ */
/*
 * This file contains redefinitions of some symbols to enable
 * cross compilation: e.g. paths for include files and paths to
 * compiler images.  It will have to be edited to reflect these
 * given your local configuration.
 */
#if 1
#undef i386Architecture
#define Arm32Architecture

#undef OptimizedCDebugFlags
#define OptimizedCDebugFlags     -O2
#define ServerCDebugFlags    -O2
#undef StandardDefines
#define StandardDefines     -Dlinux -D__arm__ -D_POSIX_SOURCE \
                -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#undef CcCmd
#define StdIncDir /home/crosstool/arm-linux-4.4.3/include/
#define PreIncDir 
#undef PostIncDir
#define PostIncDir /home/crosstool/arm-linux-4.4.3/include
#define CcCmd /home/crosstool/arm-linux-4.4.3/bin/arm-linux-gcc
#undef CplusplusCmd
#define HasCplusplus YES
#define CplusplusCmd /home/crosstool/arm-linux-3.4.3/bin/arm-linux-g++
#define DoRanlibCmd YES
#define RanlibCmd /home/crosstool/arm-linux-4.4.3/bin/arm-linux-ranlib
#undef ExtraLoadFlags
#define ExtraLoadFlags
#define FbNoPixelAddrCode
#undef TermcapLibrary
#define TermcapLibrary -ltermcap

#undef LdPostLib
#define LdPostLib    -L/home/crosstool/arm-linux-4.4.3/lib

#undef ExtensionOSDefines
#define ExtensionOSDefines

#define ServerXdmcpDefines    /**/

#define HostCcCmd  cc
#endif
#include 

 

#define KDriveXServer       YES
#define TinyXServer     YES  
#define XfbdevServer        YES
#undef CrossCompiling
#define CrossCompiling      YES

#define XF86Server        NO
#define XnestServer     NO
#define XVirtualFramebufferServer   NO
#define XdmxServer      NO
#define XprtServer      NO
#define BuildX11Lib        YES
#define BuildXextLib    YES #define BuildFontServer NO #define BuildFonts YES #define BuildXF86RushExt NO #define HasXdmAuth NO #define BuildDocs NO #define BuildIPv6 NO #define HasMTRRSupport NO #define UseX86Emu NO #define XF86INT10_BUILD X86INT10_STUB #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 keyboard mouse #define ProjectRoot /opt/arm #define NothingOutsideProjectRoot YES #define BuildServersOnly YES #define BuildRender YES #define UseRgbTxt YES #define OmitSnfSupport YES #define HasFreetype2 NO #define HasFontconfig NO #define HasLibpng NO #define HasZlib NO #define HasExpat NO #define TouchScreen YES #define HasTsLib YES

Build first time

make World

../../config/makedepend/makedepend: warning:  ftapi.c (reading ./freetype/config/ftconfig.h), line 84: #error "Unsupported size of `int' type!"
../../config/makedepend/makedepend: warning:  ftapi.c (reading ./freetype/config/ftconfig.h), line 94: #error "Unsupported size of `long' type!"

Modify xc/lib/freetype2/freetype/config/ftconfig.h

// #define FT_CHAR_BIT  CHAR_BIT
#define FT_CHAR_BIT  8 

 Will get a error of libXaw.a

Modify xc/fonts/util/Makefile

# DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
DEPLIBS = 

 

tslib.c: In function 'TsRead':
tslib.c:85: error: 'KdTsCurScreen' undeclared (first use in this function)
tslib.c:85: error: (Each undeclared identifier is reported only once
tslib.c:85: error: for each function it appears in.)
tslib.c:85: error: 'KdTsPhyScreen' undeclared (first use in this function)
Modify xc/programs/Xserver/hw/tinyx/linux/tslib.c, add two lines, and add the touchscreen tslib device support in Tiny-X.

#include 
extern int KdTsCurScreen;
extern int KdTsPhyScreen;
static long lastx = 0, lasty = 0;

static char *TsNames[] = {
  "/dev/input/event0", /* Add this line as the board system specific */
  "/dev/ts",    
  "/dev/touchscreen/0",
};

 

Build second time

make

Everything OK.

make install

 

Copy xc/fonts/bdf/misc/4x6.bdf to /opt/arm/lib/X11/fonts/misc

Copy  /opt/arm/bin and /opt/arm/lib directoty to board root file system "/opt/arm/bin" and "/opt/arm/lib",

then copy "rgb.txt" to "/opt/arm/lib/X11" in board root file system

Copy from Xfonts.tgz file's lib/X11/fonts/misc/5x7-iso8859-1 and fonts.dir  to "/opt/arm/lib/X11/fonts/misc" ( or download the my 5x7 misc folder from here)

then run in first time.

# /opt/arm/bin/Xfbdev -fp /opt/arm/lib/X11/fonts/misc/ -fn -misc-fixed-medium-r-normal--7-70-75-75-c-50-iso8859-1 -fc -misc-fixed-medium-r-normal--7-70-75-75-c-50-iso8859-1

 We can see

Cross compiling Tiny-X (XFree86-4.8) for arm_第1张图片

 

If need a X11 lib with build, should be modify xc/lib/Imakefile, and then make World.

#if (BuildServersOnly || !BuildX11Lib) && !XnestServer && !BuildGLXLibrary && !BuildClients && !XdmxServer && !TinyXServer

 

 

转载于:https://www.cnblogs.com/kozmers/p/3821061.html

你可能感兴趣的:(嵌入式)