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

 Watch Dog Timer
 LSB test result

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: The latest source code could be found at

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

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


  • Add TLS support to arm toolchain.
  • Adapt the nptl version to the latest version.
  • arm-linux-gcc: 3.2.1
  • arm-linux-binutils:
  • arm-linux-glibc: 2.2.5-2
  • glibc-2.3.2:
  • linuxthreads-2.3.2:
  • nptl-0.20:
  • linux-2.5.59-rmk1-pxa1:

* 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
$ make -j2
$ make subdirs=nptl tests        // to build the test cases of nptl
Contactor: Boris Hu