Installation of libgpg-error, libgcrypt, libtasn1, gnutls and gsasl under uClinux 20041215
==========================================================================================

Written by Simon Josefsson on 2007-08-21.  Last updated 2007-08-28.
See link:http://josefsson.org/uclinux/old/[] for more information.

Download the uClinux distribution
---------------------------------

   Get it from http://uclinux.org/pub/uClinux/dist/

   This was written for the 20041215 version,
   MD5 878afd232cfb40919b3823ea8d814b72.

   Unpack it as follows:

...........
$ tar xfj uClinux-dist-20041215.tar.bz2
...........

Download the m68k/Coldfire cross compiler
-----------------------------------------

   Get it from http://www.uclinux.org/pub/uClinux/m68k-elf-tools/

   This was written for the 20030314 version,
   MD5 c2fb8b65764bda8f3ad4ffacf14ad5fe.

   Install it as follows

...........
# sh ./m68k-elf-tools-20030314.sh
...........

Download libgpg-error, libgcrypt, libtasn1, gnutls, gsasl
---------------------------------------------------------

...........
$ cd uClinux-dist/lib
...........

...........
$ wget -q ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.5.tar.bz2
$ sha1sum libgpg-error-1.5.tar.bz2
1f83d9af8e8ed3bcbf3a5e9018db257dc6336655  libgpg-error-1.5.tar.bz2
$ tar xfj libgpg-error-1.5.tar.bz2
...........

...........
$ wget -q ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.2.4.tar.gz
$ sha1sum libgcrypt-1.2.4.tar.gz
d279e7a4464cccf0cc4e29c374a1e8325fc65b9a  libgcrypt-1.2.4.tar.gz
$ tar xfz libgcrypt-1.2.4.tar.gz
...........

...........
$ wget -q http://josefsson.org/gnutls/releases/libtasn1/libtasn1-0.3.10.tar.gz
$ sha1sum libtasn1-0.3.10.tar.gz
d2789ac7482132ef2c9b2b9d1a43d0e921796241  libtasn1-0.3.10.tar.gz
$ tar xfz libtasn1-0.3.10.tar.gz
...........

...........
$ wget -q http://josefsson.org/gnutls/releases/gnutls-1.6.3.tar.bz2
$ sha1sum gnutls-1.6.3.tar.bz2
7553b9f7ddd4982c0759b814bc6d9bf892cf7347  gnutls-1.6.3.tar.bz2
$ tar xfj gnutls-1.6.3.tar.bz2
...........

...........
$ wget -q http://josefsson.org/gsasl/releases/gsasl-0.2.20.tar.gz
$ sha1sum gsasl-0.2.20.tar.gz
97493a7d60b389f4a88884a5ef5798f9311fa0d6  gsasl-0.2.20.tar.gz
$ tar xfz gsasl-0.2.20.tar.gz
...........

Download custom makefiles
-------------------------

   Get the files from http://josefsson.org/uclinux/old/

   Apply it as follows:

...........
cd uClinux/lib/
wget -O libgpg-error-1.5/config.h http://josefsson.org/uclinux/old/libgpg-error.configh
wget -O libgpg-error-1.5/makefile http://josefsson.org/uclinux/old/libgpg-error.mk
wget -O libgcrypt-1.2.4/config.h http://josefsson.org/uclinux/old/libgcrypt.configh
wget -O libgcrypt-1.2.4/makefile http://josefsson.org/uclinux/old/libgcrypt.mk
wget -O libtasn1-0.3.10/config.h http://josefsson.org/uclinux/old/libtasn1.configh
wget -O libtasn1-0.3.10/makefile http://josefsson.org/uclinux/old/libtasn1.mk
wget -O gnutls-1.6.3/config.h http://josefsson.org/uclinux/old/gnutls.configh
wget -O gnutls-1.6.3/makefile http://josefsson.org/uclinux/old/gnutls.mk
wget -O gsasl-0.2.20/config.h http://josefsson.org/uclinux/old/gsasl.configh
wget -O gsasl-0.2.20/makefile http://josefsson.org/uclinux/old/gsasl.mk
...........

Note that the modified config.h files uses the #include <endian.h> to
find out the endian-ness of the platform.  If that header file is
unavailable or incorrect, you'll have to modify endian-ness yourself
by setting WORDS_BIGENDIAN correctly.  Remember that x86 is little
endian, and many other platforms are big endian.  Use 'make check' in
libgcrypt to verify that it works correctly.

Adapt lib/Makefile
------------------

   Search for the following lines in lib/Makefile:

.......
# And build libraries in the prop directory last
dir_y += $(ROOTDIR)/prop
.......

   Add the following statements _before_ those two lines:

.......
dir_y += libtasn1-0.3.10
dir_y += libgpg-error-1.5
dir_y += libgcrypt-1.2.4
dir_y += gnutls-1.6.3
dir_y += gsasl-0.2.20
.......


   Search for the following line in lib/Makefile:

.......
LINKLIBS=\
.......

   Add the following lines _after_ that line:

.......
    $(ROOTDIR)/lib/libtasn1-0.3.10/lib/*.a \
    $(ROOTDIR)/lib/libtasn1-0.3.10/lib/libtasn1.h \
    $(ROOTDIR)/lib/libgpg-error-1.5/src/*.a \
    $(ROOTDIR)/lib/libgpg-error-1.5/src/gpg-error.h \
    $(ROOTDIR)/lib/libgcrypt-1.2.4/src/*.a \
    $(ROOTDIR)/lib/libgcrypt-1.2.4/src/gcrypt.h \
    $(ROOTDIR)/lib/libgcrypt-1.2.4/src/gcrypt-module.h \
    $(ROOTDIR)/lib/gnutls-1.6.3/lib/libgnutls.a \
    $(ROOTDIR)/lib/gnutls-1.6.3/includes/gnutls/compat.h \
    $(ROOTDIR)/lib/gnutls-1.6.3/includes/gnutls/gnutls.h \
    $(ROOTDIR)/lib/gnutls-1.6.3/includes/gnutls/pkcs12.h \
    $(ROOTDIR)/lib/gnutls-1.6.3/includes/gnutls/x509.h \
    $(ROOTDIR)/lib/gsasl-0.2.20/lib/src/*.a \
    $(ROOTDIR)/lib/gsasl-0.2.20/lib/src/gsasl.h \
.......

Build uClinux
-------------

...........
$ cd uClinux-dist
$ make menuconfig
...........

   I changed the kernel to 'linux-2.4' and CPU to Motorola/M5407C3.

...........
$ make dep
$ make
...........

Finished
--------

The packages, more precisely the libraries and header files, should
now be available from:

...........
             uClinux-dist/lib/libgpg-error.a
             uClinux-dist/lib/libgcrypt.a
             uClinux-dist/lib/libtasn1.a
             uClinux-dist/lib/libgnutls.a
             uClinux-dist/lib/libgsasl.a
...........
