2002-11-02 20:31:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Module: mkisoimages.sh
|
|
|
|
# Author: Jordan K Hubbard
|
|
|
|
# Date: 22 June 2001
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# This script is used by release/Makefile to build the (optional) ISO images
|
|
|
|
# for a FreeBSD release. It is considered architecture dependent since each
|
|
|
|
# platform has a slightly unique way of making bootable CDs. This script
|
|
|
|
# is also allowed to generate any number of images since that is more of
|
|
|
|
# publishing decision than anything else.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
|
|
|
|
#
|
|
|
|
# Where -b is passed if the ISO image should be made "bootable" by
|
|
|
|
# whatever standards this architecture supports (may be unsupported),
|
|
|
|
# image-label is the ISO image label, image-name is the filename of the
|
|
|
|
# resulting ISO image, base-bits-dir contains the image contents and
|
|
|
|
# extra-bits-dir, if provided, contains additional files to be merged
|
|
|
|
# into base-bits-dir as part of making the image.
|
|
|
|
|
2002-11-10 09:12:42 +00:00
|
|
|
set -e
|
|
|
|
|
2002-11-02 20:31:54 +00:00
|
|
|
if [ "x$1" = "x-b" ]; then
|
2002-11-10 09:12:42 +00:00
|
|
|
bootable=yes
|
|
|
|
shift
|
2002-11-02 20:31:54 +00:00
|
|
|
else
|
2002-11-10 09:12:42 +00:00
|
|
|
bootable=no
|
2002-11-02 20:31:54 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# -lt 3 ]; then
|
2002-11-10 09:12:42 +00:00
|
|
|
echo usage: $0 '[-b] label iso-name base-dir [extra-dir]'
|
|
|
|
exit 1
|
2002-11-02 20:31:54 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-08 21:13:58 +00:00
|
|
|
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
|
2002-11-10 09:12:42 +00:00
|
|
|
NAME=$1; shift
|
|
|
|
BASE=$1; shift
|
|
|
|
|
|
|
|
EFIPART=efipart.sys
|
|
|
|
|
|
|
|
# To create a bootable CD under EFI, the boot image should be an EFI
|
2003-08-03 15:06:00 +00:00
|
|
|
# system partition.
|
2002-11-10 09:12:42 +00:00
|
|
|
if [ $bootable = yes ]; then
|
2010-05-28 17:50:35 +00:00
|
|
|
EFISZ=65536
|
2003-07-29 18:29:44 +00:00
|
|
|
MNT=/mnt
|
2011-06-06 01:52:15 +00:00
|
|
|
dd if=/dev/zero of=$EFIPART count=$EFISZ
|
|
|
|
md=`mdconfig -a -t vnode -f $EFIPART`
|
2003-07-29 18:29:44 +00:00
|
|
|
newfs_msdos -F 12 -S 512 -h 4 -o 0 -s $EFISZ -u 16 $md
|
2003-08-03 15:06:00 +00:00
|
|
|
mount -t msdosfs /dev/$md $MNT
|
2003-07-29 18:29:44 +00:00
|
|
|
mkdir -p $MNT/efi/boot $MNT/boot $MNT/boot/kernel
|
|
|
|
cp -R $BASE/boot/defaults $MNT/boot
|
|
|
|
cp $BASE/boot/kernel/kernel $MNT/boot/kernel
|
2011-06-06 01:52:15 +00:00
|
|
|
if [ -s $BASE/boot/kernel/ispfw.ko ]; then
|
|
|
|
cp $BASE/boot/kernel/ispfw.ko $MNT/boot/kernel
|
|
|
|
fi
|
2003-07-29 18:29:44 +00:00
|
|
|
cp $BASE/boot/device.hints $MNT/boot
|
|
|
|
cp $BASE/boot/loader.* $MNT/boot
|
2011-06-06 01:52:15 +00:00
|
|
|
if [ -s $BASE/boot/mfsroot.gz ]; then
|
|
|
|
cp $BASE/boot/mfsroot.gz $MNT/boot
|
|
|
|
fi
|
2013-01-12 23:44:13 +00:00
|
|
|
cp $BASE/boot/color.4th $MNT/boot
|
2003-07-29 18:29:44 +00:00
|
|
|
cp $BASE/boot/support.4th $MNT/boot
|
2011-11-06 21:57:12 +00:00
|
|
|
cp $BASE/boot/check-password.4th $MNT/boot
|
|
|
|
cp $BASE/boot/screen.4th $MNT/boot
|
2003-07-29 18:29:44 +00:00
|
|
|
mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi
|
2013-08-03 20:14:29 +00:00
|
|
|
echo kern.cam.boot_delay=\"3000\" >> $MNT/boot/loader.conf
|
|
|
|
echo vfs.root.mountfrom=\"cd9660:iso9660/$LABEL\" >> $MNT/boot/loader.conf
|
2003-07-29 18:29:44 +00:00
|
|
|
umount $MNT
|
|
|
|
mdconfig -d -u $md
|
2011-06-06 01:52:15 +00:00
|
|
|
BOOTOPTS="-o bootimage=i386;$EFIPART -o no-emul-boot"
|
2004-08-10 05:43:40 +00:00
|
|
|
else
|
|
|
|
BOOTOPTS=""
|
2002-11-10 09:12:42 +00:00
|
|
|
fi
|
2002-11-02 20:31:54 +00:00
|
|
|
|
2013-02-03 10:26:24 +00:00
|
|
|
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
|
2011-06-06 18:25:11 +00:00
|
|
|
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab
|
2013-02-03 10:26:24 +00:00
|
|
|
makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $BASE $*
|
2011-06-06 18:25:11 +00:00
|
|
|
rm $BASE/etc/fstab
|
2011-06-06 01:52:15 +00:00
|
|
|
rm -f $EFIPART
|
2002-11-10 09:12:42 +00:00
|
|
|
exit 0
|