Fri 12 June 2015 by Godson

First take one system of centos or ubuntu which ever you like. Make sure have the seperate partitions for LFS and swap which we are going to use fo LFS. Login to the system and create 2 partitions

For Exapmle:
fdisk /dev/sda
# partprobe

Follow same for swap also, 1GB is sufficient for swap partition.

Think we have created /dev/sda6 for LFS and /dev/sda7 for swap.

Next Need to check the host system requirements by coping the content to your host machine and give execute permissions both files. If you get any errors while running scripts please solve the issue before you continue with LFS.

Some exapmle below.

Bash-3.2 for /bin/sh should be a symbolic or hard link to bash ::: # rm -rvf /bin/sh # ln -sv /bin/bash /bin/sh

Bison-2.3 (/usr/bin/yacc should be a link to bison or small script that executes bison) ::: # ln -sv /usr/bin/bison /usr/bin/yacc

Later while checking you will get not found not found not found

not need to worry about it leave it and carry on further.

Then follow the instructions mentioned in LFS Book. start from here 2.3. Creating a File System on the Partition

mkfs -v -t ext4 /dev/<xxx>,

which create a ext4 filesystem on /dev/xxx partition.

Go a head with LFS book as it is...

Before compiling make sure extract the source code and get into that folder than execute the commands which mentioned in the book. After compiling and make, make install dont forget to remove the folder.


# tar -xvf binutils-2.25.tar.bz2
# cd binutils-2.25
# mkdir -v ../binutils-build
# cd ../binutils-build
# ../binutils-2.25/configure     \
--prefix=/tools            \
--with-sysroot=$LFS        \
--with-lib-path=/tools/lib \
--target=$LFS_TGT          \
--disable-nls              \
# make

If building on x86_64, create a symlink to ensure the sanity of the toolchain:

# case $(uname -m) in
x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
# make install
# cd ..
# rm -rf binutils-build binutils-2.25

Next follow the instructions in the book so on....