Linux Fom Scratch (LFS) is a project that details the process of building a small Linux system. While fully functional, it is intended mostly as a learning exercise.
I've been meaning to run through the build process for a long time now and recently had the opportunity to do so following the 7.1 version of the LFS manual released in March 2012.
Note: This is completely out of date now. At some point I hope to update it with a current build log.
Here are some of my notes:
Creating env and getting source packages
My initial build system was a minimal install of Debian Squeeze on a VirtualBox VM.
I created a new 8GB partition for LFS
256MB /boot (ext2)
512MB swap
remainder / (ext3)
Mounted under /mnt/lfs
Downloaded files using wget-list
wget -i wget-list -nc -P /mnt/lfs/sources
the 'nc' switch was helpful since I had a VM crash in the middle of the download.
A couple broken links in wget-list and the man pages' md5 wasn't correct:
Updated link for man pages: http://www.kernel.org/pub/linux/docs/man-pages/Archive/
Updated link for zlib: http://prdownloads.sourceforge.net/libpng/zlib-1.2.7.tar.bz2
Create minimal build system
- Typical unzip command in the sources dir: tar -jxf binutils-2.22.tar.bz2
- Problems getting time to work with binutils (rough estimate 1 SBU = 5 Min)
- When compiling gcc, no mention of applying downloaded mpfr fixes-1 patch -- I applied it.
- If you're confused about this 'cross-compiler' thing, Wikipedia has a breakdown here: Cross Compiler
- A couple extra patches for glibc not mentioned in dos (fixes-1 and sort-1) -- applied all patches
- Hmm. Not liking the extra patches. On gcc second pass I applied the startfiles_fix-1 patch but skipped the mpfr fixes-1 patch since it's not mentioned.
- Second pass on gcc fails with crti.o missing. Looks like glibc didn't compile correctly -- going back
- Looking at config warnings on glibc looks like I don't have autoconf installed -- re-running after install
- Crap. Now I'm stuck in a loop compiling glibc. Probably need to go back to the beginning an re-compile again.
Create minimal build system (second try)
- wiped /tools
- time on binutils make is 5min 30sec
- gcc applied only patches mentioned in text
- glibc only applied gcc_fix-1 and cpuid-1 patches
- glibc and toolchain check seem fine
- binutils second pass ok
- gcc second pass ok -- trying to hand-type commands led to errors
- completed remain tools -- all compile fine
- changed permissions and removed debug symbols; left docs
Build LFS system
- TODO