Linux From Scratch scripts

From: Ayden <whitty@reeve.com>
Date: Wed Dec 29 2004 - 14:39:02 AKST

I've been working on a little project to automate lfs. Currently, it
only builds the /tools chain. Here I will provide information on how to
setup this linux from scratch system.

Partition your hardrive, and create a filesystem on it.
        fdisk /dev/hda; mke2fs -j /dev/hda4

mount the partition in /mnt/lfs.
        mkdir /mnt/lfs; mount /dev/hda4 /mnt/lfs

Create the tree needed for the scripts to run.
        mkdir /mnt/lfs/{tools,source,source/unzipped,source/source}

Download all the .sh files at
        http://linux.lithedark.com/source/
        into /mnt/lfs/source/

Then download:
ftp://ftp.linuxfromscratch.org/pub/lfs/lfs-packages/lfs-packages-5.1.1.tar into /mnt/lfs/source/source

Untar this archive of the packages you will need with:
        cd /mnt/lfs/source/source/; tar -xvf lfs-packages-5.1.1.tar

Lastly, download:
ftp://ftp.kernel.org/pub/linux/utils/util-linux/util-linux-2.12b.tar.bz2
into /mnt/lfs/source/source

Link /mnt/lfs/tools with /
        ln -s /mnt/lfs/tools /

Chown the directories for a regular user.
        chown -R <user> /mnt/lfs

Since the tools that you are installing need to be independent of the
host system, you need to adjust the tool chain to change the linker
from /lib/ld* to /tools/lib/ld* I have created a shell script to do that
for you, however, you might have a different name for ld than I do. The
one the script is build for is ld.so.1 but for example, yours might be
ld-linux.so.2 . To solve this you need to find out what your system's
linker is.
        ls /lib
What you are looking for is something that says ld*
After you've found what your linker is,
edit /mnt/lfs/source/adjtool-1.sh

Located at line 24 there is a sed script that you need to edit so that
it looks like what your linker is. Example:
        sed -e 's@ /lib/ld.so.1@ /tools/lib/ld.so.1@g' \

Change both entries for ld.so.1 to your linker.

(NOTE: without doing this, you will not be able to chroot into the new
environment to build the second half of your lfs system. Doing this
incorrectly, or not at all, will result in the programs compiled after
you adjust the tool chain to be linked against your host system's libs,
instead of the libs that are compiled into /tools before adjtool-1.sh is
run)

Once you have changed that around, that should be the only system
specific part of these scripts. You should be all set to run the shell
scripts and create the tools needed to build your lfs system through
chroot. Run these scripts with:
        cd /mnt/lfs/source; sh LFSInstall.sh
OR
        cd /mnt/lfs/source; time sh LFSInstall.sh

to see how long it will take. My powerpc 1.2 ghz, 768 mb of memory
system, builds the entire /tools chain in a little over an hour and a
half. ( 95 - 96 minutes.)

Where to go when you are done?
http://archive.linuxfromscratch.org/lfs-museum/5.1.1/LFS-BOOK-5.1.1-HTML/chapter06/proc.html

I recommend everybody build linux from scratch at some point, it is a
great way to learn the inner workings of OpenSource technology. I
created these scripts so that it wouldn't seem as tedious every time I
wanted to build a tool chain, sometime later, i may continue this, and
create a full bootable system (and add some error handling, what little
there is, some of it doesn't work, i think.) A lot of the scripts that i
created would apply to postchroot actions, only a few minor changes
would be needed for most of the perchroot scripts. If anybody else is
interested, please contribute, if you find any errors, please tell me,
with a fix or at least good information on why it didn't work. Who
knows, I have powerpc work for other distributions that i need to take
care of first.

Good luck,
Whitham

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Wed Dec 29 14:39:14 2004

This archive was generated by hypermail 2.1.8 : Wed Dec 29 2004 - 14:39:14 AKST