Why would I want to put LFS on my Pi?

While the average user might be better off running a comfortable distribution such as Raspbian, there are a few scenarios where LFS might benefit you:

  • You're already running LFS on your desktop and want to try it on your Pi.
  • You're working on a cool hardware project and want to build a bare essentials system, where you have complete control over every piece of software.
  • You need to try out some code on a "neutral" platform, free of distribution specific patches and quirks.
  • You're a curious individual (with a lot of spare time) who would like to learn how a working GNU/Linux distribution is put together.

Where do I send my comments or ask for help?

Please contact me at lfs4pi@gmail.com or find me as Mogwai on Freenode in #raspberrypi-dev and #raspbian.

Any comments or ideas on how to improve the site or build instructions are greatly appreciated. Also note that building LFS on the Pi is not officially supported by the Linux From Scratch project, so don't demand any help from them.

What are the Pi specific parts during the LFS build?

In "4.4. Setting Up the Environment" the LFS_TGT variable needs to be set to:

LFS_TGT=$(uname -m)-lfs-linux-gnueabihf

GCC needs to be patched for RPi 1, RPi 2 or RPi 3 to take advantage of the floating point hardware by default.

GCC also needs the file gcc/config/arm/linux-eabi.h to have the dynamic linker locations changed in both passes of chapter 5:

for file in gcc/config/arm/linux-eabi.h do ...

GLIBC names the dynamic linker ld-linux-armhf so we make a compatibility symlink for software that expect ld-linux.so.3:

ln -sv ld-2.25.so /lib/ld-linux.so.3

The Raspberry Pi Foundation's kernel is downloaded and optionally compiled instead of the vanilla Linux kernel.

We use the bootloader from the Foundation's firmware repo instead of GRUB.