Extension Development :: DSL-LFS guide draft



lfs.txt
Download and install "debootstrap.dsl".



SARGE:
debootstrap \
--include=bzip2,flex,g++,gcc,less,\
libc6-dev,libncurses5-dev,libreadline4-dev,make,patch,\
perl \
--make-tarball /whatever/whatever.tar.gz \
sarge /mnt/hdaX http://ftp.de.debian.org/debian
debootstrap \
--include=bzip2,flex,g++,gcc,less,\
libc6-dev,libncurses5-dev,libreadline4-dev,make,patch,\
perl \
--unpack-tarball /whatever/whatever.tar.gz \
sarge /mnt/hdaX http://ftp.de.debian.org/debian:
Choose a partition to use for the build, hdaY:
mount /dev/hdaY
mkdir /mnt/hdaY/lfs
cp lfs_sources.tar.gz /mnt/hdaY/lfs
cd /mnt/hdaY/lfs
tar -xzvf lfs_sources.tar.gz
All OK.
cd
CHROOT into SARGE:
unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LD_LIBRARY_PATH
chroot /mnt/hdaX
export PS1="\w $"
We are now working from SARGE.
mknod /dev/hdaY b [?] Y
mkdir /mnt/hdaY
mount /dev/hdaY /mnt/hdaY
ln -s /mnt/hdaY/lfs
ln -s /mnt/hdaY/lfs/sources



LFS part 1:
bash binutils bison coreutils diffutils
ed flex findutils gawk gcc
glibc grep gzip less libiconv
libtool m4 make nano ncurses
patch pkg-config readline sed tar
--
cd /sources/src_lfs/files_lfs
for i in *.tar.gz ; do tar -C .. -xzvf $i ; done
mv ../linuxthreads* ../glibc-2.3.2
cd ../build_lfs/build_libiconv
--
01. libiconv
../../config_lfs/set_libiconv.sh
make install
make install DESTDIR=/lfs
cd ../../patches_lfs
02-21.
for i in bash* ; do patch -p0 < $i ; done
cd ../build_lfs
for i in \
{bash,bison,coreutils,diffutils,ed,\
flex,gawk,grep,gzip,less,\
libtool,m4,make,nano,ncurses,\
patch,pkg-config,readline,sed,tar} ; \
do cd build_$i && ../../config_lfs/set_$i.sh \
&& make install DESTDIR=/lfs && cd .. ; done
cd build_binutils
22. binutils
../../config_lfs/set_binutils.sh
make tooldir=/usr LIB_PATH=/usr/lib:/lib
cp ../../binutils-2.15/include/libiberty.h /usr/include
cp ../../binutils-2.15/include/libiberty.h /lfs/usr/include
make install tooldir=/usr DESTDIR=/lfs
cd ../../linux-headers-2.4.31
23. linux-headers
make include/linux/version.h
cp -R include/asm-i386 /lfs/usr/include/asm
cp -R include/asm-generic /lfs/usr/include
touch include/linux/autoconf.h
cp -R include/linux /lfs/usr/include
cd ../build_lfs/build_glibc
24. glibc
patch -d ../.. -p0 < ../../patches_lfs/glibc-2.3.2-inlining_fixes-2.patch
patch -d ../.. -p0 < ../../patches_lfs/glibc-2.3.2-sscanf-1.patch
../../config_lfs/set_glibc.sh
make
make install install_root=/lfs
cd ../build_gcc
25. gcc
patch -p2 < ../../patches_lfs/gcc-3.3.6-no_fixincludes.patch
patch -p2 < ../../patches_lfs/gcc-3.3.6-suppress_libiberty.patch
../../config_lfs/set_gcc.sh
make
make install DESTDIR=/lfs
--
Add important files to /lfs:
cd /lfs
mkdir dev tmp
cp -a /dev/* dev
ln -s bash bin/sh
ln -s /bin/install usr/bin
ln -s /bin/sed usr/bin
ln -s /usr/bin/cpp lib
ln -s gcc usr/bin/cc
ldconfig -r /lfs
echo /usr/lib > /lfs/etc/ld.so.conf
echo LD_LIBRARY_PATH=/usr/lib:/lib > /lfs/etc/profile
Delete symlinks (to prevent accidental "rm -r"??):
rm /lfs
rm /sources
Exit from SARGE:
exit
Unmount hdaY:
umount /mnt/hdaX/mnt/hdaY
CHROOT into LFS:
chroot /mnt/hdaY/lfs /bin/bash -l
export PS1="\w $"



LFS part 2:
bzip2 debianutils file nasm unzip
util-linux zip zlib
--
cd /sources/src_lfs/bzip-1.0.2
--
01. bzip2
{{
Edit "Makefile".
Under "CFLAGS", change "-O2" to "-Os".
Edit "Makefile-libbz2_so".
Under "CFLAGS", change "-O2" to "-Os".
}}
make install
rm /usr/lib/libbz2.a
make -f Makefile-libbz2_so
cp -a libbz2.so.1.0* /usr/lib
ln -s libbz2.so.1.0 /usr/lib/libbz2.so
cd ../debianutils-2.8.4
02. debianutils
install -m755 which /usr/bin
cd ../file-4.02
03. file
../config_lfs/set_file.sh
make install
cd ../build_lfs/build_nasm
04. nasm
../../config_lfs/set_nasm.sh
make install
cd ../unzip551
05. unzip
{{
Edit "unix/Makefile".
Change "prefix = /usr/local" to "prefix = /usr".
Look for the line that starts with "linux:".
Under "CF=", change "-O3" to "-Os".
}}
make -f unix/Makefile linux install
cd ../util-linux-2.11z
06. util-linux
{{
Edit "MCONFIG".
Change "DISABLE_NLS=no" to "yes".
Under "INSTALLSUID=", change "-o root" to "-o 0".
}}
./configure
{{
Edit "make_include".
Change "CFLAGS=-O2" to "CFLAGS=-Os".
}}
make -C lib
make -C mount install
cd ../zip-2.3
07. zip
{{
Edit "unix/Makefile".
Change "prefix = /usr/local" to "prefix = /usr".
Change "CFLAGS = -O2" to "CFLAGS = -Os".
}}
make -f unix/Makefile generic install
cd ../zlib-1.1.4
08. zlib
../config_lfs/set_zlib.sh
make install
cd ..



LFS part 3:
autoconf automake openssl perl wget
--
cd perl-5.8.0
--
01. perl
./Configure -d -f ../config_lfs/set_perl.sh
make
make install
ln -s /usr/lib/perl5/5.8.0/CORE/libperl.so.5.8 /usr/lib/libperl.so.5.8.0
ln -s libperl.so.5.8 /usr/lib/libperl.so
cd ../build_lfs
02-03.
for i in {autoconf,automake} ; \
do cd build_$i && ../../config_lfs/set_$i.sh \
&& make install && cd .. ; done
cd ../openssl-0.9.7
04. openssl
../config_lfs/set_openssl.sh
{{
Edit "Makefile.ssl".
Look for the line that starts with "CFLAG=".
Change "-O3" to "-Os".
Look for the line that begins with "install:".
Delete "install-docs".
}}
make install
rm /usr/lib/lib{crypto,ssl}.a
cd ../build_lfs/build_wget
05. wget
../../config_lfs/set_wget.sh
make install
Finished building base software.

dsl.txt
DSL NON-X11:
audiofile curl cyrus-sasl db esound
expat fontconfig freetype fuse gdbm
gimp-print glib-1.2 glib-2.6 jpeg libao
gsm libid3tag libmad libogg libpcap
libpng libungif libvorbis newt pcre3
popt slang sqlite tiff
--
cd /sources/src_dsl/files_dsl
for i in *.tar.gz ; do tar -C .. -xzvf $i ; done
cd /sources/src_dsl
--
01. audiofile
cd audiofile-0.2.6
../config_dsl/set_audiofile.sh
make install
cd ../fuse-2.5.3
02. fuse
../config_dsl/set_fuse.sh
make install
cd ../build_dsl/build_gdbm
03. gdbm
../../config_dsl/set_gdbm.sh
make install BINOWN=0 BINGRP=0
cd ../../libgsm-1.0-pl10
04. gsm
patch -d .. -p0 < ../patches_dsl/gsm-1.0.10-shared_lib.patch
make
cp inc/gsm.h /usr/include
cp lib/libgsm.so.1.0.10 /usr/lib
ln -s libgsm.so.1.0.10 /usr/lib/libgsm.so.1
ln -s libgsm.so.1.0.10 /usr/lib/libgsm.so
cd ../libpcap-0.7.1
05. libpcap
patch -d .. -p0 < ../patches_dsl/libpcap-0.7.1-shared_lib.patch
../config_dsl/set_libpcap.sh
make && make install
cd ../libpng-1.2.5
06. libpng
cp scripts/makefile.linux Makefile
{{
Edit "Makefile".
Change "prefix=/usr/local" to "prefix=/usr".
Change "ZLIBLIB=../zlib" and "ZLIBINC=../zlib"
to "ZLIBLIB=/usr/lib" and "ZLIBINC=/usr/include".
Under "CFLAGS=", change "-O3 -funroll-loops" to "-Os".
}}
make install
cd ../build_dsl/build_popt
07. popt
touch ../rpm.c
../../config_dsl/set_popt.sh
make
make install
rm ../rpm.c
cd ../../slang-1.4.5
08. slang
../config_dsl/set_slang.sh
make elf ELF_CFLAGS="-Os -fPIC"
make install-elf
ln -s libslang.so.1.4.5 /usr/lib/libslang.so.1
rm /usr/lib/libslang.a
cd ../newt-0.51.0
09. newt
../config_dsl/set_newt.sh
make whiptail SHCFLAGS="-Os -fPIC"
cp whiptail /usr/bin
cp newt.h /usr/include
cp libnewt.so.0.51.0 /usr/lib
ln -s libnewt.so.0.51.0 /usr/lib/libnewt.so.0.51
ln -s libnewt.so.0.51.0 /usr/lib/libnewt.so
cd ../build_dsl/build_pcre
10. pcre
zcat ../../patches_dsl/pcre3_4.5+7.4-2.diff.gz | patch -d ../../pcre-7.4 -p1
../../config_dsl/set_pcre.sh
make install
cd ..
11-29.
for i in {curl,cyrus-sasl,db,esound,expat,\
freetype,fontconfig,gettext,gimp-print,\
glib-1.2,glib-2.6,jpeg,libao,libid3,\
libmad,libogg,libungif,libvorbis,sqlite} ; \
do cd build_$i && ../../config_dsl/set_$i.sh \
&& make install && ldconfig && cd .. ; done
30. tiff
../config_dsl/set_tiff.sh
make install
ln -s libtiff.so.3.5.7 /usr/lib/libtiff.so.4
Finished building DSL non-X11 libs.

x11.txt
DSL X11:
SDL gd gdk-pixbuf gtk+-1.2 imlib
lesstif t1lib xorg
--
cd /sources/src_x11/files_x11
for i in *.tar.gz ; do tar -C .. -xzvf $i ; done
cd /sources/src_x11
--
01. xorg
(i) protocols
for i in {*proto*,xtrans*} ; \
do cd $i && ../config_x11/set_proto.sh \
&& make install && cd .. ; done
(ii) xlibs
for i in \
lib{ICE,Xau,fontenc,SM,Xdmcp,\
Xfont,X11,Xext,Xpm,Xrender,\
Xt,Xft,Xi,Xmu,Xp,\
Xtst,Xaw} ; \
do cd build_x11/build_$i \
&& ../../config_x11/set_$i.sh \
&& make install && cd ../.. ; done
cd build_x11/build_SDL
02. SDL
{
Edit "../../SDL-1.2.4/configure".
Look for "-march=486".
Change it to "-march=i486".
The following fixes a compilation error:
Look for
SECTION1
and change it to
SECTION2
}
../../config_x11/set_SDL.sh
make
make -C include install
make -C src install
cd ../../gd-1.8.4
03. gd
patch -p1 < ../patches_x11/gd-1.8.4-shared_lib-1.patch
make install
cd ../t1lib-1.3.1
04. t1lib
../config_x11/set_t1lib.sh
make install
cd ..
05-08.
for i in {gtk+-1.2,gdk-pixbuf,imlib,lesstif} ; \
do cd build_x11/build_$i && ../../config_x11/set_$i.sh \
&& make install && ldconfig && cd ../.. ; done
Finished building DSL X11 libs.


original here.