AW: [RE: LFS without previous linux]

Dan Osterrath do3 at mail.inf.tu-dresden.de
Thu Nov 7 04:17:49 PST 2002


So, I'm at WIndows at the moment so sorry for the non-threading. Sometimes
we have to use tools we don't like...

Well I made it up on my own, except for the instructions for compiling the
packages.
And yes, I'm running a LFS 4.0 with that.
At first create a loop back device and create a isofs there. Then mount this
device to a special directory and set LFS to this directory (this will
become the cd root). There you should create a typical directory structure
and the devices in $LFS/dev
Now you can go on with installing the packages from chapter 5.
You should add some packages as you will need them in addition. You should
determine these for yourself. I.e. fdisk, e2fsprogs, vim, sysvinit,
modutils, netkit-tools, ... But remember to link them statically!!!
Then setup isolinux in this directory and create a kernel image. Don't
install the kernel and its modules as usual but install them in $LFS. A
initrd-image is not needed, you can have /dev/cdrom as root.
A good idea was to make some extra symlinks:
ln -sf . $LFS$LFS # make symlink from CD-root/$LFS to CD-root
ln -sf . $LFS/static # make symlink from CD-root/static to CD-root

Then setup the system. For a hint here are _some_ files:

$LFS/etc/inittab
~~~~~~~~~~~~~~~~~~~~~~~
id:2:initdefault:

l0:0:wait:/static/etc/init.d/halt
l1:S12345:wait:/static/etc/init.d/start
l6:6:wait:/static/etc/init.d/reboot

ca:12345:ctrlaltdel:/static/sbin/shutdown -t1 -a -r now

su:S016:respawn:/static/sbin/bash --login

1:2345:respawn:/static/bin/bash --login </dev/tty1 >/dev/tty1 2>&1
2:2345:respawn:/static/bin/bash --login </dev/tty2 >/dev/tty2 2>&1
3:2345:respawn:/static/bin/bash --login </dev/tty3 >/dev/tty3 2>&1
4:2345:respawn:/static/bin/bash --login </dev/tty4 >/dev/tty4 2>&1
5:2345:respawn:/static/bin/bash --login </dev/tty5 >/dev/tty5 2>&1
6:2345:respawn:/static/bin/bash --login </dev/tty6 >/dev/tty6 2>&1
7:2345:respawn:/static/bin/bash --login </dev/tty7 >/dev/tty7 2>&1
8:2345:respawn:/static/bin/bash --login </dev/tty8 >/dev/tty8 2>&1
9:2345:respawn:/static/bin/bash --login </dev/tty9 >/dev/tty9 2>&1
10:2345:respawn:/static/bin/bash --login </dev/tty10 >/dev/tty10 2>&1

$LFS/etc/init.d/halt
~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/cdrom/bin:/cdrom/sbin
echo "Sending all processes the TERM signal..."
killall5 -15
sleep 3
echo "Sending all processes the KILL signal..."
killall5 -9
sleep 3
echo "Unmounting remaining file systems..."
umount -alrf >/dev/null 2>&1
sync; sync
echo "Halting..."
exec halt -d -f -i -p

$LFS/etc/init.d/reboot
~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/cdrom/bin:/cdrom/sbin
echo "Sending all processes the TERM signal..."
killall5 -15
sleep 3
echo "Sending all processes the KILL signal..."
killall5 -9
sleep 3
echo "Unmounting remaining file systems..."
umount -alrf >/dev/null 2>&1
sync; sync
echo "Rebooting..."
exec reboot -d -f -i

$LFS/etc/init.d/start
~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
mount -t proc /proc /proc
echo "  "
echo "Welcome to the LFS CVS boot cd!"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "1. create partition and filesystem for root partition"
echo "fdisk"
echo "mkfs.ext2 /dev/hda1"
echo "2. mount the new root partition to /mnt"
echo "mount /dev/hda1 /mnt"
echo "3. create needed directories"
echo "mkdir /mnt && mkdir/mnt/static"
echo "4. change root"
echo "pivot_root /mnt /mnt/static"
echo "exec /static/bin/bash --login"
echo "5. set PATH, CFLAGS, CXXFLAGS and LDFLAGS"
echo "export
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/cdrom/bin
:/cdrom/sbin:/static/bin:/static/sbin"
echo "export CFLAGS=\"-march=pentium2 -O2 -s -fomit-frame-pointer\""
echo "export CXXFLAGS=\"\$CFLAGS\""
echo "export LDFLAGS=\"-z combreloc\""
echo "go on with creating directories in chapter 06 of the LFS book"

$LFS/etc/profile
~~~~~~~~~~~~~~~~~
PROFILEREAD=true
umask 022

export ARCH=`/bin/uname --machine`
export CFLAGS="-s -O2 -march=$ARCH -fomit-frame-pointer"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-z combreloc"
export
PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/cdrom/bin
:/cdrom/sbin:/static/bin:/static/sbin
export INPUTRC="/static/etc/inputrc"
export HISTCONTROL=ignoredups
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
 export TERM=linux
fi
export PS1='\u@\h:\w > '
export PS2='> '
export LANG="de_DE at euro"
export LANGUAGE="de_DE at euro"
export LC_ALL="de_DE at euro"

After this don't forget to add the LFS packages to $LFS/packages as you can
not umount the cd and insert another cd. (Of course you can mount network
shares if you have these tools statically linked on the cd.)
Then you can umount $LFS and burn the cd image.
When booting from cd you have to give the new root as kernel parameter to
the isolinux prompt. I.e.:
isolinux: linux root=/dev/hdc

You have to give the kernel the real device as /dev/cdrom is never specific.
Remember when booting from /dev/hdc or on another machine from /dev/hdd.
Information from hpa: There is no way to determine which device you are
booting from. (I.e. something like /dev/bootdevice)
Of course you could add the parameter to the isolinux kernel parameters but
you want to stay flexible, don't you? ;-)

Well, that's all I think.

-----Ursprüngliche Nachricht-----
Von: lfs-support-bounce at linuxfromscratch.org
[mailto:lfs-support-bounce at linuxfromscratch.org]Im Auftrag von Eric
Miller
Gesendet: Donnerstag, 7. November 2002 04:53
An: lfs-support at linuxfromscratch.org
Betreff: Re: [RE: LFS without previous linux]

I am so happy that you posted this.  I asked the same question a few weeks
ago, about making a boot disk with just the chapter 5 static packages, and
using that as a base for the rest of the build.  Have you successfully built
4.0 like this?  Did you follow the hints for making the CD, or did you make
it
up on your own?  I would really like some more info on this....


-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message



More information about the lfs-support mailing list