Linux From Scratch

237pages on
this wiki
Add New Page
Add New Page Talk0

Linux From Scratch is not a typical Linux distribution - rather, it is a guide on building your own from source. The guide begins with a step-by-step process of building a sane toolchain to be used for building the system packages, followed by the kernel.

As it requires building from source manually, it is not for the faint of heart, but it is a great way to learn the ins and outs of a typical Linux distribution, and seeing what makes one tick.


Here, you have a few options. If you have a system image with compilers, you can complete the entire process under coLinux, otherwise you can either compile the toolchain and OS packages on another system and bring them across, or if you don't have a fast internet connection, you can build the toolchain and bring it in - for LFS 7.2 the toolchain, when compressed using xz, weighs in at 117mb.

tar: No such file or directoryEdit

Oops - your system doesn't have tar installed. I found this with the ArchLinux image, and the best way to deal with it is to set up the symlink to the /tools directory, then put /tools/bin in front of your system path.

Putting it all together (udev requires CONFIG_DEVTMPFS=y)Edit

[Update] The udev problem is already solved by replacing kernel files(vmlinux + modules).

We should use DEVTMPFS=y because Gentoo/CentOS/Debian/Ubuntu need this option.

[root@www ~]# cat /proc/filesystems | grep tmp

nodev   tmpfs

nodev   devtmpfs!article/NewSoftware/149946


The process is largely the same - you don't even need to change the source for the linux kernel headers - but apart from the kernel compile (which is not needed since coLinux provides a kernel), there are three things you absolutely must do differently:

  1. Do not use Udev.
  2. Do not use Udev.
  3. Finally, DO NOT USE UDEV.

I cannot be clearer about this. The latest version requires devtmpfs which the coLinux kernel does not support. As such, a number of changes must be made to cope with this:

  • Change /dev to a standard tmpfs - doing otherwise will cause /dev to not mount at all, resulting in a heap of read-only filesystem errors.
  • /etc/rc.d/init.d/udev - this must be changed to not execute the udev scripts and programs as this will spout a ton of errors on boot. I recommend disabling it entirely and using this script.
  • /etc/rc.d/rcS.d/S50udev_retry needs to be disabled by renaming it to K50udev_retry - this is because it will wipe the contents of your /dev directory, causing major issues down the track.

Also on Fandom

Random Wiki