Building Linux from Scratch
Sometimes you just want to have more power than the average GNU/Linux distribution puts in your hands. Ordering the entire Debian Etch DVD collection is taking longer than I thought, so I opted to build my Linux using my own chosen collection of software. After some thorough searching, I came upon the site Linux from Scratch, which gives instructions on building your own ddistribution. There is a sort of twist, in that you need an existing,functional installation of Linux to build linux! In my case, i had Ubuntu on my laptop a Toshiba Tecra TE2300 (I have not found a single review on this laptop on the internet, not even a simple spec list! That is a topic for another article…). Miraculously, all the hardware on my laptop is detected and working. The only problem i have is, downloading build-essential package with an inconsistent network/internet connection had been frustrating: sometimes the dependent packages would install, and an attempt to compile would tell me crt1.o could not be found.Fortunately the LFS (Linux From Scratch) team provides a functional LiveCD, which you can use to begin your foray in to the wild, wild, world of Linux software compilation.
Accidents and Mistakes
The process has not been exactly smooth, as i ran into different problems along the way. These range from simply not reading the rather very simple instruction manual (know-it-all, been-there-and-done-that), to making wild assumptions and experiments. I will mention every single one of them as i go on. I must mention at this stage that I have successfully compiled the basic LFS Linux From Scratch system several times, and messed it up on different occassions by
1. typing mkfs.ext3
2. installing gnu Portable threads, (GNU Pth) and (accidentally) instructing it to overwrite the glibc pthreads.h file (eeek!)
3. running fsck on a mounted partition
4. mounting an ext3 partition in windows and running windows chkdsk on it…
and various other accidents.
Automating the build
By the time i had made 8 attempts and only 2 successful ones, I learned there was a way of automating the build, using the provided jhalfs tool. This tool saved me hours of pain and aloows me to build in 3 hours instead of 1-and-half days. The other challenge I faced was keeping track of the software i was installing, since the Linux Standard base recommends RPM as a package management system, and the LFS Linux From Scratch project attempts to be LSB compliant, i was tempted to install rpm and all of its dependencies. But then again i thought of my failed expreiments in specfile writing and the fact that i will never be able to actually install 3rd party rpms unless they were architecture independent, so i decided to stick with source instead. Finding a simple way to track sources installs was not as easy as i thought, and the methods recommnded by the LFS team were not interesting to me (the GNU Stow approach sucked the most, imho).
Package management … or tracking?
I finally came across paco at www.freashmeat.net, and it was the answer to all my problems. Paco logs the actions carried out during a “make install” by loading a library and attaching to system utilities like cp, mv, ln, and install. Now an installation mistake - most frequently specifying the wrong install prefix or mandir - can be corrected by instructing Paco to remove all files associated with a particular log. Now comes the hard part: there is no Paco patch for the jhalfs automated build (yet), so if you want to log the installed software for the basic LFS Linux From Scratchsystem - yes, you got it right - do it by hand! Frustrating, eh? Well, i have managed to compile the logs of a default (no settings modified) install of LFS Linux From Scratch. You can download it from here
Common issues
The default LFS kernel config (2.6.16.38) ships with apm support enabled. This caused me hours of pain, seeing fsck bomb each time i tried to check my disks, shutting down the pc immediately after bootup and whatnot. At first i thought it was a kernel bug and searched for patches: i even used another kernel (2.6.21) Turns out that it was a problem with apm and a broken laptop BIOS.
Running the command:
cat /proc/apm
produced the exact same results, so i had to disable apm completely in the BIOS.
The laptop has an Intel PRO/100 ethernet card but the builtin e100 driver simply will not work with it, emitting messages like
e100.mdio_ctrl(0000:01:08.0) won't go Ready
e100.mdio_ctrl(0000:01:08.0) won't go Ready
e100.mdio_ctrl(0000:01:08.0) won't go Ready
e100.mdio_ctrl(0000:01:08.0) won't go Ready
....
e100: eth0: e100_probe: addr 0xe0000000, irq 11, MAC addr XX:XX:XX:XX:XX:XX
and others like
SIOCSIFFLAGS Resource temporarily unavailable
Setting up default gateway:
RTNETLINK answers: Network is unavailable
at boot time and inside /var/log/sys.log (or /var/log/messages, in my case)
After frustrating attempts to “fix” the driver code (and a fair amount of googling), i settled with the eepro100 driver which works like a charm. Funny, isn’t it? the e100 driver works on my Ubuntu install, though. I also have an Atheros AR5001X internal wireless minipci card, for which i had to try madwifi-0.9.3, madwifi-0.9.3.1 and, utimately madwifi-ng-r2484 before i could get it working. I have also hacked together the ifup-wireless scripts from Redhat to make the wireless card get configured at bootup. You can download my scripts here, too.
I will make another post when I get GNOME running, i am still battling with cyclic dependencies right now.
Post a comment