1106356Smarcel#!/bin/sh 2106356Smarcel# 3106356Smarcel# Module: mkisoimages.sh 4106356Smarcel# Author: Jordan K Hubbard 5106356Smarcel# Date: 22 June 2001 6106356Smarcel# 7106356Smarcel# $FreeBSD$ 8106356Smarcel# 9106356Smarcel# This script is used by release/Makefile to build the (optional) ISO images 10106356Smarcel# for a FreeBSD release. It is considered architecture dependent since each 11106356Smarcel# platform has a slightly unique way of making bootable CDs. This script 12106356Smarcel# is also allowed to generate any number of images since that is more of 13106356Smarcel# publishing decision than anything else. 14106356Smarcel# 15106356Smarcel# Usage: 16106356Smarcel# 17106356Smarcel# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] 18106356Smarcel# 19106356Smarcel# Where -b is passed if the ISO image should be made "bootable" by 20106356Smarcel# whatever standards this architecture supports (may be unsupported), 21106356Smarcel# image-label is the ISO image label, image-name is the filename of the 22106356Smarcel# resulting ISO image, base-bits-dir contains the image contents and 23106356Smarcel# extra-bits-dir, if provided, contains additional files to be merged 24106356Smarcel# into base-bits-dir as part of making the image. 25106356Smarcel 26106722Smarcelset -e 27106356Smarcel 28106356Smarcelif [ "x$1" = "x-b" ]; then 29106722Smarcel bootable=yes 30106722Smarcel shift 31106356Smarcelelse 32106722Smarcel bootable=no 33106356Smarcelfi 34106356Smarcel 35106356Smarcelif [ $# -lt 3 ]; then 36106722Smarcel echo usage: $0 '[-b] label iso-name base-dir [extra-dir]' 37106722Smarcel exit 1 38106356Smarcelfi 39106356Smarcel 40245177ShrsLABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift 41106722SmarcelNAME=$1; shift 42106722SmarcelBASE=$1; shift 43106722Smarcel 44106722SmarcelEFIPART=efipart.sys 45106356Smarcel 46106722Smarcel# To create a bootable CD under EFI, the boot image should be an EFI 47118393Sru# system partition. 48106722Smarcelif [ $bootable = yes ]; then 49208622Smarcel EFISZ=65536 50118180Sru MNT=/mnt 51222726Smarcel dd if=/dev/zero of=$EFIPART count=$EFISZ 52222726Smarcel md=`mdconfig -a -t vnode -f $EFIPART` 53118180Sru newfs_msdos -F 12 -S 512 -h 4 -o 0 -s $EFISZ -u 16 $md 54118393Sru mount -t msdosfs /dev/$md $MNT 55118180Sru mkdir -p $MNT/efi/boot $MNT/boot $MNT/boot/kernel 56118180Sru cp -R $BASE/boot/defaults $MNT/boot 57118180Sru cp $BASE/boot/kernel/kernel $MNT/boot/kernel 58222726Smarcel if [ -s $BASE/boot/kernel/ispfw.ko ]; then 59222726Smarcel cp $BASE/boot/kernel/ispfw.ko $MNT/boot/kernel 60222726Smarcel fi 61118180Sru cp $BASE/boot/device.hints $MNT/boot 62118180Sru cp $BASE/boot/loader.* $MNT/boot 63222726Smarcel if [ -s $BASE/boot/mfsroot.gz ]; then 64222726Smarcel cp $BASE/boot/mfsroot.gz $MNT/boot 65222726Smarcel fi 66245347Smarcel cp $BASE/boot/color.4th $MNT/boot 67118180Sru cp $BASE/boot/support.4th $MNT/boot 68227283Smarcel cp $BASE/boot/check-password.4th $MNT/boot 69227283Smarcel cp $BASE/boot/screen.4th $MNT/boot 70118180Sru mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi 71253919Smarcel echo kern.cam.boot_delay=\"3000\" >> $MNT/boot/loader.conf 72253919Smarcel echo vfs.root.mountfrom=\"cd9660:iso9660/$LABEL\" >> $MNT/boot/loader.conf 73118180Sru umount $MNT 74118180Sru mdconfig -d -u $md 75222726Smarcel BOOTOPTS="-o bootimage=i386;$EFIPART -o no-emul-boot" 76133426Smarcelelse 77133426Smarcel BOOTOPTS="" 78106722Smarcelfi 79106722Smarcel 80246283Shrspublisher="The FreeBSD Project. http://www.FreeBSD.org/" 81222766Smarcelecho "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab 82246283Shrsmakefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $BASE $* 83222766Smarcelrm $BASE/etc/fstab 84222726Smarcelrm -f $EFIPART 85106722Smarcelexit 0 86