Carrier Grade Linux(CGL) for ARM/XScale based system

 Home
 AHM
 Ipv6
 Kdb
 NPTL
 Watch Dog Timer
 LKCD
 LSB test result
 Links

NPTL for XScale(TM):


Native POSIX Thread Library(NPTL) is an enhanced implementation of POSIX thread library and tries to replace the linuxthreads implementation with the help of linux kernel.It is designed and implemented by Ulrich Drepper and Ingo Molnar. Its design document could be found at: http://people.redhat.com/drepper/nptl-design.pdf. The latest source code could be found at ftp://people.redhat.com/drepper/nptl/.

To enable nptl in one platfrom, three components need be touched: linux kernel, glibc, and nptl. Meanwhile, a TLS(Thread Local Storage) feature support is required in the toolchain. (Its document could be found at http://people.redhat.com/drepper/tls.pdf)

However, TLS is absent in arm toolchain. So here is a work-around way. In the linux kernel, a thread register is simulated by an additional field(pd_addr) to thread_struct and two system calls(sys_get/set_thread_area()). __thread keyword is disabled in glibc and nptl. Moreover, some code related TLS in nptl is protected by the glibc macro USE_TLS.

So far, all tests in nptl-0.20 have passed in the arm-linux-2.5.59 on pxa-250 platform. :p

TODO
--------

  • Add TLS support to arm toolchain.
  • Adapt the nptl version to the latest version.
Toolchain
----------
  • arm-linux-gcc: 3.2.1
  • arm-linux-binutils: 2.13.90.0.20
  • arm-linux-glibc: 2.2.5-2
Codebase
---------
  • glibc-2.3.2: http://ftp.gnu.org/gnu/glibc/glibc-2.3.2.tar.bz2
  • linuxthreads-2.3.2: http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.2.3.tar.bz2
  • nptl-0.20: ftp://people.redhat.com/drepper/nptl/nptl-0.20.tar.bz2
  • linux-2.5.59-rmk1-pxa1: http://www.kernel.org/pub/linux/kernel/v2.5/linux-2.5.59.tar.bz2 ftp://ftp.arm.linux.org.uk/pub/armlinux/kernel/v2.5/patch-2.5.59-rmk1.gz ftp://ftp.arm.linux.org.uk/pub/linux/arm/people/nico/diff-2.5.59-rmk1-pxa1.gz
Patches
--------------

* arm-kernel-2.5.59-nptl.diff

* glibc-2.3.2-arm-nptl.diff

* arm-nptl-0.20.diff

Steps to build kernel
-----------------------------
$ tar xjvf linux-2.5.59.tar.bz2
$ cd linux-2.5.59
$ gzip -dc ../patch-2.5.59-rmk1.gz | patch -p1
$ gzip -dc ../diff-2.5.59-rmk1-pxa1.gz | patch -p1
$ patch -p1 < arm-kernel-2.5.59-nptl.diff

$ make XXX_config (board related)
$ make menuconfig

Select "File System"-->Virtual memory file sytem support (former shm fs) $ make oldconfig
$ make dep
$ make zImage
$ When it boots, type the following command in the target board

mount -t tmpfs none /dev/shm/

Steps to build glibc & nptl
-----------------------------------
$ tar xjvf glibc-2.3.2.tar.bz2
$ tar xjvf glibc-linuxthreads-2.3.2.tar.bz2 -C glibc-2.3.2
$ tar xjvf nptl-0.20.tar.bz2 -C glibc-2.3.2
$ cd glibc-2.3.2; patch -p1 < glibc-2.3.2-arm-nptl.diff
$ cd nptl; patch -p1 < arm-nptl-0.20.diff
$ cd ..; cd ..;
$ mkdir glibc-2.3.2-build
$ cd glibc-2.3.2-build

$ ../glibc-2.3.2/configure arm-linux --prefix=/tmp/install --enable-add-ons=nptl

          --without-tls --without-__thread  --build=i686-pc-linux-gnu
          --with-headers=/nptl_test/linux-2.5.59/include
$ make -j2
$ make subdirs=nptl tests        // to build the test cases of nptl
Contactor: Boris Hu
SF VIM WML