--- toast-linux	2004/04/15 06:20:38	1.21
+++ toast-linux	2004/04/16 00:17:16	1.22
@@ -776,9 +776,12 @@
 devpts          /dev/pts        devpts  rw                              0 0
 /dev/fd0        /mnt/floppy     vfat    rw,noauto,sync                  0 0
 /dev/toast/root /mnt/root       ext2    rw,noauto                       0 0
+/dev/toast/boot /mnt/root/boot  ext2    rw,noauto                       0 0
+proc            /mnt/root/proc  proc    rw,noauto                       0 0
 
 --- FILE root/etc/fstab.hd ---
 /dev/toast/root /               ext3    rw                              0 0
+/dev/toast/boot /boot           ext3    rw                              0 0
 proc            /proc           proc    rw                              0 0
 sys             /sys            sysfs   rw                              0 0
 devpts          /dev/pts        devpts  rw                              0 0
@@ -793,34 +796,34 @@
 --- FILE root/etc/lilo.conf ---
 boot = /dev/hda
 root = /dev/ram0
-initrd = /usr/boot/initrd.gz
+initrd = /boot/initrd.gz
 delay = 40
 lba32
 read-write
 
-image = /usr/boot/vmlinuz
+image = /boot/vmlinuz
 label = toast
 
-image = /usr/boot/vmlinuz.off
+image = /boot/vmlinuz.off
 label = toast.oldkernel
 optional
 
-image = /usr/boot/vmlinuz.off.off
+image = /boot/vmlinuz.off.off
 label = toast.olderkernel
 optional
 
-image = /usr/boot/vmlinuz
-initrd = /usr/boot/initrd.gz.off
+image = /boot/vmlinuz
+initrd = /boot/initrd.gz.off
 label = toast.oldinitrd
 optional
 
-image = /usr/boot/vmlinuz
-initrd = /usr/boot/initrd.gz.off.off
+image = /boot/vmlinuz
+initrd = /boot/initrd.gz.off.off
 label = toast.olderinitrd
 optional
 
-image = /usr/boot/vmlinuz.off
-initrd = /usr/boot/initrd.gz.off
+image = /boot/vmlinuz.off
+initrd = /boot/initrd.gz.off
 label = toast.oldkernel.oldinitrd
 optional
 
@@ -828,13 +831,12 @@
 PS1='\u@\h:\w\$ '
 
 --- FILE root/etc/inittab ---
-::sysinit:/etc/init.d/rcS
+::sysinit:/etc/init.d/rc.start
 ::respawn:-/bin/sh
 ::ctrlaltdel:/sbin/reboot
-::shutdown:/sbin/swapoff -a
-::shutdown:/bin/umount -a -r
+::shutdown:/etc/rc.stop
 
---- FILE root/etc/init.d/rcS ---
+--- FILE root/etc/init.d/rc.start ---
 #!/bin/sh
 devices
 mount -a
@@ -842,6 +844,12 @@
 hostname localhost
 run
 
+--- FILE root/etc/init.d/rc.stop
+#!/bin/sh
+swapoff -a
+[ -d /mnt/root/proc/1 ] && umount /mnt/root/proc
+umount -a -r
+
 --- FILE root/sbin/network ---
 #!/bin/sh
 
@@ -1043,6 +1051,8 @@
 target="/mnt/root"
 
 mount "$target"
+mount "$target/boot"
+mount "$target/proc"
 
 if [ "`cd /$target; echo *`" != "lost+found" ]; then
   echo "unexpected filesystem contents: $target" >&2
@@ -1068,12 +1078,15 @@
   ln -s "$relrootdir/$i" "$target/$i"
 done
 
-for i in mnt/floppy proc sys tmp usr/man var/empty var/lock var/run var/log; do
+for i in boot mnt/floppy proc root sys tmp usr/man var/empty var/lock var/run var/log; do
   mkdir -p "$target/$i"
 done
 chmod 1777 "$target/tmp"
 
 ln -s "../usr/share/zoneinfo/`cat /etc/TZ`" "$target/etc/localtime"
+for i in inittab rc devfsd.conf protocols services rpc fdprm; do
+  ln -sf "../usr/etc/$i" "$target/etc/$i"
+done
 ln -s . "$target/usr/usr"
 ln -s gcc "$target/bin/cc"
 ln -s vim "$target/bin/vi.off"
@@ -1124,6 +1137,8 @@
 
 # If available memory is less than "goalmegs" megabytes, create and activate
 # a swap volume to bring it up to that amount.
+# TODO: combine this with the /sbin/partition script.
+# BUG: the permanent fstab isn't getting updated
 
 goalmegs=512
 vgname=toast
@@ -1188,10 +1203,18 @@
 # waste a bit less space, especially on smaller drives.
 pemegs=16
 
+# Number of megabytes to allocate to the /boot logical volume.
+# /boot needs to be on a separate LV because current versions of lilo
+# seem to panic if the LV spans multiple PVs (even if they're on the
+# same disk!), so we need a special LV that is explicitly restricted to
+# one PV.
+bootmegs=128
+
 # Percentage of the total space in the volume group to allocate to the
-# single logical volume we'll be creating.
-# Remaining space in the VG will be used by snapshots (for fsck or backups)
-# and/or any other logical volumes the user might decide to create later.
+# root logical volume we'll be creating.
+# Remaining space in the VG will be used for /boot, swap (if any),
+# by snapshots (for fsck or backups) and/or any other logical volumes
+# the user might decide to create later.
 lvpercent=80
 
 # Volume group name.  If we want to be able to coexist peacefully with an
@@ -1199,10 +1222,6 @@
 # existing volume group names.
 vgname="toast"
 
-# Logical volume name.  This only needs to be unique within our volume group,
-# so a generic descriptive name should be fine. 
-lvname="root"
-
 # Temporary file used to store munged parted output.
 tmpfile=/tmp/parted.munge.$$
 
@@ -1386,21 +1405,28 @@
 # create an ext3 filesystem on the new partitions
 [ -z "$pvpaths" -o "$pecount" -eq 0 ] && error "no room for new partitions"
 let lvextents="$pecount*$lvpercent/100"
-lvpath="/dev/$vgname/$lvname"
 echo "devices"
 for pvpath in $pvpaths; do
   echo "dd if=/dev/zero of=$pvpath bs=512 count=10"
 done
 echo "pvcreate -fy -M2 $pvpaths"
 echo "vgcreate -s $pemegs $vgname $pvpaths"
-echo "lvcreate -l $lvextents -n $lvname $vgname"
+echo "lvcreate -L "$bootmegs"m -n boot $vgname" # TODO: restrict to first PV
+echo "lvcreate -l $lvextents -n root $vgname"
 echo "vgchange -ay $vgname"
-echo "parted -s $lvpath -- mklabel loop"
-echo "parted -s $lvpath -- mkpartfs primary ext2 0 -0"
-echo "tune2fs -j $lvpath"
+for lvname in boot root; do
+  lvpath="/dev/$vgname/$lvname"
+  echo "parted -s $lvpath -- mklabel loop"
+  echo "parted -s $lvpath -- mkpartfs primary ext2 0 -0"
+  echo "tune2fs -j $lvpath"
+done
 
 --- FILE root/sbin/lilo ---
-#!/bin/sh
+#!/bin/sh -e
+[ -d /mnt/root/proc/1 ] || !echo "/mnt/root/proc not mounted?"
+rm -f /mnt/root/dev/dm-[0-9]*
+chroot /mnt/root vgscan
+cp /mnt/root/usr/boot/* /mnt/root/boot/
 exec chroot /mnt/root lilo "$@"
 
 --- FILE root/sbin/toast ---
@@ -1707,7 +1733,7 @@
 task 1 clean3 toast remove deb-headers deb-kheaders
 task 1 binutils1 toast arm http://ftp.gnu.org/gnu/binutils/binutils-2.14.tar.bz2
 task 1 clean4 toast remove deb-binutils
-task 1 bash1 toast arm http://ftp.gnu.org/gnu/bash/bash-2.05b.tar.gz
+task 1 bash toast arm http://ftp.gnu.org/gnu/bash/bash-2.05b.tar.gz
 task 1 glibc toast rebuild glibc
 task 1 gcc toast rebuild gcc
 task 1 binutils toast rebuild binutils
@@ -1728,7 +1754,7 @@
 task 1 tar toast arm ftp://alpha.gnu.org/gnu/tar/tar-1.13.25.tar.gz
 task 1 gzip toast arm http://ftp.gnu.org/gnu/gzip/gzip-1.2.4a.tar.gz
 task 1 patch toast arm http://ftp.gnu.org/gnu/patch/patch-2.5.4.tar.gz
-task 1 findutils toast arm [ http://ftp.gnu.org/gnu/findutils/findutils-4.1.tar.gz http://www.linuxfromscratch.org/findutils-4.1.patch ]
+task 1 findutils toast arm [ http://ftp.gnu.org/gnu/findutils/findutils-4.1.tar.gz http://downloads.linuxfromscratch.org/findutils-4.1.patch ]
 task 1 grep toast arm http://ftp.gnu.org/gnu/grep/grep-2.5.tar.bz2
 task 1 sysvinit toast arm ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-2.85.tar.gz
 task 1 hdparm toast arm http://www.ibiblio.org/pub/Linux/system/hardware/hdparm-5.5.tar.gz
@@ -1750,14 +1776,14 @@
 
 task 1 linux toast arm [ http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.5.tar.bz2 http://toastball.net/toast-linux-tmp/linux-2.6.5-config.tar.gz ]
 task 1 device-mapper toast arm ftp://ftp.sistina.com/pub/LVM2/device-mapper/device-mapper.1.00.07.tgz
-task 1 LVM2 toast arm ftp://ftp.sistina.com/pub/LVM2/tools/LVM2.2.00.08.tgz
+task 1 lvm2 toast arm ftp://ftp.sistina.com/pub/LVM2/tools/LVM2.2.00.08.tgz
 task 1 bin86 toast arm http://www.cix.co.uk/~mayday/dev86/bin86-0.16.15.tar.gz
 task 1 nasm toast arm http://unc.dl.sourceforge.net/sourceforge/nasm/nasm-0.98.38.tar.bz2
-task 1 lilo toast arm lilo/22.5.8+devmapper: [ http://home.san.rr.com/johninsd/pub/linux/lilo/lilo-22.5.8.tar.gz http://www.saout.de/misc/lilo-22.5.8-devmapper.patch ]
+task 1 lilo toast arm lilo/22.5.8+devmapper: [ http://home.san.rr.com/johninsd/pub/linux/lilo/obsolete/lilo-22.5.8.tar.gz http://www.saout.de/misc/lilo-22.5.8-devmapper.patch ]
 task 1 gettext toast arm http://ftp.gnu.org/gnu/gettext/gettext-0.14.1.tar.gz
 task 1 e2fsprogs toast arm http://unc.dl.sourceforge.net/sourceforge/e2fsprogs/e2fsprogs-1.34.tar.gz
 task 1 devfsd toast arm http://kernel.org/pub/linux/daemons/devfsd/devfsd-v1.3.25.tar.bz2
-task 1 genext2fs toast arm genext2fs/1.3-4: [ http://http.us.debian.org/debian/pool/main/g/genext2fs/genext2fs_1.3.orig.tar.gz http://http.us.debian.org/debian/pool/main/g/genext2fs_1.3-4.diff.gz ]
+task 1 genext2fs toast arm genext2fs/1.3-4: [ http://http.us.debian.org/debian/pool/main/g/genext2fs/genext2fs_1.3.orig.tar.gz http://http.us.debian.org/debian/pool/main/g/genext2fs/genext2fs_1.3-4.diff.gz ]
 task 1 toastinit toast arm http://toastball.net/toast-linux-tmp/toastinit-1.3.tar.gz
 task 1 toastlogin toast arm http://toastball.net/toast-linux-tmp/toastlogin-1.8.tar.gz