Nathan Coulson

Linux from Scratch

This is not one of my personal projects, but a opensource project dedicated to instructing users on how to build their own linux system by providing a bare base. This is the linux system that I use for my own systems & projects. Occassionally you may see me on their mailing list. In the past I was responsible for maintaining the bootscripts & making new releases.

As of the time of this writing, LFS is primarely designed to work on 32bit x86 processors, and recently has been updated to support 64bit as well. At this time, it does not support multilib (Allowing 32bit and 64bit programs to run on the same system.

I have been experimenting with building my own multilib lfs system. There are some changes I have made that would make it unsuitable to be put into the book as is, but as the LFS motto goes, my distro, my rules. The best way to explain it, is that I took a standard 32bit LFS build, updated it to support 64bit (I have consulted CLFS, a simular project for a few patches, but I would have to redo my system if I wanted to follow them), and then added the minimal number of packages required to allow a 32bit program to compile. Basically, these are the rules I followed for my own system.


Multilib Tweaks

5 - Binutils Pass 1 [ORIG]

LFS has moved over to a cross compiler toolchain to further distance itself from the host it has been compiled on. Unfortunately I have not been able to adapt the instructions as it currently is to build a multilib compiler. Therefore I have used a standard native build of binutils below. This was taken from LFS before the conversion.

5 - GCC Pass 1 [ORIG]

GCC is where most of the changes made to support a 64bit system reside. I have drawn from the work in LFS, CLFS, and my own experimentation. As with binutils, This is not cross compiled as it is in LFS. I was unable to use the automated GCC build to compile gmp/mpfr in the build in the proper directory (It used /tools/lib64), and I already have these two programs on my host system. This may not be the case on a non LFS linux distribution but I did not address that problem.

5 - Glibc 32bit [ORIG]

Not many modifications here, I did not install the locale's at this stage as they will be build in the 64bit glibc, and I had a coupple of workarounds to get glibc to support my library locations

5 - Glibc 64bit [ORIG]

All I modified in my 64bit build of glibc, was removing --host and --build from the arguments

5 - Adjusting [ORIG]

My toolchain is different from LFS's current toolchain, so I am using their previous adjustment method. Also a few tweaks to support my lib locations

5 - GMP

When I follow LFS as is, GMP ends up in /tools/lib64, so I compile it before gcc

5 - MPFR

When I follow LFS as is, MPFR ends up in /tools/lib64, so I compile it before gcc

5 - Binutils Pass 2 [ORIG]

This package, and GCC pass 2 are the reasons I did not build a cross compiler. When I use -B, I could not get it to compile multilib support w/o errors. The Patch I use (Found above in 5 - Binutils Pass 1) is from CLFS, that allows me to use the lib path as I have below.

5- GCC Pass 2 [ORIG]


LFS Build Scripts


I created the above LFS automatic build scripts, so I could easly test/rebuild a linux system without manually building every package. I have posted them above if anyone is interested in seeing how such a system could be built. To save space, I have removed all packages/patches from the above tarball. I am not planning on supporting this if anyone uses it (I released it for informational purposes), but feel free to ask questions if you like.

BLFS Build Scripts