kernel-2.4 hint

Robert Connolly robert at
Wed Feb 14 03:56:58 PST 2007

Hello. I attached a hint for building LFS with linux-2.4, in case anyone else 
wants to.

-------------- next part --------------
AUTHOR: Robert Connolly <robert at> (ashes)

DATE: 2007-02-14

LICENSE: Public Domain

SYNOPSIS: Building LFS-6.0+ with Linux-2.4.

This hint gives the info needed to build recent LFS with the 2.4 series Linux kernel.


I built my workstation with the 2.4 series kernel because I became tired of following
changes in the 2.6 series. It went fairly smoothly, and this hint contains the
modifications to the LFS and BLFS books that were needed. There may be some things that
I have overlooked, but my system with Xorg-7.1, and everything else, seems to be working
perfectly fine. If you discover something I overlooked then please email me the
difference. This hint is based on LFS-SVN-20070209, but should work with any LFS book
after 6.0.

The host system can be running any of the Linux 2.6 kernels. If the host system is
running a Linux 2.4 kernel, then I suggest running a kernel newer than 2.4.22 because
Glibc uses additional kernel features until 2.4.22. Be sure to enable
CONFIG_UNIX98_PTYS and CONFIG_DEVPTS_FS in the host kernel so /dev/pts can be mounted.

# Get the latest kernel from:

# Chapter 5 - Linux Headers
# Unpack the Linux-2.4 kernel package, and install the headers with the following
# commands:

make mrproper
make include/linux/version.h
make symlinks
mkdir /tools/include/asm
cp -v include/asm/* /tools/include/asm
cp -vR include/asm-generic /tools/include
cp -vR include/linux /tools/include

# Chapter 5 - Glibc
# Glibc's Native Posix Threading Library (NPTL) depends on Linux 2.6 series kernels.
# Since Glibc-2.4 NPTL has been the default, and Linux Threads has been depreciated.
# Linux Threads in the latest Glibc releases still works, but is no longer supported.
# Be sure to download and unpack the Glibc-linuxthreads addon package, from the same
# place you downloaded the Glibc package.
# We need to disable sanity checks in order to disable NPTL. Use these options when
# configuring Glibc:
# '--enable-kernel=2.4.22 --enable-addons=linuxthreads --disable-sanity-checks'

# Chapter 6 - Linux Headers

make mrproper
make include/linux/version.h
make symlinks
cp -HR include/asm /usr/include
cp -R include/asm-generic /usr/include
cp -R include/linux /usr/include
touch /usr/include/linux/autoconf.h

# Chapter 6 - Mounting kernfs and making devices
# Dont mount /sys. Do mount /dev/pts, after doing 'mkdir /dev/pts'.
# Get:

# Then:

bzcat MAKEDEV-1.7.bz2 > /dev/MAKEDEV
chmod 754 /dev/MAKEDEV
cd /dev
./MAKEDEV -v generic-nopty

# Chapter 6 - Glibc
# Again, unpack the 'linuxthreads' addon.
# When installing Linux Threads, Glibc installs
# 'linuxthreads/sysdeps/pthread/semaphore.h' to '/usr/include/semaphore.h'. The
# 'linuxthreads/sysdeps/pthread/semaphore.h' header only contains one line,
# '#include <linuxthreads/semaphore.h>', but 'linuxthreads/semaphore.h' will not exist
# in '/usr/include'. As a result packages which need 'semaphore.h' will not be able to
# build because this header is broken. We can correct this by renaming
# 'linuxthreads/sysdeps/pthread/semaphore.h' so that the 'linuxthreads/semaphore.h'
# header will be used and installed instead:

mv -v linuxthreads/sysdeps/pthread/semaphore.h{,.bak}

# Do not use "-fomit-frame-pointers" in your CFLAGS, this will break linuxthreads.
# Use '--enable-omitfp' instead.
# Configure Glibc with the same additional options as in chapter 5, but add libidn if
# you want:
# '--enable-kernel=2.4.22 --enable-addons=linuxthreads,libidn --disable-sanity-checks'

# Don't expect all the testsuite to pass. Linuxthreads is not maintained, and neither
# is the testsuite against it. I investigated the test failures and found they were
# mainly caused by too many included headers, or the wrong included headers. The test
# failures were caused by bugs in the testsuite, not Glibc or linuxthreads themselves.

# Chapter 6 - Modutils
# Replace the Module-init-utils package with Modutils from:
# And get this patch to compile it with gcc4:
#	modutils-2.4.27-gcc.patch
# Install Modutils with:

./configure &&
make &&
make install

# Chapter 6 - Udev
# Don't install this package.

# Chapter 7 - LFS-bootscripts
# You can use lfs-bootscripts-2.0.5:
# or the latest boot scripts at:
# The latest boot scripts are designed for the 2.6 kernel, and will need to be
# modified to work with Linux-2.4. First disable the Udev boot scripts:

chmod -x /etc/rc.d/init.d/udev*

# Then in '/etc/rc.d/init.d/mountfs' comment out or remove the line:
# 'mount -f /sys || failed=1'
# In '/etc/rc.d/init.d/mountkernfs' comment out or remove the lines:
#	if ! mountpoint /sys &> /dev/null; then
#		boot_mesg -n " /sys" ${NORMAL}
#		mount -n /sys || failed=1
#	fi

# Chapter 8 - Linux kernel
# Starting with version 2.4.34 the 2.4 series kernel can compile with GCC-4.
# Clean the Linux source with either 'make mrproper' or 'make clean'.
# Configure with:

make menuconfig

# Enable CONFIG_UNIX98_PTYS and CONFIG_DEVPTS_FS for '/dev/pts', and CONFIG_TMPFS if
# you want to be able to mount '/dev/shm'.
# And then build the kernel and modules with:

make dep &&
make bzImage &&
make modules

# And install the modules with:

make modules_install

# BLFS - Alsa:
# The 2.4 kernel doesn't come with Alsa sound drivers, and the BLFS book doesn't have
# the Alsa-driver package. If you want to use Alsa then get the driver package at:
# Using the same version as your other Alsa packages. This Alsa-driver package will
# install the actual kernel modules. Look at './configure --help' if you want to use
# the '--with-cards=' option so you only install the driver(s) you need. You will also
# need to point '--with-kernel=' at your kernel source directory, unless you symlinked
# it to /usr/src/linux. Use the '--with-build=' switch too. This package will build
# the sound modules with the same CFLAGS that were used to build the kernel, so don't
# modify them. Build and install alsa-driver with:

./configure --with-kernel=/usr/src/linux- \
    --with-build=/usr/src/linux- &&
make &&
make install

  * Initial hint.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the hints mailing list