---------- Forwarded message ----------
Date: Sun, 31 Dec 2000 18:55:46 +0100
From: Gernot.Fink <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Bootcd with 1.44 MB Bootimage 

Hallo Tom

Here is a script (modified buildit.s) that splits tomsrtbt  in a 1.44 MB
bootimage and usr.cpio.bz2. My notebook is not able to load a 2.88MB image.
The script modify a unpacked 1 2 directorystructure.

While booting the scsi-modules are loaded and then I try to find the cd in hdd
hdc hdb scd0 and scd1.

then /usr is loaded from cd.

Bugs: many e.g.
        the directory 2 (and the rc.M) is replaced ! 
        umount,insmod are moved to /bin
        the scsi-modules are moved to /scsi
        not well tested
        rc.0 is modified because moving umount to /bin results in a umount /usr
while umount -a
        after running buildit.s is impossible.
        the scsi-modules are loaded a second time with rc.config.gz 

        The script do many unnethesary but works for me.
        


maybe anybody need it

--
MFG G.Fink
#!2/bin/ash
ST=1/settings.s
. $ST
CK=`du -k $ST`
umount $RD $FD $MP 2>$NU
mkdir $MP

mv 2/usr/bin/umount 2/bin 2>$NU
mv 2/usr/bin/insmod 2/bin 2>$NU
mv 2/usr/lib/modules/scsi 2/lib 2>$NU
#ln -s /lib/scsi 2/usr/lib/modules/scsi 2>$NU

if [ ~`hostname` = ~6M ];then;NM=tomsrtbt;else;NM=`hostname`-tomsrtbt;fi
PL=`awk 'BEGIN{print '"$PL"'+1}'`
BLD=$NM-$VE.$PL
echo -e "NM=$NM\\nPL=$PL">ST
mkfs.minix $RD>$NU
mount $RD $MP
cp -a 1 2 $MP
cd $MP
export POSIXLY_CORRECT=YES
awk '
        BEGIN{
        "du -k -s 2"|getline T
        "du -k -s 2/usr"|getline UZ
        RZ=int(1.06*(T-UZ))
        UZ=int(1.05*UZ)
        "ls -Rid `find 2`|cut -c 1-7|sort -nu|wc -l"|getline T
        "ls -Rid `find 2/usr`|cut -c 1-7|sort -nu|wc -l"|getline UI
        RI=int(1.125*(T-UI))
        UI=int(1.125*UI)
        "du 1|cut -f1"|getline T
        Z1=T+10
        OA=int((Z1+1)/2)
        print "RZ=" RZ
        print "RI=" RI
        print "UZ=" UZ 
        print "UI=" UI
        print "Z1=" Z1
        print "OA=" OA
        }'>>$ID/ST
cd $ID
. ST
umount $MP
sed -e "/mount -o ro /c mount -o ro $FD /fl"<2/etc/rc.M>new
cp new 2/etc/rc.M
dd -q if=/dev/zero of=$RD bs=1k count=$RZ
mkfs.minix -i $RI $RD $RZ>$NU
mount $RD $MP
cd 2

cat >etc/rc.0 <<!!
#!/bin/sh
PATH=/usr/bin:/bin
case "\$0" in
 *6)
  cmd=reboot
  ;;
 *)
  cmd=halt
  ;;
esac
if [ "\$1" != "fast" ]
then
 killall5 -15
 sleep 3
 killall5 -9
fi
\$cmd -w
cd /usr
umount -a -tnfs &
sleep 1
umount -a -tnonfs 2>/dev/null
echo \$cmd
sleep 1
\$cmd -f
!!

cat >etc/mountcd <<!!
for i in /dev/hdc /dev/hdd /dev/hdb /dev/scd0 /dev/scd1
do
        mount \$i \$1 2>/dev/null
        echo \$i
        if [ -f \$1/tomsrtbt/settings.s ] ; then
                echo cd found in \$i
                exit
        fi
        umount \$1 2>/dev/null
done
echo no cd found , mount the cd and type exit
ash
!!
cat >etc/rc.M <<!!
#!/bin/sh
BT=1
PATH=/usr/bin:/bin
for X in /lib/scsi/*; do insmod \$X; done
#mount -o ro /dev/fd0u1722 /fl
/etc/mountcd /fl
. /fl/tomsrtbt/settings.s
mkfs.minix /dev/ram1 \$UZ
echo /usr loading...
mount /dev/ram1 /usr
dd if=/fl/tomsrtbt/usr.cpio.bz2 |bzip2 -ds|cpio -iumd||FAIL CORRUPTED?
update &
cp /fl/tomsrtbt/rc.* /fl/tomsrtbt/*.s /usr/doc
gzip -d /usr/doc/*.gz
. /usr/doc/rc.custom
umount /fl
!!
chmod u+x etc/mountcd etc/rc.*
find . -path ./usr -prune -o -print|cpio -umpdB $MP 2>$NU
mkdir $MP/usr
umount $MP
echo gzipping...
dd -q if=$RD bs=1k count=$RZ|gzip -9 -n>$ID/root.raw.gz
echo bzip2ing...
find usr -depth|cpio -oB 2>$NU|bzip2 -$BZ>$ID/usr.cpio.bz2
cd ..
awk -v DZ=$DZ -v OA=$OA '
        BEGIN{
        "filesize root.raw.gz"|getline T
        Z2=int((T+511)/512)
        O2=(2*OA+Z2)
        "filesize usr.cpio.bz2"|getline T
        Z3=int((T+511)/512)
        FR=(DZ-O2-Z3)
        FR=(2880-O2)
        O1=OA+(int(FR/2))
        O2=O2+(2*int(FR/2))
        print "O1=" O1
        print "O2=" O2
        print "Z2=" Z2
        print "Z3=" Z3
        print "FR=" FR
        }'>>ST
. ST
echo -e "$FR sectors free!"
if [ $FR -ge 0 ];then
 cat>>ST<<'!'
dd>$NU 2>&1 <<'(15 seconds...)'


!
echo Welcome to $NM-$VE.$PL>>ST
 sed -e "/NM=/,/Welcome/d"<$ST>new
 sed -e "/#AUTO#/r ST"<new>$ST
 [ "$CK" = "`du -k $ST`" ]||FAIL settings.s grew, run build again
 mkdir $BLD
 cp -af $ID/2/usr/doc/* $BLD
 cp $ST $BLD
 cp 2/usr/bin/fdformat 2/usr/bin/fdflush $BLD
 dd -q if=/dev/zero of=$RD bs=1k count=2880
 mkfs.minix -i 16 $RD 2880>$NU
 mount $RD $MP
 cp root.raw.gz $MP
 cp -af 1/* $MP
 umount $MP
# dd -q if=root.raw.gz of=$RD bs=1k seek=$O1
# dd -q if=usr.cpio.bz2 of=$RD seek=$O2
 mount $RD $MP
 rm $MP/map
 lilo -C -<<-!
        boot=$RD
        disk=$RD
        bios=0x00
        sectors=18
        heads=2
        cylinders=80
        install=$MP/boot.b
        message=$MP/settings.s
        backup=/dev/null
        map=$MP/map
        timeout=150
        read-write
        vga=ask
        prompt
        image=$MP/zImage
        root=/dev/ram0
        initrd=$MP/root.raw.gz
!
 cp $MP/map 1
 umount $MP
 dd -q if=$RD of=$BLD/tomsrtbt.raw count=2880
tar -cf - $BLD|gzip -9>$BLD.tar.gz
 echo Build done, \"cd $BLD\" to install it.
 echo tomsrtbt.raw is the bootimage
 echo cp tomsrtbt.raw settings.s rc.config.gz usr.cpio.gz in a dir named tomsrtbt  
else
 echo Cannot build, $FR sectors free!
fi
cp 1/settings.s 1/rc.* $BLD
cp usr.cpio.bz2 $BLD 
rm -f -r usr.cpio.bz2 boot.raw root.raw.gz ST new $MP

Reply via email to