Skip to content

Instantly share code, notes, and snippets.

@nad2000
Last active March 11, 2016 08:35
Show Gist options
  • Save nad2000/6388712 to your computer and use it in GitHub Desktop.
Save nad2000/6388712 to your computer and use it in GitHub Desktop.
Building LFS (http://www.linuxfromscratch.org/) on a Ubuntu 12.04.2 LTS based on Linux From Scratch - Version 7.4
# Creating the $LFS directory
...
# Create lfs user and the profile for it
...
sudo su - lfs
# Downloading packet source:
mkdir -vp $LFS/sources
cd $LFS/sources
wget -O - http://www.linuxfromscratch.org/lfs/view/stable/wget-list | while read l ; do fn=$(basename $l) ; if [ ! -f $fn ] ; then echo $l ; fi ; done | xargs -n 1 -P 8 wget -P $LFS/sources
# downloaded source verification:
wget -O - http://www.linuxfromscratch.org/lfs/view/stable/md5sums | md5sum -c -
# Un-taring:
cd $LFS/sources
ls -1 *tar* | xargs -P 8 -I{} tar xf {}
# Binutils-2.23.2 - Pass 1 (http://www.linuxfromscratch.org/lfs/view/stable/chapter05/binutils-pass1.html)
cd ~/lfs/sources
mkdir -v binutils-build
cd binutils-build
time { ../binutils-2.23.2/configure --prefix=/tools --with-sysroot=$LFS --with-lib-path=/tools/lib --target=$LFS_TGT --disable-nls --disable-werror && make && make install; }
#real 0m33.454s
#user 1m7.904s
#sys 0m8.321s
...
# Binutils-2.23.2 - Pass 2 (http://www.linuxfromscratch.org/lfs/view/stable/chapter05/binutils-pass2.html):
# I got "configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'.". added --host=$LFS_TGT:
CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
../binutils-2.23.2/configure --prefix=/tools --disable-nls --with-lib-path=/tools/lib --with-sysroot --host=$LFS_TGT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment