2005-04-21 16:53:53 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2005-09-08 18:04:34 +02:00
|
|
|
secs=`expr 32 '*' 64`
|
|
|
|
|
2005-08-16 14:09:20 +02:00
|
|
|
make_hdimage()
|
|
|
|
{
|
|
|
|
dd if=$TMPDISK of=usrimage bs=$BS count=$USRBLOCKS
|
|
|
|
|
|
|
|
rootsize=`stat -size rootimage`
|
|
|
|
usrsize=`stat -size usrimage`
|
|
|
|
|
|
|
|
rootsects=`expr $rootsize / 512`
|
|
|
|
usrsects=`expr $usrsize / 512`
|
|
|
|
|
|
|
|
# installboot -m needs at least 1KB
|
|
|
|
dd < /dev/zero >tmpimage count=2
|
|
|
|
partition -fm tmpimage 2 81:$rootsects* 0:0 81:$usrsects
|
|
|
|
installboot -m tmpimage /usr/mdec/masterboot
|
|
|
|
dd < tmpimage > subpart count=1
|
|
|
|
|
|
|
|
primsects=`expr 1 + $rootsects + $usrsects`
|
2005-09-08 18:04:34 +02:00
|
|
|
cyl=`expr '(' $primsects ')' / $secs + 1`
|
|
|
|
padsects=`expr $cyl \* $secs - 1 - $primsects`
|
2005-08-16 14:09:20 +02:00
|
|
|
|
|
|
|
{ dd < /dev/zero count=1
|
|
|
|
cat subpart
|
|
|
|
cat rootimage
|
|
|
|
cat usrimage
|
|
|
|
dd < /dev/zero count=$padsects
|
|
|
|
} > hdimage
|
|
|
|
partition -m hdimage 81:`expr $primsects + $padsects`*
|
|
|
|
installboot -m hdimage /usr/mdec/masterboot
|
|
|
|
}
|
|
|
|
|
|
|
|
hdemu_root_changes()
|
|
|
|
{
|
|
|
|
$RELEASEDIR/usr/bin/installboot -d $RAM \
|
|
|
|
$RELEASEDIR/usr/mdec/bootblock boot/boot
|
|
|
|
echo \
|
|
|
|
'label=BIOS
|
|
|
|
bootcd=2
|
|
|
|
disable=inet
|
|
|
|
bios_remap_first=1
|
|
|
|
ramimagedev=c0d7p0s0
|
|
|
|
save' | $RELEASEDIR/usr/bin/edparams $RAM
|
|
|
|
|
|
|
|
echo \
|
|
|
|
'root=/dev/c0d7p0s0
|
|
|
|
usr=/dev/c0d7p0s2
|
|
|
|
usr_roflag="-r"' > $RELEASEDIR/etc/fstab
|
|
|
|
}
|
|
|
|
|
|
|
|
HDEMU=1
|
|
|
|
|
2005-08-12 14:34:56 +02:00
|
|
|
COPYITEMS="usr/bin bin usr/lib"
|
2005-04-21 16:53:53 +02:00
|
|
|
RELEASEDIR=/usr/r/release
|
|
|
|
IMAGE=cdfdimage
|
2005-05-03 10:54:36 +02:00
|
|
|
ROOTIMAGE=rootimage
|
2005-07-24 03:18:09 +02:00
|
|
|
CDFILES=/usr/tmp/cdreleasefiles
|
2005-09-11 18:36:17 +02:00
|
|
|
sh tell_config OS_RELEASE . OS_VERSION >/tmp/rel.$$
|
2005-09-12 17:44:05 +02:00
|
|
|
version_pretty=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$`
|
2005-09-11 18:36:17 +02:00
|
|
|
version=`sed 's/[" ]//g;/^$/d' </tmp/rel.$$ | tr . _`
|
|
|
|
ISO=minix${version}.iso
|
|
|
|
ISOGZ=${ISO}.gz
|
|
|
|
echo $ISOGZ
|
2005-04-21 16:53:53 +02:00
|
|
|
RAM=/dev/ram
|
2005-08-10 17:14:02 +02:00
|
|
|
BS=4096
|
2005-08-16 14:09:20 +02:00
|
|
|
|
|
|
|
HDEMU=0
|
2005-08-24 18:49:09 +02:00
|
|
|
COPY=0
|
2005-09-01 14:30:17 +02:00
|
|
|
ALL=0
|
2005-09-08 18:04:34 +02:00
|
|
|
QUICK=0
|
2005-08-16 14:09:20 +02:00
|
|
|
|
2005-09-08 18:04:34 +02:00
|
|
|
while getopts "chaq?" c
|
2005-08-16 14:09:20 +02:00
|
|
|
do
|
|
|
|
case "$c" in
|
|
|
|
\?)
|
2005-09-08 18:04:34 +02:00
|
|
|
echo "Usage: $0 [-a] [-c] [-h]" >&2
|
2005-08-16 14:09:20 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
h)
|
2005-09-01 17:26:12 +02:00
|
|
|
echo " * Making HD image"
|
2005-08-16 14:09:20 +02:00
|
|
|
HDEMU=1
|
2005-08-24 18:49:09 +02:00
|
|
|
;;
|
|
|
|
c)
|
2005-09-01 17:26:12 +02:00
|
|
|
echo " * Copying, not CVS"
|
2005-08-24 18:49:09 +02:00
|
|
|
COPY=1
|
|
|
|
;;
|
2005-09-01 14:30:17 +02:00
|
|
|
a)
|
2005-09-01 17:26:12 +02:00
|
|
|
echo " * Including contrib"
|
2005-09-01 14:30:17 +02:00
|
|
|
ALL=1
|
|
|
|
;;
|
2005-09-08 18:04:34 +02:00
|
|
|
q)
|
|
|
|
echo " * Quick option (skip important bits"
|
|
|
|
QUICK=1
|
|
|
|
;;
|
2005-08-16 14:09:20 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2005-09-08 18:04:34 +02:00
|
|
|
if [ $QUICK = 0 ]
|
2005-09-08 18:32:44 +02:00
|
|
|
then USRMB=400
|
2005-09-08 18:04:34 +02:00
|
|
|
else USRMB=30
|
|
|
|
fi
|
|
|
|
|
|
|
|
USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`"
|
|
|
|
USRSECTS="`expr $USRMB \* 1024 \* 2`"
|
2005-09-11 22:51:07 +02:00
|
|
|
ROOTKB=1400
|
|
|
|
ROOTSECTS="`expr $ROOTKB \* 2`"
|
|
|
|
ROOTBLOCKS="`expr $ROOTKB \* 1024 / $BS`"
|
2005-09-08 18:04:34 +02:00
|
|
|
|
2005-08-24 18:49:09 +02:00
|
|
|
if [ "$COPY" -ne 1 ]
|
|
|
|
then
|
|
|
|
echo "Note: this script wants to do cvs operations, so it's necessary"
|
|
|
|
echo "to have \$CVSROOT set and cvs login done."
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
2005-09-11 22:51:07 +02:00
|
|
|
echo "Warning: I'm going to mkfs $RAM! It has to be at least $ROOTKB KB."
|
2005-08-12 14:34:56 +02:00
|
|
|
echo ""
|
2005-04-21 16:53:53 +02:00
|
|
|
echo "Temporary (sub)partition to use to make the /usr FS image? "
|
2005-08-12 14:34:56 +02:00
|
|
|
echo "I need $USRMB MB. It will be mkfsed!"
|
2005-04-21 16:53:53 +02:00
|
|
|
echo -n "Device: /dev/"
|
|
|
|
read dev || exit 1
|
|
|
|
TMPDISK=/dev/$dev
|
|
|
|
|
|
|
|
if [ -b $TMPDISK ]
|
|
|
|
then :
|
|
|
|
else echo "$TMPDISK is not a block device.."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-08-30 19:26:56 +02:00
|
|
|
echo "Temporary (sub)partition to use for /tmp? "
|
|
|
|
echo "It will be mkfsed!"
|
|
|
|
echo -n "Device: /dev/"
|
|
|
|
read dev || exit 1
|
|
|
|
TMPDISK2=/dev/$dev
|
|
|
|
|
|
|
|
if [ -b $TMPDISK2 ]
|
|
|
|
then :
|
|
|
|
else echo "$TMPDISK2 is not a block device.."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
umount $TMPDISK
|
2005-08-30 19:26:56 +02:00
|
|
|
umount $TMPDISK2
|
2005-04-21 16:53:53 +02:00
|
|
|
umount $RAM
|
|
|
|
|
2005-07-24 03:18:09 +02:00
|
|
|
echo " * Cleanup old files"
|
2005-07-21 10:35:06 +02:00
|
|
|
rm -rf $RELEASEDIR $ISO $IMAGE $ROOTIMAGE $ISOGZ $CDFILES
|
2005-07-24 03:18:09 +02:00
|
|
|
mkdir -p $CDFILES || exit
|
2005-04-21 16:53:53 +02:00
|
|
|
mkdir -p $RELEASEDIR
|
2005-08-12 14:34:56 +02:00
|
|
|
echo " * Zeroing $RAM"
|
|
|
|
dd if=/dev/zero of=$RAM bs=$BS count=$ROOTBLOCKS
|
|
|
|
mkfs -B $BS -b $ROOTBLOCKS $RAM || exit
|
2005-08-30 19:26:56 +02:00
|
|
|
mkfs $TMPDISK2 || exit
|
2005-04-21 16:53:53 +02:00
|
|
|
echo " * mounting $RAM as $RELEASEDIR"
|
|
|
|
mount $RAM $RELEASEDIR || exit
|
2005-05-04 15:47:05 +02:00
|
|
|
mkdir -m 755 $RELEASEDIR/usr
|
|
|
|
mkdir -m 1777 $RELEASEDIR/tmp
|
2005-08-30 19:26:56 +02:00
|
|
|
mount $TMPDISK2 $RELEASEDIR/tmp
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2005-08-12 14:34:56 +02:00
|
|
|
echo " * Zeroing $TMPDISK"
|
2005-09-13 14:25:59 +02:00
|
|
|
dd if=/dev/zero of=$TMPDISK bs=$BS count=$USRBLOCKS
|
2005-08-12 14:34:56 +02:00
|
|
|
mkfs -B $BS -b $USRBLOCKS $TMPDISK || exit
|
|
|
|
echo " * Mounting $TMPDISK as $RELEASEDIR/usr"
|
2005-04-21 16:53:53 +02:00
|
|
|
mount $TMPDISK $RELEASEDIR/usr || exit
|
|
|
|
mkdir -p $RELEASEDIR/tmp
|
|
|
|
mkdir -p $RELEASEDIR/usr/tmp
|
2005-08-24 18:49:09 +02:00
|
|
|
|
2005-09-08 18:32:44 +02:00
|
|
|
if [ $QUICK = 0 ]
|
2005-08-24 18:49:09 +02:00
|
|
|
then
|
2005-09-08 18:04:34 +02:00
|
|
|
echo " * Transfering $COPYITEMS to $RELEASEDIR"
|
|
|
|
( cd / && tar cf - $COPYITEMS ) | ( cd $RELEASEDIR && tar xf - ) || exit 1
|
|
|
|
|
|
|
|
# Make sure compilers and libraries are bin-owned
|
|
|
|
chown -R bin $RELEASEDIR/usr/lib
|
|
|
|
|
|
|
|
if [ "$COPY" -ne 1 ]
|
2005-09-01 14:30:17 +02:00
|
|
|
then
|
2005-09-08 18:04:34 +02:00
|
|
|
echo " * Doing new cvs export"
|
|
|
|
if [ "$ALL" = 0 ]
|
|
|
|
then
|
2005-09-08 19:04:35 +02:00
|
|
|
cvs export -rHEAD src >/dev/null || exit 1
|
|
|
|
srcdir=src
|
2005-09-08 18:04:34 +02:00
|
|
|
# No contrib stuff
|
|
|
|
rm -rf src/contrib
|
2005-09-08 19:04:35 +02:00
|
|
|
echo " * Transfering source to $RELEASEDIR"
|
|
|
|
( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR/usr && mkdir src && cd src && tar xf - )
|
|
|
|
else
|
|
|
|
( cd $RELEASEDIR/usr && mkdir src && cvs export -rHEAD src )
|
2005-09-08 18:04:34 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
( cd .. && make clean )
|
|
|
|
srcdir=/usr/src
|
2005-09-08 19:04:35 +02:00
|
|
|
( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR/usr && mkdir src && cd src && tar xf - )
|
2005-09-01 14:30:17 +02:00
|
|
|
fi
|
2005-08-24 18:49:09 +02:00
|
|
|
|
2005-09-08 18:04:34 +02:00
|
|
|
if [ "$ALL" = 0 ]
|
|
|
|
then echo " * Removing temporary cvs source tree"
|
|
|
|
rm -rf src
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo " * Fixups for owners and modes of dirs and files"
|
|
|
|
chown -R bin $RELEASEDIR/usr/src
|
|
|
|
find $RELEASEDIR/usr/src -type d | xargs chmod 755
|
|
|
|
find $RELEASEDIR/usr/src -type f | xargs chmod 644
|
2005-09-16 14:10:15 +02:00
|
|
|
find $RELEASEDIR/usr/src -name configure | xargs chmod 755
|
2005-09-08 18:04:34 +02:00
|
|
|
# Bug tracking system not for on cd
|
|
|
|
rm -rf $RELEASEDIR/usr/src/doc/bugs
|
|
|
|
|
|
|
|
# Make sure the CD knows it's a CD
|
|
|
|
date >$RELEASEDIR/CD
|
|
|
|
echo " * Chroot build"
|
2005-09-16 14:24:10 +02:00
|
|
|
chroot $RELEASEDIR "/bin/sh -x /usr/src/tools/chrootmake.sh" || exit 1
|
2005-09-08 18:04:34 +02:00
|
|
|
echo " * Chroot build done"
|
|
|
|
# The build process leaves some file in src as root.
|
2005-09-13 00:08:15 +02:00
|
|
|
chown -R bin $RELEASEDIR/usr/src*
|
2005-09-08 18:04:34 +02:00
|
|
|
cp issue.install $RELEASEDIR/etc/issue
|
2005-09-01 14:30:17 +02:00
|
|
|
|
2005-09-08 18:04:34 +02:00
|
|
|
if [ "$HDEMU" -ne 0 ]; then hdemu_root_changes; fi
|
|
|
|
|
|
|
|
echo "Temporary filesystems still mounted. Make changes, or press RETURN"
|
|
|
|
echo -n "to continue making the image.."
|
|
|
|
read xyzzy
|
2005-09-01 17:26:12 +02:00
|
|
|
fi
|
|
|
|
|
2005-09-12 17:44:05 +02:00
|
|
|
echo $version_pretty >$RELEASEDIR/etc/version
|
2005-09-09 18:05:23 +02:00
|
|
|
echo " * Counting files"
|
2005-09-12 17:44:05 +02:00
|
|
|
df $TMPDISK | tail -1 | awk '{ print $4 }' >$RELEASEDIR/.usrkb
|
|
|
|
du -s $RELEASEDIR/usr/src.* | awk '{ t += $1 } END { print t }' >$RELEASEDIR/.extrasrckb
|
|
|
|
( for d in $RELEASEDIR/usr/src.*; do find $d; done) | wc -l >$RELEASEDIR/.extrasrcfiles
|
2005-09-09 18:05:23 +02:00
|
|
|
find $RELEASEDIR/usr | wc -l >$RELEASEDIR/.usrfiles
|
|
|
|
find $RELEASEDIR -xdev | wc -l >$RELEASEDIR/.rootfiles
|
2005-04-21 16:53:53 +02:00
|
|
|
umount $TMPDISK || exit
|
2005-08-30 19:40:08 +02:00
|
|
|
umount $TMPDISK2 || exit
|
2005-04-21 16:53:53 +02:00
|
|
|
umount $RAM || exit
|
|
|
|
(cd ../boot && make)
|
2005-09-08 20:06:03 +02:00
|
|
|
(cd .. && make depend)
|
2005-04-21 16:53:53 +02:00
|
|
|
make image || exit 1
|
2005-08-29 21:59:58 +02:00
|
|
|
cp image image_big
|
|
|
|
make clean
|
|
|
|
make image_small || exit 1
|
2005-08-30 19:49:40 +02:00
|
|
|
dd if=$RAM of=$ROOTIMAGE bs=$BS count=$ROOTBLOCKS
|
2005-08-29 21:59:58 +02:00
|
|
|
# Prepare image and image_small for cdfdboot
|
|
|
|
cp image_big image
|
2005-05-03 17:37:34 +02:00
|
|
|
sh mkboot cdfdboot
|
2005-08-26 10:57:58 +02:00
|
|
|
cp $IMAGE $CDFILES/bootflop.img
|
2005-07-21 10:35:06 +02:00
|
|
|
cp release/cd/* $CDFILES
|
2005-08-16 14:09:20 +02:00
|
|
|
|
|
|
|
h_opt=
|
|
|
|
bootimage=$IMAGE
|
|
|
|
if [ "$HDEMU" -ne 0 ]; then
|
|
|
|
make_hdimage
|
|
|
|
h_opt='-h'
|
|
|
|
bootimage=hdimage
|
|
|
|
fi
|
|
|
|
writeisofs -l MINIX -b $bootimage $h_opt $CDFILES $ISO || exit 1
|
|
|
|
|
|
|
|
if [ "$HDEMU" -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "Appending Minix root and usr filesystem"
|
2005-09-08 18:04:34 +02:00
|
|
|
# Pad ISO out to cylinder boundary
|
2005-09-07 12:07:05 +02:00
|
|
|
isobytes=`stat -size $ISO`
|
2005-09-08 18:04:34 +02:00
|
|
|
isosects=`expr $isobytes / 512`
|
|
|
|
isopad=`expr $secs - '(' $isosects % $secs ')'`
|
|
|
|
dd if=/dev/zero count=$isopad >>$ISO
|
|
|
|
# number of sectors
|
|
|
|
isosects=`expr $isosects + $isopad`
|
|
|
|
( cat $ISO $ROOTIMAGE ; dd if=$TMPDISK bs=$BS count=$USRBLOCKS ) >m
|
2005-09-07 12:07:05 +02:00
|
|
|
mv m $ISO
|
|
|
|
# Make CD partition table
|
|
|
|
installboot -m $ISO /usr/mdec/masterboot
|
2005-09-08 18:04:34 +02:00
|
|
|
# Make sure there is no hole..! Otherwise the ISO format is
|
|
|
|
# unreadable.
|
|
|
|
partition -m $ISO 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
|
2005-08-16 14:09:20 +02:00
|
|
|
fi
|
2005-09-07 12:07:05 +02:00
|
|
|
echo " * gzipping $ISO"
|
|
|
|
gzip -9 $ISO
|
2005-06-17 18:28:36 +02:00
|
|
|
ls -al $ISOGZ
|
2005-09-07 12:07:05 +02:00
|
|
|
|