I suppose you use Debian-like systems
$ mkdir rootdir && cd rootdir && export ROOTDIR=$PWD
$ apt-get source libdevmapper1.02.1
$ apt-get source cryptsetup
$ cd lvm2-2.02.95
$ ./configure --enable-static_link
$ make
$ make install DESTDIR=${ROOTDIR}/system/
$ cd ../cryptsetup-1.4.3
$ ./configure --enable-static-cryptsetup --enable-static \
DEVMAPPER_CFLAGS="-I$ROOTDIR/system/usr/include/" \
DEVMAPPER_LIBS="-L$ROOTDIR/system/usr/lib/ -ldevmapper"
$ make
$ make install DESTDIR=$ROOTDIR/system/
In order to create an initrd image use the following
$ /usr/src/linux-git/usr/gen_init_cpio cpio_list | gzip -9 -n > initrd.gz
where linux-git
is the directory of the linux kernel source.