#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
cd /usr || exit 1
-tar cf src.tar src || exit 1
+tar cf - src | compress >src.tar.z || exit 1
cd /usr/src || exit 1
make world install || exit 1
cd tools || exit 1
-make hdboot
+make hdboot || exit 1
+cp ../boot/boot /boot/boot || exit 1
cd /usr || exit 1
rm -rf /usr/src || exit 1
exit 0
# The real root device may be the RAM disk.
realroot=`printroot -r`
+# If it's an initial fstab, pretend root is real root
+if [ $root = "/dev/ROOT" ]
+then root=$realroot
+fi
+
case $action in
bootable | hdboot)
# We need the root device.
+
if [ $realroot = $root ]
then
rootdir=
# Install /dev, /boot
mount $dev /mnt || exit 1
mkdir /mnt/dev
+ mkdir /mnt/boot
+ mkdir /mnt/boot/image
( cd /mnt/dev && /usr/src/commands/scripts/MAKEDEV.sh std )
- cp -p image /mnt/minix || exit 1
- cp -p ../boot/boot /mnt/boot || exit 1
+ cp -p image /mnt/boot/image || exit 1
+ cp -p ../boot/boot /mnt/boot/boot || exit 1
umount $dev || exit 1
- installboot -d $dev ../boot/bootblock boot || exit 1
+ installboot -d $dev ../boot/bootblock boot/boot || exit 1
+ edparams $dev 'unset bootopts; unset servers; unset image; ramimagedev=c0d2p1; unset rootdev; unset leader; leader() { echo If the system cannot find root, please hit ESC and set your\nramimagedev to the CD device, partition 1. e.g.\nramimagedev=c0d2p1 .. then boot to start.\n }; bootcd=1; main(){delay 10000;boot}; save' || exit
# copy image
dd if=$dev of=cdfdimage bs=8192 count=180
COPYITEMS="usr/src usr/bin bin usr/lib"
RELEASEDIR=/usr/r/release
IMAGE=cdfdimage
+ROOTIMAGE=rootimage
ISO=minix.iso
RAM=/dev/ram
if [ `wc -c $RAM | awk '{ print $1 }'` -ne 1474560 ]
read dev || exit 1
TMPDISK=/dev/$dev
+echo "Temporary (sub)partition to use for storage in /tmp?"
+echo -n "Device: /dev/"
+read tmpdev || exit 1
+TMPTMPDISK=/dev/$tmpdev
+
if [ -b $TMPDISK ]
then :
else echo "$TMPDISK is not a block device.."
exit 1
fi
+if [ -b $TMPTMPDISK ]
+then :
+else echo "$TMPDISK is not a block device.."
+ exit 1
+fi
+
umount $TMPDISK
+umount $TMPTMPDISK
umount $RAM
( cd .. && make clean )
-rm -rf $RELEASEDIR $ISO $IMAGE
+rm -rf $RELEASEDIR $ISO $IMAGE $ROOTIMAGE
mkdir -p $RELEASEDIR
mkfs -b 1440 -B 1024 $RAM || exit
echo " * mounting $RAM as $RELEASEDIR"
mount $RAM $RELEASEDIR || exit
-mkdir $RELEASEDIR/usr
+mkdir $RELEASEDIR/usr $RELEASEDIR/tmp
+mount $TMPTMPDISK $RELEASEDIR/tmp || exit 1
mkfs -B 1024 $TMPDISK
echo " * mounting $TMPDISK as $RELEASEDIR/usr"
mkdir -p $RELEASEDIR/usr/tmp
echo " * Transfering $COPYITEMS to $RELEASEDIR"
( cd / && tar cf - $COPYITEMS ) | ( cd $RELEASEDIR && tar xf - ) || exit 1
+( cd $RELEASEDIR && find . -name CVS | xargs rm -rf )
echo " * Chroot build"
chroot $RELEASEDIR '/bin/sh -x /usr/src/tools/chrootmake.sh' || exit 1
echo " * Chroot build done"
umount $TMPDISK || exit
+umount $TMPTMPDISK || exit
umount $RAM || exit
-cp $RAM rootimage
+cp $RAM $ROOTIMAGE
make programs image
(cd ../boot && make)
make image || exit 1
./mkboot cdfdboot
writeisofs -l MINIX -b $IMAGE /tmp $ISO || exit 1
echo "Appending Minix root filesystem"
-cat >>$ISO rootimage || exit 1
+cat >>$ISO $ROOTIMAGE || exit 1
echo "Appending Minix usr filesystem"
cat >>$ISO $TMPDISK || exit 1
ls -al $ISO