#!/bin/sh #====================================================================# # directories # #====================================================================# BUILD_DIR=$HOME/pf ROOT_DIR=$BUILD_DIR/root PKG_DIR=$BUILD_DIR/pkg SRC_DIR=$BUILD_DIR/src TMP_DIR=$BUILD_DIR/tmp #====================================================================# # versions # #====================================================================# LINUX=linux-2.4.20 SYSVINIT=sysvinit-2.83 BASH=bash-2.05b NETTOOLS=net-tools-1.60 UTILLINUX=util-linux-2.11y E2FSPROGS=e2fsprogs-1.32 FILEUTILS=fileutils-4.1 TEXTUTILS=textutils-2.1 SHADOW=shadow-4.0.3 SYSLOGNG=syslog-ng-1.5.23 LIBOL=libol-0.3.5 MODUTILS=modutils-2.4.22 IPTABLES=iptables-1.2.7a OPENSSL=openssl-0.9.6h ZLIB=zlib-1.1.4 OPENSSH=openssh-3.5p1 TAR=tar-1.13 BZIP2=bzip2-1.0.2 #====================================================================# # tools # #====================================================================# FTP=ftp TARC=tar -c TARX=tar -x BTAR=-y GTAR=-z #====================================================================# # my little helpers # #====================================================================# GID=`grep $USER /etc/passwd|awk -F":" '{print $4}'` cprm() { cd $TMP_DIR cp * $ROOT_DIR/ rm -rf [a-z]* $TARC $BTAR --owner=0 --group=0 -f $PKG_DIR/$1.tar.bz2 * cd $SRC_DIR } mkdir -p $ROOT_DIR $PKG_DIR $SRC_DIR $TMP_DIR #====================================================================# # download # #====================================================================# cd $SRC_DIR # linux $FTP ftp://ftp.de.kernel.org/pub/linux/kernel/v2.4/$LINUX.tar.bz2 # sysvinit $FTP ftp://sunsite.unc.edu/pub/linux/system/daemons/init/$SYSVINIT.tar.gz $FTP $SYSVINIT-dietlibc-patch.diff # bash $FTP ftp://ftp.gnu.org/gnu/bash/$BASH.tar.gz $FTP $BASH-dietlibc-patch.diff # net-tools $FTP http://www.tazenda.demon.co.uk/phil/net-tools/$NETTOOLS.tar.bz2 $FTP $NETTOOLS-dietlibc-patch.diff $FTP $NETTOOLS-dietlibc-config.h # util-linux $FTP ftp://ftp.de.kernel.org/pub/linux/utils/util-linux/$UTILLINUX.tar.bz2 $FTP $UTILLINUX-dietlibc-patch.diff # e2fsprogs $FTP http://belnet.dl.sourceforge.net/sourceforge/e2fsprogs/$E2FSPROGS.tar.gz $FTP $E2FSPROGS-dietlibc-patch.diff # fileutils $FTP ftp://ftp.gnu.org/gnu/fileutils/$FILEUTILS.tar.gz $FTP $FILEUTILS-dietlibc-patch.diff # textutils $FTP ftp://ftp.gnu.org/gnu/textutils/$TEXTUTILS.tar.bz2 $FTP $TEXTUTILS-dietlibc-patch.diff # shadow $FTP ftp://ftp.pld.org.pl/software/shadow/$SHADOW.tar.bz2 $FTP $SHADOW-dietlibc-patch.diff # syslog-ng $FTP http://www.balabit.hu/downloads/syslog-ng/1.5/$SYSLOGNG.tar.gz $FTP http://www.balabit.hu/downloads/syslog-ng/libol/0.3/$LIBOL.tar.gz # modutils $FTP ftp://ftp.de.kernel.org/pub/Mirrors/ftp.kernel.org/pub/linux/utils/kernel/modutils/v2.4/$MODUTILS.tar.bz2 # iptables $FTP ftp://ftp.netfilter.org/pub/iptables/$IPTABLES.tar.bz2 $FTP $IPTABLES-dietlibc-patch.diff # openssl $FTP http://www.openssl.org/source/$OPENSSL.tar.gz # zlib $FTP ftp://ftp.info-zip.org/pub/infozip/zlib/$ZLIB.tar.bz2 # openssh $FTP ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/$OPENSSH.tar.gz # tar $FTP ftp://ftp.gnu.org/gnu/tar/$TAR.tar.bz2 $FTP ftp://sources.redhat.com/pub/bzip2/contrib/gnutarpatch.txt # bzip2 $FTP ftp://sources.redhat.com/pub/bzip2/v102/$BZIP2.tar.gz $FTP $BZIP2-dietlibc-patch.diff #====================================================================# # untar, patch, build, install temporarily, package, delete # #====================================================================# # # linux # $TARX $BTAR -f $LINUX.tar.bz2 cd $LINUX make menuconfig dep bzImage mkdir -p $TMP_DIR/boot cp arch/i386/boot/bzImage $TMP_DIR/boot/vmlinuz cprm linux # # sysvinit # $TARX $GTAR -f $SYSVINIT.tar.gz cd $SYSVINIT patch -p1 < ../$SYSVINIT-dietlibc-patch.diff cd src make make ROOT=$TMP_DIR BIN_OWNER=$UID BIN_GROUP=$GID install cprm sysvinit # # bash # $TARX $GTAR -f $BASH.tar.gz cd $BASH patch -p1 < ../$BASH-dietlibc-patch.diff CC="diet -Os gcc -Wall -s -nostdinc" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --enable-alias --enable-arith-for-command --enable-array-variables --enable-bang-history --enable-brace-expansion --enable-command-timing --enable-cond-command --enable-directory-stack --enable-disabled-builtins --enable-dparen-arithmetic --enable-extended-glob --enable-help-builtin --enable-history --enable-job-control --enable-process-substitution --enable-progcomp --enable-prompt-string-decoding --enable-readline --enable-select --enable-static-link make make DESTDIR=$TMP_DIR install cprm bash # # net-tools # WARNING: leave out -nostdinc for now (includes kernel header, beyond repair) # $TARX $BTAR -f $NETTOOLS.tar.bz2 cd $NETTOOLS patch -p1 <../$NETTOOLS-dietlibc-patch.diff cp ../$NETTOOLS-dietlibc-config.h ./config.h make make BASEDIR=$$TMP_DIR install cprm nettools # # util-linux # $TARX $BTAR -f $UTILLINUX.tar.bz2 cd $UTILLINUX patch -p1 <../$UTILLINUX-dietlibc-patch.diff CC="diet -Os gcc -Wall -s -nostdinc -D_BSD_SOURCE -D_GNU_SOURCE" ./configure echo 'HAVE_NCURSES=no HAVE_TERMCAP=no' >> make_include make make DESTDIR=$TMP_DIR install cprm utillinux # # e2fsprogs # $TARX $GTAR -f $E2FSPROGS.tar.gz cd $E2FSPROGS patch -p1 <../$E2FSPROGS-dietlibc-patch.diff CC="diet -Os gcc -Wall -s -nostdinc -D_BSD_SOURCE -D_GNU_SOURCE" ./configure --prefix=/usr --with-root-prefix=/ --infodir=/usr/share/info --mandir=/usr/share/man --enable-fsck make make DESTDIR=$TMP_DIR install cprm e2fsprogs # # fileutils # $TARX $GTAR -f $FILEUTILS.tar.gz cd $FILEUTILS patch -p1 <../$FILEUTILS-dietlibc-patch.diff CC="diet -Os gcc -Wall -s -nostdinc" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man make make DESTDIR=$TMP_DIR install cprm fileutils # # textutils # $TARX $BTAR -f $TEXTUTILS.tar.bz2 cd $TEXTUTILS patch -p1 <../$TEXTUTILS-dietlibc-patch.diff CC="diet -Os gcc -Wall -s -nostdinc" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man make make DESTDIR=$TMP_DIR install cprm textutils # # shadow # $TARX $BTAR -f $SHADOW.tar.bz2 cd $SHADOW patch -p1 <../$SHADOW-dietlibc-patch.diff CC="diet -Os gcc -Wall -s -nostdinc -D_BSD_SOURCE" ./configure --prefix=/usr --libdir=/usr/lib --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --disable-nls make make DESTDIR=$TMP_DIR install cprm shadow # # syslog-ng # $TARX $GTAR -f $SYSLOGNG.tar.gz $TARX $GTAR -f $LIBOL.tar.gz cd $LIBOL CC="diet -Os gcc -Wall -s -nostdinc" ./configure cd ../$SYSLOGNG CC="diet -Os gcc -Wall -s -nostdinc" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --with-libol=../$LIBOL make DESTDIR=$TMP_DIR install cprm syslogng # # modutils # $TARX $BTAR -f $MODUTILS.tar.bz2 cd $MODUTILS CC="diet -Os gcc -Wall -s -nostdinc -I$SRC_DIR/$LINUX/include" ./configure --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man make DESTDIR=$TMP_DIR install cprm modutils # # iptables # $TARX $BTAR -f $IPTABLES.tar.bz2 cd $IPTABLES patch -p1 <../$IPTABLES-dietlibc-patch.diff make CC="diet -Os gcc -Wall -s -nostdinc -D_BSD_SOURCE -D_GNU_SOURCE" PREFIX=/usr MANDIR=/usr/share/man NO_SHARED_LIBS=1 KERNEL_DIR=$SRC_DIR/$LINUX make DESTDIR=$TMP_DIR PREFIX=/usr MANDIR=/usr/share/man NO_SHARED_LIBS=1 KERNEL_DIR=$SRC_DIR/$LINUX install cprm iptables # # openssl # $TARX $GTAR -f $OPENSSL.tar.gz cd $OPENSSL ./config no-dso 386 --openssldir=/etc/ssl --prefix=/usr --install_prefix=$TMP_DIR make CC="diet -Os gcc -Wall -s -nostdinc" make CC="diet -Os gcc -Wall -s -nostdinc" MANDIR=/usr/share/man install cprm openssl # # zlib # $TARX $BTAR -f $ZLIB.tar.bz2 cd $ZLIB CC="diet -Os gcc -Wall -s -nostdinc" ./configure --prefix=/usr mkdir -p $TMP_DIR/usr make prefix=$TMP_DIR/usr install cprm zlib # # openssh # $TARX $GTAR -f $OPENSSH.tar.gz cd $OPENSSH CC="diet -Os gcc -Wall -s -nostdinc -I$ROOT_DIR/usr/include -L$ROOT_DIR/usr/lib" ./configure --prefix=/usr --sysconfdir=/etc/ssh --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --with-privsep-user=sshd --with-privsep-path=/var/lib/sshd --with-md5-passwords --with-default-path="/bin:/usr/bin:/usr/local/bin" --with-superuser-path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" --with-pid-dir=/var/run/sshd.pid --with-lastlog=/var/log/lastlog make make DESTDIR=$TMP_DIR install cprm openssh # # tar # $TARX $GTAR -f $TAR.tar.gz cd $TAR/src patch <../../gnutarpatch.txt cd .. CC="diet -Os gcc -Wall -s -nostdinc" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man make make DESTDIR=$TMP_DIR install # # bzip2 # $TARX $GTAR -f $BZIP2.tar.gz cd $BZIP2 patch -p1 <../$BZIP2-dietlibc-patch.diff make make PREFIX=$TMP_DIR/usr install cprm bzip2 # # etc # cd $TMP_DIR mkdir -p bin dev etc/defaults etc/skel etc/syslog-ng home lib/modules mnt/cdrom mnt/floppy proc root sbin/rc.d/init.d tmp var/lib/random var/lock var/log var/run var/tmp