Welcome to BYO Linux Portal  
Home · Contact · Discussion · Links · Sponsors 
 
 


 
 
BYO Linux



 
 


 
 
Compiling Stuff
Text VersionPrinter Friendly Version

Make sure you are in your normal, linux1 system and linux2 is mounted. All these files will be made here and copied to the new system.

This is going to be a long chapter. There are so many different distributions out there with so many different libraries and so many different compilers, it's taken me alot of tinkering in order to come up with something that everybody should be able to use.

Two of the packages needed, m4 and sed, will not currently compile statically. When you get to these packages, just click the links and download them from me already prebuilt. Alot of code needed to be re-written in order for them to compile statically so just get them from me. They will compile dynamically later just fine. Hopefully, there authors will re-write these packages in the future. If you're downloading these in MS Windows, make sure they are saved or renamed in all lowercase letters if necessary.

We talked a bit about static vs. dynamic compiling in 'Getting started', let's just hit the fine points for those that don't understand the difference. Linux (as well as windows) can make use of what's called dynamic libraries. These are also known as shared libraries. In linux, they are usually located in the /lib directory. In windows, these are the .dll files in the system directory. Without dynamic libraries, the library would have to be compiled into the program itself. This can be done (and we will at first), but, the disadvantages are the program is bigger and takes up more memory. Alot of programs require the exact same library, so, why load that library more than one time? Get the point? It would be a waste of resources. Now, since we don't have a library on our new system to start with, we have to make these programs statically just to get the computer to boot. We already did this twice in 'SysVinit' and 'Bash'.

Once we are all done installing these 17 packages, we will install the libraries and compiler, THEN recompile the packages dynamically. This will also put the man files (help files), etc.. in there correct folders. Basically, I'm going to present the proper way to compile these packages statically now.

If your not sure if you compiled your binary correctly, go to the directory of its location and type ldd filename and it will tell you if it's static or requires libraries.

Also, if your wondering, these 17 'required' packages are the packages that will allow you to install other packages as a free standing system.

You'll notice that many of the packages have the configure option --disable-nls because my system does not have NLS (National Language Support) installed. If you speak english and do not need any other language support, this may be appropriate for you. My suggestion is to try all these packages first without using that option and see if they compile. If they don't compile, add that option in and try again.

You need to create a directory to store all the files you've downloaded as well as unpacked on your existing system. I created a directory in /root called /origanals for lack of a better name. I suggest you do the exact same thing because we'll need to make static links to this directory for the compiler installation. Trust me, just make a directory called /root/origanals and save all your downloads there. We'll just take these in alphabetical order. 'Required packages' has the location of where I downloaded all these files.

Compiling Stuff: AUTOMAKE

-This package generates the 'Makefile.in' file for use with autoconf
-Unpack the automake zip/tar file
-Go into the directory and configure it by typing ./configure
-Copy aclocal and automake to /mnt/linux2/usr/bin
-Copy: acinstall, config.guess, config.sub, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs, and ylwrap to /mnt/linux2/usr/share/automake
-Copy all *.am files to /mnt/linux2/usr/share/automake
-Go into the /m4 directory and copy all *.m4 files to /mnt/linux2/usr/share/aclocal

Compiling Stuff: AUTOCONF

-This package produces shell scripts which automatically configure the source code in packages you install
-Unpack the autoconf zip/tar file
-Go into the directory and configure it by typing ./configure
-Compile it by running make
-Copy: autoconf, autoheader, autoreconf, autoscan, autoupdate, and ifnames to /mnt/linux2/usr/bin
-Copy all *.m4 and *.m4f files to /mnt/linux2/usr/share/autoconf by typing cp *.m4* /mnt/linux2/usr/share/autoconf
-Copy: acconfig.h, acfunctions, acheaders, acidentifiers, acmakevars, and acprograms to /mnt/linux2/usr/share/autoconf

Compiling Stuff: BINUTILS

-Unpack the binutils zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls
-Compile it by running make LDFLAGS=-all-static
-Go into the /gas directory and copy as-new and gasp-new to /mnt/linux2/usr/bin
-Rename the files in /mnt/linux2/usr/bin to as and gasp (remove the -new)
-Next go into the /ld directory and copy ld-new to /mnt/linux2/usr/bin
-Rename the file in /mnt/linux2/usr/bin to ld (remove the -new)
-Next go into the packages /binutils directory and copy: addr2line, ar, nm-new, objcopy, objdump, ranlib, size, strings, and strip-new to the /mnt/linux2/usr/bin directory.
-Rename the files in /mnt/linux2/usr/bin to nm and strip (remove the -new)

Compiling Stuff: FILEUTILS

-Basic files used in the OS for copying, making directories, etc..
-Unpack the fileutils zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls
-Compile it by running make LDFLAGS=-static
-Copy from the /src directory: chgrp, chmod, chown, cp, dd, df, dir, dircolors, du, ln, ls, mkdir, mkfifo, mknod, mv, rm, rmdir, sync, touch, vdir to /mnt/linux2/usr/bin
-Copy ginstall to /mnt/linux2/usr/bin and rename to install

Compiling Stuff: FINDUTILS

-This package helps you find the location of files on the system
-Unpack the findutils zip/tar file
-Go into the directory and configure it by typing ./configure
-Compile it by running make LDFLAGS=-all-static
-Copy from the /find directory the find file to /mnt/linux2/usr/bin
-Copy from the /xargs directory the xargs file to /mnt/linux2/usr/bin

Compiling Stuff: GREP

-Unpack the grep zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls --without-included-regex
-Compile it by running make LDFLAGS=-static
-Copy from the /src directory: egrep, fgrep, and grep to /mnt/linux2/usr/bin

Compiling Stuff: GZIP

-Unpack the gzip zip/tar file
-Go into the directory and configure it by typing ./configure
-Compile it by running make LDFLAGS=-static
-Copy the gzip file to /mnt/linux2/bin

Compiling Stuff: LD.SO

-Unpack the ld.so zip/tar file
-Go into the /util directory
-Compile ldd by running make ldd
-Compile ldconfig by running make ldconfig
-Copy ldd to /mnt/linux2/usr/bin
-Copy ldconfig to /mnt/linux2/sbin

Compiling Stuff: M4

-Had trouble compiling, download this file (if you haven't already) to /mnt/linux2/usr/bin
-Run the command: chmod 755 /mnt/linux2/usr/bin/m4

Compiling Stuff: MAKE

-This package determines which pieces of a program need to be re-compiled and issues commands to re-compile them
-Unpack the make zip/tar file
-Go into the directory and configure it by typing ./configure
-Compile it by running make LDFLAGS=-static
-Copy make to /mnt/linux2/usr/bin

Compiling Stuff: MAWK

-Unpack the mawk zip/tar file
-Go into the directory and configure it by typing ./configure
-Compile it by running make CFLAGS="-O -static"
-Note that -O is not a zero
-Copy mawk to /mnt/linux2/usr/bin

Compiling Stuff: SED

-This package is what is known as a stream oriented text editor
-Had trouble compiling, download the sed file (if you haven't already) to /mnt/linux2/usr/bin
-
Run the command: chmod 755 /mnt/linux2/usr/bin/sed

Compiling Stuff: SH-UTILS

-This package contains shell programming utilities
-Unpack the sh-utils zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls
-Compile it by running make LDFLAGS=-static
-Copy from the /src directory: basename, date, dirname, echo, env, expr, factor, false, groups, id, logname, nice, nohup, pathchk, printenv, printf, pwd, seq, sleep, stty, su, tee, test, true, tty, uname, uptime, users, who, whoami, and yes to /mnt/linux2/usr/bin
-Copy from the /src directory the chroot file to /mnt/linux2/sbin

Compiling Stuff: TAR

-Unpack the tar zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls
-Compile it by running make LDFLAGS=-static
-Copy from the /src directory the tar file to /mnt/linux2/usr/bin

Compiling Stuff: TEXINFO

-This package generates some printed manuals
-Unpack the texinfo zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls
-Compile it by running make LDFLAGS=-static
-Copy from the /makeinfo directory the makeinfo file to /mnt/linux2/usr/bin

Compiling Stuff: TEXTUTILS

-Unpack the textutils zip/tar file
-Go into the directory and configure it by typing ./configure --disable-nls
-Compile it by running make LDFLAGS=-static
-Copy from the /src directory the cat file to /mnt/linux2/bin
-Copy from the /src directory: cksum, comm, csplit, cut, expand, fmt, fold, head, join, md5sum, nl, od, paste, pr, sort, split, sum, tac, tail, tr, unexpand, uniq, and wc to /mnt/linux2/usr/bin

Compiling Stuff: UTIL-LINUX

-Unpack the util-linux zip/tar file
-Go into the directory and configure it by typing ./configure
-Go into the packages /lib directory here and type make
-Go into the packages /mount directory and compile it by running make LDFLAGS=-static
-Copy from the /mount directory: losetup, mount, swapon, and umount to /mnt/linux2/sbin
-Go into the packages /login-utils directory and compile it by running make LDFLAGS=-static
-Copy from the /login-utils directory the agetty file to /mnt/linux2/sbin

Compiling Stuff: Making a Backup

Ok, let's save all your hard work to this point. On your linux1 system goto /mnt/linux2. Type the following:
tar cvf backup1.tar *

This will make a backup of the contents of the /mnt/linux2 directory called backup1.tar
You should also compress this file with gzip because it's huge by typing:
gzip backup1.tar

Move this file off of linux2 afterwards to where you keep your downloaded files on linux1.