This course will become read-only in the near future. Tell us at if that is a problem.

Build your book

Make your own CLFS e-book, with source right from the publisher!

This task can be skipped. You can download the copy of the book I built here instead:

And in fact, even if you do build your own book, I'd still recommend having a copy of the above book for reference.

If any of these steps feel overwhelming, please skip back to the task where we build git. You'll find step by step build instructions there. Please also refer to the troubleshooting task if anything goes wrong.

Otherwise, the only thing you need to have pre-installed and working on your system is Java. You will also need this script:

The CLFS and CBLFS teams are always working hard on improvements, and the advantage to building the book for yourself is that you'll always have the most up-to-date possible information. Being on the cutting edge with most linux distributions is a double-edged sword, where you sacrifice stability in exchange for a more secure operating system with the latest bug fixes. However, since you'll be building this from scratch yourself and will be intimately familiar with the inner workings of your system, you are going to encounter a lot of instability anyway. Which is why I walked you through two tools that will help you manage that instability with ease, package management and version control..

With that in mind, if you haven't been following the previous tasks, I'd like to recommend you have some sort of version control and package management system in mind before continuing.

Another note: There is a very old saying on LFS mailing lists: FTBTBIG. That stands for "follow the book; the book is good". It's usually best with projects like this to do things the way they're layed out at least once. If you do it a couple more times, you'll understand it well, and once you understand it well, you'll be in a position to gain something with experimentation and customization.

Alright, enough chit-chat. If you're still reading this, then you'll want to know how to build your book. These instructions have two parts: building fop, and building the book itself.


Building FOP

If you are on a rare lucky system that has this utility, please continue on down to "Building the book".

Windows users: you'll want to do this in a MinGW shell, not a cygwin shell.

Fop is (as far as I can tell, please let me know if I'm wrong) a no longer supported package that turns XML and an XSL stylesheet into a PDF document. The CLFS book uses this tool. It is also part of the XPontus package. You can read more acout XPontus on its CBLFS page,

  1. Download XPontus from here:
  2. Run XPontus with the following command:

    $ sh

    Note: You may have noticed a change in format right there. Any time I am using a monospace font separated out like that, I'm still giving you code to put into a terminal. If I start the line with a dollar sign, it means you should be an ordinary user, and if I start with a hash mark, it means you should be the administrator (usually called "root"; I'll use "root" instead of "administrator" from here on out). You'll only want to copy everything after the dollar sign or hash mark.
  3. In the wizard, install to any directory you like. I prefer /tmp/xpontus. We are not permanently installing this software; we are just borrowing the java .jar files it relies on.
  4. Make a directory at /usr/lib/classpath:

    # mkdir -pv /usr/lib/classpath

    You'll notice I used the "v" flag. The CLFS book uses that flag, which is short for "verbose", a lot. Normally when a shell command executes correctly the output is... nothing at all. Asking for output gives us a lot more information about what is going on, and is an especially good habit for writing installer shell scripts. The reason why the default behavior is no output, is because any output at all can interfere with other programs that use or "wrap" other shell utilities and programs. But we LFSers are taking on the role of that "other software" and our human eyes will be the only ones seeing that output. Since CLFS uses this convention, I will too.
  5. Copy all the jars that XPontus uses to your classpath folder. You can do this as root (substitute out the directory you installed XPontus to) with

    # XPONTUSDIR=/tmp/xpontus
    # cp -v $XPONTUSDIR/lib/*.jar /usr/lib/classpath

  6. Next, download the script above. Rename it to "fop", give it executable access, and add it to your path. You can do all that with this one liner (replace DOWNLOADFOLDER with your download folder)

    # DOWNLOADFOLDER=/home/sean/Downloads
    # install -v -m755 $DOWNLOADFOLDER/ /usr/bin/fop

That's it. You can test fop by simply running the command "fop". If you get useage information, it installed correctly.


Building the book

  1. Check out a fresh copy of the CLFS book from git:

    $ cd ~/clfs/book
    git clone git://
    $ cd cross-lfs/BOOK

  2. Make a new copy of the book. You can save time by picking your own architecture, but for now we'll build all of them to be safe:

    $ make pdf

It takes a few minutes, but when you're done, it will show up in cross-lfs/render/pdf. Just open up the book for your architecture in your favorite PDF reader.

Diskutera uppgift