john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Linux from scratch install

FOR Make your own linux:

The Util-linux package contains miscellaneous utility programs.

Among them are utilities for handling file systems, consoles, partitions, and messages.

Approximate build time: 0.2 SBU

Required disk space: 11.6 MB

Installation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, Sed, and Zlib

 mkdir bin boot dev etc home lib mnt root sbin tmp usr var
        cd var; mkdir lock log run spool  
        cd ../usr; mkdir bin include lib local sbin share src
        cd share/; mkdir man; cd man 
        mkdir man1 man2 man3 ... man9

         cd ..; ln -s share/man man

We will put the source code in the target /usr/src directory. So for example, if your target file system is mounted on /mnt/target and your tarballs are in /root, you would do

        cd /mnt/target/usr/src
        tar -xzvf /root/MAKEDEV-2.5.tar.gz

we want to install it as though /mnt/target is the root filesystem. Different packages have different ways of letting you do this. For MAKEDEV you do

        ROOT=/mnt/target make install

You need to look out for these options in the README and INSTALL files or by doing a ./configure --help.

Have a look in MAKEDEV's Makefile to see what it does with the ROOT varible that we set in that command. Then have a look in the man page by doing man ./MAKEDEV.man to see how it works. You'll find that the way to make our device files is to cd /mnt/target/dev and do ./MAKEDEV generic.

Do an ls to see all the wonderful device files it has made for you.

Next we make a kernel. I presume you've done this before, so I'll be brief. It is easier to install lilo if the kernel it is meant to boot is already there. Go back to the target usr/src directory, and unpack the linux kernel source there.

Enter the linux source tree (cd linux) and configure the kernel using your favourite method, for example make menuconfig. You can make life slightly easier for yourself by configuring a kernel without modules. If you configure any modules, then you will have to edit the Makefile, find INSTALL_MOD_PATH and set it to /mnt/target.

Now you can make dep, make bzImage, and if you configured modules: make modules, make modules_install.

Copy the kernel arch/i386/boot/bzImage and the system map System.map to the target boot directory /mnt/target/boot, and we are ready to install lilo.

Your host system should have the following software with the minimum versions indicated. This should not be an issue for most modern Linux distributions. Also note that many distributions will place software headers into separate packages, often in the form of "-devel" or "-dev". Be sure to install those if your distribution provides them.

Bash-2.05a

Binutils-2.12 (Versions greater than 2.16.1 are not recommended as they have not been tested)

Bzip2-1.0.2

Coreutils-5.0 (or Sh-Utils-2.0, Textutils-2.0, and Fileutils-4.1)

Diffutils-2.8

Findutils-4.1.20

Gawk-3.0

Gcc-2.95.3 (Versions greater than 4.0.3 are not recommended as they have not been tested)

Glibc-2.2.5 (Versions greater than 2.3.6 are not recommended as they have not been tested)

Grep-2.5

Gzip-1.2.4

Linux Kernel-2.6.x (having been compiled with GCC-3.0 or greater)

The reason for the kernel version requirement is that thread-local storage support in Binutils will not be built and the Native POSIX Threading Library (NPTL) test suite will segfault if the host's kernel isn't at least a 2.6.x version compiled with a 3.0 or later release of GCC.

If the host kernel is either earlier than 2.6.x, or it was not compiled using a GCC-3.0 (or later) compiler, you will have to replace the kernel with one adhering to the specifications. There are two methods you can take to solve this. First, see if your Linux vendor provides a 2.6 kernel package. If so, you may wish to install it. If your vendor doesn't offer a 2.6 kernel package, or you would prefer not to install it, then you can compile a 2.6 kernel yourself. Instructions for compiling the kernel and configuring the boot loader (assuming the host uses GRUB) are located in Chapter 8.

Make-3.79.1

Patch-2.5.4

Sed-3.0.2

Tar-1.14

To see whether your host system has all the appropriate versions, run the following:

cat > version-check.sh << "EOF"

#!/bin/bash

# Simple script to list version numbers of critical development tools

bash --version | head -n1 | cut -d" " -f2-4
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-4
bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
diff --version | head -n1
find --version | head -n1
gawk --version | head -n1
gcc --version | head -n1
/lib/libc.so.6 | head -n1 | cut -d" " -f1-7
grep --version | head -n1
gzip --version | head -n1
cat /proc/version | head -n1 | cut -d" " -f1-3,5-7
make --version | head -n1
patch --version | head -n1
sed --version | head -n1
tar --version | head -n1

EOF

bash version-check.sh


  • « Linux story win98 laptop knoppix 2 parted july 2007
  • Linux backtrack internet configuration »

Published

Feb 27, 2010

Category

linux

~790 words

Tags

  • from scratch 1
  • installs 41
  • linux 249