Linux From Scratch, From Scratch.....
I've pretty much given up on this now in favour of debian the awkward!
For more info from the true masters see www.linuxfromscratch.org
Right, over the last 6 or so months I have built 2 LFS systems, the original one is now used on a daily basis but has got completely out of hand. I don't know whats installed and what isn't and I've lost ALL the bloody sources to use as a reference. To that end I shall start again from, err, scratch!!!
I shall be using the LFS live cd as a base for the build (the only OS I've ever had any luck building with). A 40GiB IDE Toshiba lap top HD connected to an ITE8212 IDE Raid card. The disk will have 2 partitions (once its finidhed it'l be moved onto the main system hard drive using similar sized partitions), a 35GiB EXT3 and a 5GiB swap. The ITE8212 is slotted into an ASUS P5GD1 MoBo with 2.5GiB o RAM and a P4 3.6Ghz brain!!! The resulting system will be an Xwindows Server (SSH, Local Apache, FTP, Samba) / Desktop system using a modular X install and 2 versions of enlightenment window manager DR16 for root work and DR17 for normal use.
What I wont be doing is going into loads of detail, the book already covers that, I will however, give you a rundown of what I have done along with any tweaks I have applied to my functioning system that could have been aplied at construction...
Thats enough of that, lets go....
Logged in as root on the host system i do the following basic steps to get ready. First, mke2fs -j /dev/hde1, then mkswap /dev/hde2. Thats the hard drive ready, now I copy the lfs-sources folder from the cd to the installation drive. Thats the harddisk ready.
Linux From Scratch....
Now you must follow the LFS book step by step to build the main LFS system. Again, there is no need for me to detail that as it is already covered in the LFS book. Once thing i will point out is that my second LFS build got out of hand because i did not keep the original sources. This time around i will, at least then i know what version are what without having to trawl through man pages sussing out version commands and how to find versions. I have also applied a layout to the directory structure inside my lfs-sources directory:
Base:
Contains the LFS source packages.
Libs:
Contains BLFS librarys and such.
Apps:
Contains BLFS and other applications.
Xorg:
Contains the Xorg sources.
System-Tools:
Contains system tools.
Daemon:
Contains system servers and services.
This whole directory structure comes up at about 4.1GiB for my completed system (and i havent really added many apps to the standard X setup yet!). I keep it all on a little USB2.0 CF card hard drive now. All compilation and such is done on that gadget. Always try to get the latest version installed even if it means having to re-install other packages.
So, we have the ability to at least track whats installed and at what version!!!
Optimisations....
During the initial build i did not, nor would i advise, trying to optimise the compiler. The LFS book has instructions for stripping and you should follow those. However, once the initial LFS system is up and running i did a bit of house keeping and set the following environment variables in /etc/profile
export CC="gcc -s"
export LDFLAGS="-s"
export BUILDOPTS="--disable-nls --prefix=/usr"
REMEMBER: These variables wont apply to X terminals!
Packages....
Below is a list of packages installed, they are not in dependancy order so if you get a problem with one package requring another just install as per dependancy requirements. This package list starts AFTER LFS has been fully installed.
Libs: | ||
Package: | Installed: | Notes: |
libxml | * | |
libxml2 | * | |
glib1 | * | |
glib2 | * | |
expat | * | |
libusb | * | |
freetype | * | |
fontconfig | * | |
giflib | * | |
jpeg | * | |
libexif | * | |
tiff | * | |
libpng | * | |
gmime | * | |
alsa-libs | * | |
openssl | * | |
libast | * | |
libxslt | * | |
libstartup-notification | * | |
libgamin | * | |
System Tools: | ||
Package: | Installed: | Notes: |
gpm | ||
pkgconfig | * | |
alsa-utils | * | |
dialog | * | |
ethtool | * | |
fcron | * | |
net-tools | * | |
nmap | * | |
pciutils | * | |
sudo | * | |
usbutils | * | |
which | * | |
hdparm | * | |
desktop-file-utils | * | |
wireless-tools | * | |
Apps: | ||
Package: | Installed: | Notes: |
wget | * | |
emacs | * | Should be rebuilt after X is installed |
ImageMagick | * | |
ImageMagick Perl (CPAN) | * | |
samba-client (mount.cifs) | * | |
tracert | * | |
unzip | * | |
zip | * | |
cpio | * | |
mc | * | |
lynx | * | |
pine | * | |
vsftpd | ! | I could not get current version to build so opted for an older one! |
openssh-clients | * | |
openssh-server | * | |
tcp-wrapper | * | |
mysql-clients | * | |
cvs | * | |
pcmanfm | * | |
mplayer | * | Although i installed this app i removed it later, its shite! |
This gives a pretty usefull CLI version of linux that is relatively small but still has substantial functionality! Because however we have a greater plan in mind there are several packages without the Xwindows system so....Now we move onto X | ||
Xorg | ||
I used the BLFS wget lists and modifyed them to my requirements then wrote a perl script to automagically build the xorg system a section at a time. Building manually can be a very laborious task! | ||
Package: | Installed: | Notes: |
proto | * | |
utils | * | |
libs | * | |
bitmaps | * | |
apps | * | |
data | * | |
luti | * | |
Mesa | * | |
xorg | * | |
drivers | * | |
xterm | * | |
Eterm | * | |
GTK2 | * | Requires cario, pango and atk built against the same version of glib-2 |
E17 | ||
This....Can be a trick to get right!!! E17 is development software meaning its buggy, or at least can be, you could welll spend a day installing it only to have it segfault everytime you try to run it! It is best to do this manually in the order i have specified here. That way if there are any missing deps in your LFS system your can add them in (not that there should be if you have added all the packages mentioned above). As with building the system its self you should build all libs first. | ||
Package: | Installed: | Notes: |
edb | * | |
eet | * | |
evas | * | |
ecore | * | |
efreet | * | |
epeg | * | |
embryo | * | |
edje | * | |
epsilon | * | |
esmart | * | |
emotion | * | |
engrave | * | |
etk | * | |
etk_extra | * | |
ewl | * | |
exml | * | |
enhance | * | |
e_dbus | * | |
E17 Apps: | ||
Package: | Installed: | Notes: |
e | * | |
At this point you can test it if you want by adding enlightenment_start to ~/.xinitrc | ||
elitaire | * | |
estickies | * | |
exhibit | * | |
E17 Modules: | ||
Package: | Installed: | Notes: |
bling | * | |
cpu | * | |
efm_nav | * | |
efm_path | * | |
flame | * | |
rain | * | |
snow | * |
As you can see there is a substantial amount of work getting all that built and installed. It took about a week doing a few hours per evening but i do now have a very stable and built to spec OS that i can modularise with ease. I have a much tighter version that was built for my USB stick. That once has a substantial amount of kernel modules because i use it on many different machines!
The Brain....
Now its kernel time! It helps to install a commercial dist of linux before hand such that you can do an lsmod and record the info to a textfile, this way you can get a kernel more suited to your system compiled. If you are really lucky /proc/config.gz exsits and you can zcat /proc/config.gz > config.current and then use make oldconfig (i normally just hold my finger on the enter key and take the default answers for a make oldconfig). DONT rely on your hard disks (especially on SATA/IDE mix systems) appearing in the same order with a home cooked kernel. In FC9 my IDE drive is hde, in my current LFS its hde but in other os's and my new kernel its hda!?!?! Udev can help with that one!!