2008/06/25

WMU-6500FS - X.Org 7.1 (updated)



Just for fun I am trying to build X.Org and it seems it won't be such a problem to finish it. There are many issues remaining to be solved but at least for now I am able to run couple of simple X-applications.
Update: I have not finished the X server yet, but have built X.Org libraries, so now it is possible to build X client applications.
Build results: [binary (82MB)] [list files]

Following image demonstrates the xcalc application running on the box acting as X-client of the XMing server running on my PC :-)



Dependencies: [m4-1.4.11] [libxslt-1.1.22] [xmlto 0.0.20] [Mesa 7.0.3] [rsh (fake with ssh alias)]
Info sources:
[X Window System Environment]
[Modular Developer's Guide]
[Modular X development using the git trees]
[Embedded Linux Graphics Quick Reference Guide]


Build sequence:
Create source directory and download git_xorg script (will be used to get all xorg modular components from git repository)
dev# cd /usr/local/src
dev# mkdir Xorg
dev# cd Xorg
dev# wget "http://www.x.org/wiki/ModularDevelopersGuide?action=AttachFile&do=get&target=git_xorg.sh" -O git_xorg.sh
dev# chmod a+x git_xorg.sh
dev# echo "do_dir xorg font \"\${font}\"        # this line added to get fonts" >> git_xorg.sh
Customize git_xorg script
dev# nano git_xorg.sh
... you can for example remove all xf86-video-* drivers and related stuff, remove do_dir . xcb "${xcb}", add do_dir xorg font "${font}" in order to download fonts, etc.
dev # diff git_xorg.sh git_xorg.sh.orig
50c50,65
<       xf86-input-vmmouse xf86-input-void"
---
>       xf86-input-vmmouse xf86-input-void xf86-video-apm\
>       xf86-video-ark xf86-video-ast xf86-video-ati\
>       xf86-video-chips xf86-video-cirrus xf86-video-cyrix\
>       xf86-video-dummy xf86-video-fbdev xf86-video-glide\
>       xf86-video-glint xf86-video-i128 xf86-video-i740\
>       xf86-video-impact xf86-video-imstt xf86-video-intel\
>       xf86-video-mga xf86-video-neomagic xf86-video-newport\
>       xf86-video-nsc xf86-video-nv xf86-video-rendition\
>       xf86-video-s3 xf86-video-s3virge xf86-video-savage\
>       xf86-video-siliconmotion xf86-video-sis xf86-video-sisusb\
>       xf86-video-sunbw2 xf86-video-suncg14 xf86-video-suncg3\
>       xf86-video-suncg6 xf86-video-sunffb xf86-video-sunleo\
>       xf86-video-suntcx xf86-video-tdfx xf86-video-tga\
>       xf86-video-trident xf86-video-tseng xf86-video-v4l\
>       xf86-video-vesa xf86-video-vga xf86-video-via\
>       xf86-video-vmware xf86-video-voodoo xf86-video-wsfb"
129c144
< do_dir xorg font "${font}"        # this line added to get fonts
---
> do_dir . xcb "${xcb}"
Now we can start downloading the source:
dev# ./git_xorg.sh
And now we can try to run the build (we have not solved any dependencies yet, I decided to solve it along the way).
The first one is the m4 preprocessor:
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh /mnt/C/sys/X11
    ...
    autom4te: need GNU m4 1.4 or later: /usr/bin/m4
For info how to get and build the m4 preprocessor see this post.
Then there is xcb build error (in case one have not removed it from the git_xorg.sh):
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh /mnt/C/sys/X11
    ...
     configure: error: XCB requires xsltproc.
    /mnt/C/sys/X11/lib/libxcb-xlib.so: undefined reference to `backtrace_symbols'
    /mnt/C/sys/X11/lib/libxcb-xlib.so: undefined reference to `backtrace'
It seems that uClibc does not implement the backtrace related stuff. As a solution we can re-configure the xcb:
dev# cp xcb/libxcb/configure.ac{,.backup}
dev# nano xcb/libxcb/configure.ac
From the configure.ac comment out the following line:
    AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() ...
And then we can continue the build process, the next error is in the libXcomposite:
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh -r xcb/libxcb /mnt/C/sys/X11
    ...
    make[3]: Entering directory `/usr/local/src/Xorg/lib/libXcomposite/man'
    WARNING: configure did not find xmlto, cannot create Xcomposite.man without it
For info how to get and build the xmlto see this post.
The next problem was in xconsole application:
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh -r lib/libXcomposite /mnt/C/sys/X11
...
make[1]: Entering directory `/usr/local/src/Xorg/app/xconsole'
...
In file included from xconsole.c:185:
/usr/include/sys/stropts.h:1:21: stropts.h: No such file or directory
uClibc does not implement streams and so the fact that the stropts.h header file is missing is understandable.
Commenting out the include in xconsole.c file semms to work. For more info about this issue see this source.
After the xconsole.c modification we can try to continue the build process:
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh -r app/xconsole /mnt/C/sys/X11
...
Building app module component xdriinfo...
...
configure: error: cannot find GL library - make sure Mesa or other OpenGL package is installed
For info how to get and build Mesa library see this post.
After that we have to add the new include and library dirs to the environment:
dev# export LDFLAGS="-lGL -L/mnt/C/sys/lib -L/mnt/C/sys/X11/lib -lX11"
dev# export CFLAGS=-I/mnt/C/sys/include
And then we can continue.
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh -r app/xdriinfo -m /usr/local/src/Mesa-7.0.3 /mnt/C/sys/X11
...
Building app module component xsm...
...
configure: error: No rsh like program found
For more details about this issue see this message.

At the time I had not even the dropbear/ssh installed I decided to install it and solve the lack of rsh binary with the following fake:
dev# cd /mnt/C
dev# wget http://mgb111.pradnik.net/addons/servers-ssh/dropbear-ssh-sshd-050.3.tgz
dev# tar xzvf dropbear-ssh-sshd-050.3.tgz
dev# which ssh
/mnt/C/sys/bin/ssh
Now we can create rsh names alias for the ssh binary.
dev# ln -s /mnt/C/sys/bin/{s,r}sh
dev# rsh
Dropbear multi-purpose version 0.50
Make a symlink pointing at this binary with one of the following names:
'dropbear' - the Dropbear server
'dbclient' or 'ssh' - the Dropbear client
'dropbearkey' - the key generator
'dropbearconvert' - the key converter
'scp' - secure copy
dev# ls -l /mnt/C/sys/bin/rsh
lrwxrwxrwx  2 root root 18 Jun 25 14:42 /mnt/C/sys/bin/rsh -> /mnt/C/sys/bin/ssh*
dev# ls -l /mnt/C/sys/bin/ssh
lrwxrwxrwx  1 root root 13 Jun 17 14:34 /mnt/C/sys/bin/ssh -> dropbearmulti*
The symlink method does not work. It is because of the fact that dropbear is the multiapplication and so the ssh binary is actually a symlink pointing to the binary called dropbearmulti binary. For such case the szmlink name matters, it can be one of the names listed above.
We have another possibility, we can create a shell script calling ssh along with all its command line arguments:
dev# echo "\
> #!/bin/bash
> ssh \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9" > /mnt/C/sys/bin/rsh
dev# cat /mnt/C/sys/bin/rsh
#!/bin/bash
ssh $1 $2 $3 $4 $5 $6 $7 $8 $9
dev# chmod a+x /mnt/C/sys/bin/rsh
dev# rsh
Dropbear client v0.50
Usage: ssh [options] [user@]host [command]
Options are:
...
Now back to the Xorg source directory and continue the building process:
dev# cd /usr/local/src/Xorg
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh -r app/xsm -m /usr/local/src/Mesa-7.0.3 /mnt/C/sys/X11
Building xserver module ...
...
checking for GL... configure: error: Package requirements (glproto >= 1.4.9 gl >= 7.1.0) were not met.
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively you may set the GL_CFLAGS and GL_LIBS environment variables
to avoid the need to call pkg-config.  See the pkg-config man page for
more details.
For now we can skip the xserver as well as the driver (we are interested in xclients mainly) modules:
dev# PATH=/mnt/C/sys/X11/bin:$PATH ./util/modular/build.sh -r font/util -m /usr/local/src/Mesa-7.0.3 /mnt/C/sys/X11
...
xcb module component util does not exist, skipping.
Wed Jun 25 13:21:59 MDT 2008

***** Skipped components (not available) *****
 xcb/util
For now we are done with X.Org libraries, except the xserver, drivers and xcb. Maybe we come back to that later...

No comments: