Welcome to the most active Linux Forum on the web.
Go Back > Blogs > 55020
User Name


Rate this Entry

Notes on using LFS Chapter 5 to build a Slackware toolchain

Posted 10-13-2010 at 01:31 PM by 55020
Updated 10-13-2010 at 04:43 PM by 55020 (Doh! Right at the end, should be 'find $LFS...')

This is a brief set of notes on bootstrapping a self-hosting Slackware toolchain, using the process described in Chapter 5 of the LFS Book. Future notes will cover LFS Chapter 6, and then the rest of Slackware (or some of it, anyway).

The motivation for doing this arises out of a number of recent threads on the LQ Forum, but it's also just a generally cool thing to do.

Note that my host system is Slackware64-current. The target system is Slackware64-13.1. I also intend to repeat the process with a 32-bit Slackware 13.1 host, so these notes are work-in-progress. Eventually (when I know it's stable) I'll provide some scripts to automate the process.

In general, you should do everything that it says in Chapter 5 of the LFS v6.7 Book, but substitute the version of each package that's in Slackware 13.1. The easy way to get the package sources is from the Slackware 13.1 DVD or CD media. You might like to omit all the 'make check' and 'make test' commands (I omitted them )

5.4 binutils pass 1

Slackware 13.1 uses HJL binutils-, not FSF binutils. This is the subject of an LFS FAQ. However, despite the LFS FAQ, you can safely substitute Slackware's version of HJL binutils. I trust Pat's judgment on this Use the same commands that are in the LFS book.

5.5 gcc pass 1

Slackware 13.1 has gcc-4.4.4, so substitute that. To compile it, use the commands from LFS 6.6 (including gmp and mpfr). (You don't need MPC.)

5.7 glibc

Slackware 13.1 has glibc-2.11.1, so substitute that. However, I found that a fix was needed as described in this LQ thread.
cd glibc-2.11.1
sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
Now you can use the commands from the LFS 6.6 book.

5.9 binutils pass 2

Again substitute HJL binutils-, but otherwise use the commands in the LFS book.

5.10 gcc pass 2

Again substitute gcc-4.4.4, using the commands from the LFS 6.6 book. You will need the gcc-4.4.3-startfiles_fix-1.patch from LFS (it will apply successfully on gcc-4.4.4).

5.11, 5.12, 5.13

You may want to leave this stuff out and not do any testing.

5.22 gettext

Substitute Slackware 13.1's older gettext-0.17. Use the commands from the LFS book.

5.23 grep

Substitute Slackware 13.1's older grep-2.5.4. Use the commands from LFS 6.6.

5.26 make

Substitute Slackware 13.1's older make-3.81. Use the commands from the LFS book.

5.27 patch

Substitute Slackware 13.1's ancient patch-2.5.4. Unfortunately autoconf in this version of patch doesn't know about x86_64. If you are building on x86_64, you can fix it like this:
cd patch-2.5.4
cp -f -p /usr/share/libtool/config/config.{guess,sub} .
and then use the commands from the LFS book.

5.28 perl

Substitute Slackware 13.1's older perl-5.10.1. Use the commands from the LFS 6.6 book.

5.30 tar

Before compiling tar, you can add more utilities that Slackware needs to support pkgtools package management, which will be very useful in Chapter 6.

(a) zlib-1.2.3

Use the following commands, which are loosely based on the official SlackBuild.
./configure --prefix=/tools --libdir=/tools/lib
make clean
cp zlib.h zconf.h /tools/include
chmod 644 /tools/include/zlib.h /tools/include/zconf.h
cp libz.a /tools/lib
chmod 644 /tools/lib/libz.a
./configure --prefix=/tools --libdir=/tools/lib --shared
make clean
cp -a* /tools/lib
chmod 755 /tools/lib/
(b) util-linux-ng-2.17.2

Use these commands.
./configure --disable-wall --prefix=/tools
make install
--disable-wall avoids an error caused by chgrp when installing the wall command; you don't need wall at this time.

(c) which-2.20

Get the source from your Slackware media. Use these commands
./configure --prefix=/tools
make install
(d) xz-4.999.9beta

Get the source from your Slackware media. Use these commands
./configure --prefix=/tools
make install
(e) tar-1.23
You will need tar-1.23-support_txz.diff.gz from your Slackware media. Use these commands
zcat ../tar-1.23-support_txz.diff.gz | patch -p1
sed -i /SIGPIPE/d src/tar.c
./configure --prefix=/tools
make install
(f) tar-1.13

Pat's loyalty to tar-1.13 is legendary . Get the source from your Slackware media. You will also need tar-1.13.bzip2.diff.gz from your Slackware media. Additionally, x86_64 autoconf support needs to be added (as for patch-2.5.4). Use these commands
zcat $SSRC/a/tar/tar-1.13.bzip2.diff.gz | patch -p1
cp -f -p /usr/share/libtool/config/config.{guess,sub} .
./configure --prefix=/tools --disable-nls
cat src/tar > $LFS/tools/bin/tar-1.13
chmod 755 $LFS/tools/bin/tar-1.13
5.32 Stripping

Use the team's strip command, which is much nicer and more surgical than the LFS strip command:
find $LFS -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
And that's it! You are now ready to start Chapter 6. More soon.
Posted in Uncategorized
Views 4013 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 10:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration