[clue-tech] Linux from scratch

Michael J. Hammel mjhammel at graphics-muse.org
Fri Oct 15 10:36:44 MDT 2010


On Fri, 2010-10-15 at 09:13 -0700, mike havlicek wrote:
> Anyway, what was the proposition? So is Linux from scratch a cookbook
> project? 

The official LFS is a cookbook, yes.  There is also a cookbook for doing
a cross-compiled LFS, known as CLFS.  The goal is to bring up a system
with the basic utilities.  Variations on LFS add additional, usually
slightly more complicated, tools.   You don't have to use "make" to
create your LFS system but most of the recipes reference "make" because
the source being compiled by the recipe requires it.  So it kind of
makes sense to create a build system for LFS based on "make" (the
bitbake people would argue this point, of course :-)

Building a "distribution" requires creating an install environment
(kernel and root filesystem) that then installs packages into a chroot'd
directory tree so that when the install finishes and the installed stuff
boots every file is known to the package management system.  Well,
that's it in a nutshell but it may be a bit more than that.

Interestingly, most of the LFS stuff is easy to do now with tools like
Buildroot.  When you build from scratch you are building a compiler
toolchain (a set of tools used to build everything else for your target
hardware), a kernel, a root filesystem and then any additional
components to add to the root filesystem.  Buildroot can do all of this
though I typically do the toolchain and kernel separately and use
Buildroot just for the root filesystem.

If you do cross compiling you can first use tools like Crosstools-NG to
get the compiler toolchain and then use Buildroot to build everything
else.  This is roughly how my build system for BeagleBox works.

The reasons for learning these tools become obvious if you start working
with small embedded devices.  And don't let "embedded" scare you off.
BeagleBoard, for example, is just a small device very similar to any PC
motherboard that boots (at least by default) from an SD card formatted
with the kernel and a root filesystem that is a compressed tar file
(which Buildroot can create for you).  Not particularly complex.  But
fun to play with.
-- 
Michael J. Hammel                                    Principal Software Engineer
mjhammel at graphics-muse.org                           http://graphics-muse.org
------------------------------------------------------------------------------
Osteopornosis: A degenerate disease.



More information about the clue-tech mailing list