Rdist Tutorial
Rdist Tutorial
net)
Copyright (c) 2005 (GNU Free Documentation License)
Last Updated: Wed Jun 15 17:13:10 EDT 2005
[http://souptonuts.sourceforge.net/gcc_cdrom.html]
# groupadd distro
# useradd -s /bin/bash -g distro -m -k /dev/null distro
# passwd distro
# mkdir /distro
# mkdir /distro/tools
# chown -R distro.distro /distro
# ln -s /distro/tools /
# su - distro
set +h
umask 022
DISTRO=/distro
LC_ALL=POSIX
PATH=/tools/bin:/bin:/usr/bin
export DISTRO LC_ALL PATH
source ~/.bash_profile
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz.sig
$ tar -xzf binutils-2.16.tar.gz
$ cd binutils-2.16
Make Part.
$ make configure-host
$ make LDFLAGS="-all-static"
$ make install
$ make -C ld clean
$ make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib
4. Install GCC
Ok, first mistake was going with gcc4. I now need to backup and go with
gcc 3, since there are problems with glibc. GCC creates a /tools directory
http://gcc.gnu.org/install/configure.html
$ cd
$ wget http://strawberry.resnet.mtu.edu/pub/gcc/gcc/releases/gcc-3.4.3/gcc-core-3.4.3.tar.gz
$ tar -xzf gcc-core-3.4.3.tar.gz
(See step 12, maybe it should be the gcc-3.4.3.tar.gz)
Note below you NOT building in the source of gcc-3.4.3 but building in "gcc-build".
$ mkdir gcc-build
$ cd gcc-build
$ ../gcc-3.4.3/./configure --prefix=/tools --libexecdir=/tools/lib \
--with-local-prefix=/tools --disable-nls \
--enable-shared --enable-languages=c
$ ln -s gcc /tools/bin/cc
You will now have a /tools directory. You may have to create this first with root
, then, give access to distro. I'll need to check this.
$ ln -s gcc /tools/bin/cc
5. Linux-Libc-Headers
$ cd
$ wget http://ep09.pld-linux.org/~mmazur/linux-libc-headers/linux-libc-headers-
2.6.11.2.tar.bz2
$ tar -xjf linux-libc-headers-2.6.11.2.tar.bz2
$ cd linux-libc-headers-2.6.11.2
$ cp -R include/asm-i386 /tools/include/asm
$ cp -R include/linux /tools/include
6. Linux Kernel
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.2.tar.bz2
$ tar -xjf linux-2.6.11.2.tar.bz2
$ cd linux-2.6.11.2
$ mkdir /tools/glibc-kernheaders
$ cp -HR include/asm /tools/glibc-kernheaders
$ cp -R include/asm-generic /tools/glibc-kernheaders
$ cp -R include/linux /tools/glibc-kernheaders
7. Glibc
Again, this is done outside the source.
Note glibc-2.3.5.tar.gz will NOT compile with
gcc 4. You'll need to wait for glibc-2.3.6. Also, a good read
http://www.gnu.org/software/libc/
$ wget ftp://ftp.gnu.org/gnu/glibc/glibc-2.3.5.tar.gz
$ tar -xzf glibc-2.3.5.tar.gz
$ mkdir glibc-build
$ cd glibc-build
$ ../glibc-2.3.5/configure --prefix=/tools \
--disable-profile --enable-add-ons=nptl --with-tls \
--with-__thread --enable-kernel=2.6.0 \
--with-binutils=/tools/bin --without-gd --without-cvs --with-selinux \
--with-headers=/tools/glibc-kernheaders
$ make
I keep getting this
uild/nscd/nscd_stat.o.dt -MT /home/distro/glibc-build/nscd/nscd_stat.o
nscd_stat.c:34:30: selinux/selinux.h: No such file or directory
nscd_stat.c:35:26: selinux/avc.h: No such file or directory
nscd_stat.c:81: error: field `cstats' has incomplete type
make[2]: *** [/home/distr
So I did this
$ cp -r /usr/include/selinux /tools/include/.
But, that didn't work, so I did this
$ cp -r /usr/include/selinux /home/distro/glibc-2.3.5/include/.
So far that worked.
$ make check
I get these errors
make[2]: *** [/home/distro/glibc-build/nptl/tst-cancel17.out] Error 1
make[2]: Leaving directory `/home/distro/glibc-2.3.5/nptl'
make[1]: *** [nptl/tests] Error 2
make[1]: Leaving directory `/home/distro/glibc-2.3.5'
make: *** [check] Error 2
$ make install
$ make localedata/install-locales
$ cd
$ cd binutils-2.16
$ make -C ld install
9. Tcl
$ wget http://internap.dl.sourceforge.net/sourceforge/tcl/tcl8.4.9-src.tar.gz
$ tar -xzf tcl8.4.9-src.tar.gz
$ cd tcl8.4.9
$ cd unix
$ ./configure --prefix=/tools
$ make
$ TZ=UTC make test
$ make install
$ ln -s tclsh8.4 /tools/bin/tclsh
10. Expect
$ wget http://freshmeat.net/redir/expect/2476/url_tgz/expect.tar.gz
$ cd expect-5.43
$ patch -Np1 -i ../expect-5.42.1-spawn-1.patch
11. DejaGNU
$ wget http://freshmeat.net/redir/dejagnu/12564/url_tgz/dejagnu-1.4.4.tar.gz
$ tar -xzf dejagnu-1.4.4.tar.gz
$ cd dejagnu-1.4.4
$ ./configure --prefix=/tools
$ make install
Now, I did not run the 2 patches. And, I logged out and back in without
taking the environment variables.
$ mv gcc-3.4.3 gcccore
Because we only had the core. We need g++ as well.
$ ln -s gcc /tools/bin/cc
$ wget http://strawberry.resnet.mtu.edu/pub/gcc/gcc/releases/gcc-3.4.3/gcc-3.4.3.tar.gz
$ tar -xzf gcc-3.4.3.tar.gz
$ rm -rf gcc-build
$ cd gcc-build
$ mkdir gcc-build
$ cd gcc-build
$ ../gcc-3.4.3/configure --prefix=/tools \
--libexecdir=/tools/lib --with-local-prefix=/tools \
--enable-clocale=gnu --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-languages=c,c++ --disable-libstdcxx-pch
If can only get "c" to work and not "c++", download the full gcc.
You're using the core in the previous gcc install, which does not
include c++.
$ make
$ make -k check
$ ../gcc-3.4.3/contrib/test_summary|grep -A7 Summ
$ make install
$ mkdir binutils-build
$ cd binutils-build
$ ../binutils-2.16/configure --prefix=/tools \
--enable-shared --with-lib-path=/tools/lib
$ make install
$ make -C ld clean
$ make -C ld LIB_PATH=/usr/lib:/lib
14. Gawk
$ wget ftp://ftp.gnu.org/gnu/gawk/gawk-3.1.4.tar.gz
$ tar -xzf gawk-3.1.4.tar.gz
$ cd gawk-3.1.4
$ ./configure --prefix=/tools
$ make
$ make install
15. Coreutils
$ wget http://freshmeat.net/redir/coreutils/33669/url_tgz/coreutils-5.2.1.tar.gz
$ tar -xzf coreutils-5.2.1.tar.gz
$ cd coreutils-5.2.1
$ DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/tools
$ make
$ make RUN_EXPENSIVE_TESTS=yes check
$ make install
16. Bzip2
$ cd
$ wget http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz
$ tar -xzf bzip2-1.0.3.tar.gz
$ cd bzip2-1.0.3
$ make
$ make PREFIX=/tools install
17. Gzip
$ cd
$ wget ftp://alpha.gnu.org/gnu/gzip/gzip-1.3.5.tar.gz
$ tar -xzf gzip-1.3.5.tar.gz
$ cd gzip-1.3.5
$ ./configure --prefix=/tools
$ make
$ make install
18. Diffutils
$ cd
$ wget http://freshmeat.net/redir/diffutils/1891/url_tgz/diffutils-2.8.1.tar.gz
$ tar -xzf diffutils-2.8.1.tar.gz
$ cd diffutils-2.8.1
$ ./configure --prefix=/tools
$ make
$ make install
19. Findutils
$ wget http://freshmeat.net/redir/findutils/15023/url_tgz/findutils-4.2.20.tar.gz
$ tar -xzf findutils-4.2.20.tar.gz
$ cd findutils-4.2.20
$ ./configure --prefix=/tools
$ make
$ make install
20. Make
$ cd
$ wget ftp://ftp.gnu.org/gnu/make/make-3.80.tar.gz
$ tar -xzf make-3.80.tar.gz
$ cd make-3.80
$ make
$ make install
21. Grep
$ cd
$ wget ftp://ftp.gnu.org/gnu/grep/grep-2.5.tar.gz
$ tar -xzf grep-2.5.tar.gz
$ cd grep-2.5
$ ./configure --prefix=/tools \
--disable-perl-regexp --with-included-regex
$ make
$ make install
22. Sed
$ cd
$ wget http://freshmeat.net/redir/sed/9392/url_tgz/sed-4.1.4.tar.gz
$ tar -xzf sed-4.1.4.tar.gz
$ cd sed-4.1.4
$ ./configure --prefix=/tools
$ make
$ make install
23. Gettext
$ cd
$ wget http://ftp.gnu.org/gnu/gettext/gettext-0.14.5.tar.gz
$ tar -xzf gettext-0.14.5.tar.gz
$ cd gettext-0.14.5
$ ./configure --prefix=/tools --disable-libasprintf \
--disable-csharp
$ make
$ make install
24. Ncurses
$ cd
$ wget http://freshmeat.net/redir/ncurses/6995/url_tgz/ncurses-5.4.tar.gz
$ tar -xzf ncurses-5.4.tar.gz
$ cd ncurses-5.4
$ ./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite
$ make
$ make install
25. Patch
$ cd
$ wget ftp://ftp.gnu.org/pub/gnu/patch/patch-2.5.4.tar.gz
$ tar -xzf patch-2.5.4.tar.gz
$ cd patch-2.5.4
$ CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools
$ make
$ make install
26. Tar
$ cd
$ wget http://freshmeat.net/redir/tar/17853/url_tgz/tar-1.15.1.tar.gz
$ tar -xzf tar-1.15.1.tar.gz
$ cd tar-1.15.1
$ ./configure --prefix=/tools
$ make
$ make install
27. Texinfo
$ cd
$ wget http://freshmeat.net/redir/texinfo/10367/url_tgz/texinfo-4.8.tar.gz
$ tar -xzf texinfo-4.8.tar.gz
$ cd texinfo-4.8
$ ./configure --prefix=/tools
$ make
$ make install
28. Bash
$ cd
$ wget ftp://ftp.cwru.edu/pub/bash/bash-3.0.tar.gz
$ tar -xzf bash-3.0.tar.gz
$ cd bash-3.0
$ make
$ make install
$ ln -s bash /tools/bin/sh
29. M4
$ cd
$ wget http://ftp.gnu.org/gnu/m4/m4-1.4.3.tar.gz
$ tar -xzf m4-1.4.3.tar.gz
$ cd m4-1.4.3
$ ./configure --prefix=/tools
$ make
$ make install
30. Bison
$ cd
$ wget ftp://ftp.linuxfromscratch.org/pub/lfs/lfs-packages/conglomeration/bison/bison-
2.0.tar.bz2
$ tar -xjf bison-2.0.tar.bz2
$ cd bison-2.0
$ ./configure --prefix=/tools
$ make
$ make install
31. Flex
$ cd
$ wget http://easynews.dl.sourceforge.net/sourceforge/lex/flex-2.5.31.tar.gz
$ tar -xzf flex-2.5.31.tar.gz
$ wget http://www.linuxfromscratch.org/patches/lfs/6.0/flex-2.5.31-debian_fixes-2.patch
$ cd flex-2.5.31
$ patch -Np1 -i ../flex-2.5.31-debian_fixes-2.patch
$ touch doc/flex.1
$ ./configure --prefix=/tools
$ make
$ make install
32. Util-linux
$ cd
$ wget http://freshmeat.net/redir/util-linux/11029/url_tgz/util-linux-2.12i.tar.gz
$ tar -xzf util-linux-2.12i.tar.gz
$ cd util-linux-2.12i
$ sed -i 's@/usr/include@/tools/include@g' configure
$ ./configure
$ make -C lib
$ make -C mount mount umount
$ make -C text-utils more
$ cp mount/{,u}mount text-utils/more /tools/bin
This package had some errors for me and will require a further look-see.
33. Perl
5.8.6 did not work. Note to self, this patch and package need to be looked at
and upgraded.
$ cd
$ wget http://www.cpan.org/src/perl-5.8.5.tar.gz
$ wget http://www.linuxfromscratch.org/patches/lfs/6.0/perl-5.8.5-libc-1.patch
$ tar -xzf perl-5.8.5.tar.gz
$ cd perl-5.8.5
$ patch -Np1 -i ../perl-5.8.5-libc-1.patch
$ ./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl POSIX'
$ make perl utilities
$ cd
$ wget ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/udev-058.tar.gz
$ tar -xzf udev-058.tar.gz
$ cd udev-058
$ sed -i 's@/sbin/udev@/tools/sbin/udev@g' udevstart.c
$ sed -i 's@/etc@/tools/etc@g' etc/udev/udev.conf.in
$ make prefix=/tools etcdir=/tools/etc
$ make DESTDIR=/tools udevdir=/dev install
$ cd
$ wget http://downloads.linuxfromscratch.org/udev-config-2.permissions
$ cp udev-config-2.permissions /tools/etc/udev/permissions.d/00-lfs.permissions
$ wget http://downloads.linuxfromscratch.org/udev-config-1.rules
$ cp udev-config-1.rules /tools/etc/udev/rules.d/00-lfs.rules
Yes, the above will generate some errors; but, ignore them.
$ rm -rf /tools/{doc,info,man}
CHAPTER 2
$ mkdir -p /distro/{proc,sys}
$ mkdir -p /distro/dev
Binutils __
\
\___ GCC ___
\
\__ Glibc
Step 1:
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.tar.gz.sig
Check signature
Special note.
--disable-nls
Disables internationalization.
configure-host
This causes subdirectories to be configured
LDFLAGS="-all-static"
This makes everything static
bin
addr2line
ar
Creates, modifies, and extracs from archives. Think libraries.
Take a look at http://cpearls.sourceforge.net/index.php and click
on "Compile".
as
A family of assemblers, which brings together the output of "gcc".
You pass arguments to this using the -Wa flag. Take a look at the man
page. This is an example.
c++filt
gprof
Calculates the amount of time spent in each routine.
ld
nm
objcopy
objdump
ranlib
readelf
size
strings
strip
Installation of GCC
$ wget http://strawberry.resnet.mtu.edu/pub/gcc/gcc/releases/gcc-4.0.0/gcc-core-4.0.0.tar.gz
Note the following requirements for compiling. I got these from the following link.
"http://lfs.osuosl.org/lfs/view/6.0/chapter05/gcc-pass1.html"
$ ./configure --prefix=/tools \
--libexecdir=/tools/lib --with-local-prefix=/tools \
--disable-nls --enable-shared --enable-languages=c
--with-local-prefix=/tools
Removes /usr/local/include from "gcc's" include search path.
--enable-shared
Correct, you would think at this stage "static" is prefered, and
that is the case; however, this flag does not determine static. Instead,
BOOT_LDFLAGS variables is used for this. This switch is necessary for
the creation of "libgcc_s.so.1" and "libgcc_eh.a"
--enable-languages=c
Needed if you're compiling more than just the core. This only enables the
core to be compiled.
Installation of linux-libc-headers
Create a Live Linux CD - BusyBox and OpenSSH Included: These steps will show you how to create a
functioning Linux system, with the latest 2.6 kernel compiled from source, and how to integrate the BusyBox
utilities including the installation of DHCP. Plus, how to compile in the OpenSSH package on this CD based
system. On system boot-up a filesystem will be created and the contents from the CD will be uncompressed
and completely loaded into RAM -- the CD could be removed at this point for boot-up on a second computer.
The remaining functioning system will have full ssh capabilities. You can take over any PC assuming, of
course, you have configured the kernel with the appropriate drivers and the PC can boot from a CD. This
tutorial steps you through the whole processes.
SQLite Tutorial : This article explores the power and simplicity of sqlite3, first by starting with common
commands and triggers, then the attach statement with the union operation is introduced in a way that allows
multiple tables, in separate databases, to be combined as one virtual table, without the overhead of copying or
moving data. Next, the simple sign function and the amazingly powerful trick of using this function in SQL
select statements to solve complex queries with a single pass through the data is demonstrated, after making a
brief mathematical case for how the sign function defines the absolute value and IF conditions.
The Lemon Parser Tutorial: This article explains how to build grammars and programs using the lemon
parser, which is faster than yacc. And, unlike yacc, it is thread safe.
How to Compile the 2.6 kernel for Red Hat 9 and 8.0 and get Fedora Updates: This is a step by step tutorial
on how to compile the 2.6 kernel from source.
Linux System Admin Tips: There are over 160 linux tips and tricks in this article. This article is updated
weekly.
Virtual Filesystem: Building A Linux Filesystem From An Ordinary File. You can take a disk file, format it as
ext2, ext3, or reiser filesystem and then mount it, just like a physical drive. Yes, it then possible to read and
write files to this newly mounted device. You can also copy the complete filesystem, sinc\ e it is just a file, to
another computer. If security is an issue, read on. This article will show you how to encrypt the filesystem,
and mount it with ACL (Access Control Lists), which give you rights beyond the traditional read (r) write (w)
and execute (x) for the 3 user groups file, owner and other.
Working With Time: What? There are 61 seconds in a minute? We can go back in time? We still tell time by
the sun?
Mike Chirico, a father of triplets (all girls) lives outside of Philadelphia, PA,
USA. He has worked with Linux since 1996, has a Masters in Computer Science and Mathematics from
Villanova University, and has worked in computer-related jobs from Wall Street to the University of
Pennsylvania. His hero is Paul Erdos, a brilliant number theorist who was known for his open collaboration
with others.
Mike's notes page is souptonuts. For open source consulting needs, please send an email to
[email protected]. All consulting work must include a donation to SourceForge.net.