Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
- Download the Linux kernel archive (in .tar.gz or .tar.bz2 format) into /usr/src.
- Unpack it (either by "tar -zxf linux*.tar.gz" or "tar -xjf linux*.tar.bz2").
- Symbolically link ("symlink") the directory to /usr/src/linux ("ln -s /usr/src/linux* /usr/src/linux").
- Go into the new directory ("cd /usr/src/linux").
Then, once your in this directory, you can run those commands: make mrproper, make headers_check, make INSTALL_HDR_PATH=dest headers_install, cp -rv dest/include/* /tools/include.
lfs@kubuntu:/mnt/lfs/sources$ sudo mv linux-2.6.22.5.tar.bz2 /usr/src/
[sudo] password for lfs:
lfs is not in the sudoers file. This incident will be reported.
lfs@kubuntu:/mnt/lfs/sources$
Do not, do not, do not put the Linux kernel source in your /usr/src. That is on your host system! If you execute the commands in the LFS book from /usr/src/linux, you will overwrite your host system's kernel headers.
Ensure that you are in $LFS/sources and then
Code:
tar xf linux-2.6.22.5.tar.bz2
cd linux-2.6.22.5
make mrproper
make headers_check
make INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* /tools/include
Do not create the /usr/src/linux symlink ever on your LFS system. That hasn't been done for years, it is strongly discouraged by the kernel developers, and can cause system breakage.
lfs@kubuntu:/mnt/lfs/sources$ tar xf linux-2.6.22.5.tar.bz2
lfs@kubuntu:/mnt/lfs/sources$ cd linux-2.6.22.5
lfs@kubuntu:/mnt/lfs/sources/linux-2.6.22.5$ make mrproper
lfs@kubuntu:/mnt/lfs/sources/linux-2.6.22.5$ make headers_check
CHK include/linux/version.h
UPD include/linux/version.h
HOSTCC scripts/basic/fixdep
/tools/bin/ld: unrecognized option '--hash-style=both'
/tools/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make[1]: *** [scripts/basic/fixdep] Error 1
make: *** [scripts_basic] Error 2
lfs@kubuntu:/mnt/lfs/sources/linux-2.6.22.5$
#!/bin/sh
# Build variables.
PROG=kernel-headers
VERSION=2.6.23.12
ARCH=i686
PORTARCH=i386
BUILD=1
# Setup the package path and build directory.
CWD=`pwd`
TMP=/tmp
if [ ! -d $TMP ] ; then
mkdir -pv $TMP # Just in case /tmp doesn't exist for some reason.
fi
PKG=$TMP/pkg-$PROG
rm -rf $PKG # Make sure that this doesn't exist first.
mkdir -pv $PKG
# Extract and copy over the kernel headers.
cd $TMP
rm -rf linux-2.6.23.12
tar -xvjf $CWD/linux-2.6.23.12.tar.bz2
cd linux-2.6.23.12
mkdir -pv $PKG/usr/include
cd include
cp -fa asm-generic asm-$PORTARCH linux $PKG/usr/include
# Ensure everything in the package belongs to root and has sane
# permissions.
chown -Rv root:root $PKG/usr/include/{asm-*,linux}
find $PKG/usr/include/{asm-*,linux} -type d -exec chmod -v 755 {} \;
find $PKG/usr/include/{asm-*,linux} -type f -exec chmod -v 644 {} \;
# Copy over the description and make the package.
cd $PKG
mkdir -pv $PKG/install
cp $CWD/desc $PKG/install
makepkg -l y -c n $TMP/$PROG-$VERSION-$ARCH-$BUILD.tgz
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.