3 # Module: mkisoimages.sh
4 # Author: Jordan K Hubbard
9 # This script is used by release/Makefile to build the (optional) ISO images
10 # for a FreeBSD release. It is considered architecture dependent since each
11 # platform has a slightly unique way of making bootable CDs. This script
12 # is also allowed to generate any number of images since that is more of
13 # publishing decision than anything else.
17 # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
19 # Where -b is passed if the ISO image should be made "bootable" by
20 # whatever standards this architecture supports (may be unsupported),
21 # image-label is the ISO image label, image-name is the filename of the
22 # resulting ISO image, base-bits-dir contains the image contents and
23 # extra-bits-dir, if provided, contains additional files to be merged
24 # into base-bits-dir as part of making the image.
28 if [ "x$1" = "x-b" ]; then
36 echo usage: $0 '[-b] label iso-name base-dir [extra-dir]'
46 MKISOFS_PORT=/usr/ports/sysutils/${MKISOFS_PKG}
48 if ! which ${MKISOFS} > /dev/null; then
49 echo -n "${MKISOFS}(8) does not exist: "
50 if [ -f ${MKISOFS_PORT}/Makefile ]; then
51 echo building the port...
52 if ! (cd ${MKISOFS_PORT} && make install BATCH=yes && make clean); then
53 echo "error: cannot build ${MKISOFS}(8). Bailing out..."
57 echo fetching the package...
58 if ! pkg_add -r ${MKISOFS_PKG}; then
59 echo "error: cannot fetch ${MKISOFS}(8). Bailing out..."
67 # To create a bootable CD under EFI, the boot image should be an EFI
69 if [ $bootable = yes ]; then
72 dd if=/dev/zero of=$BASE/$EFIPART count=$EFISZ
73 md=`mdconfig -a -t vnode -f $BASE/$EFIPART`
74 newfs_msdos -F 12 -S 512 -h 4 -o 0 -s $EFISZ -u 16 $md
75 mount -t msdosfs /dev/$md $MNT
76 mkdir -p $MNT/efi/boot $MNT/boot $MNT/boot/kernel
77 cp -R $BASE/boot/defaults $MNT/boot
78 cp $BASE/boot/kernel/kernel $MNT/boot/kernel
79 cp $BASE/boot/kernel/ispfw.ko $MNT/boot/kernel
80 cp $BASE/boot/device.hints $MNT/boot
81 cp $BASE/boot/loader.* $MNT/boot
82 cp $BASE/boot/mfsroot.gz $MNT/boot
83 cp $BASE/boot/support.4th $MNT/boot
84 mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi
87 BOOTOPTS="-b $EFIPART -no-emul-boot"
92 publisher="The FreeBSD Project. http://www.freebsd.org/"
94 $MKISOFS $BOOTOPTS -r -J -V $LABEL -publisher "$publisher" -o $NAME $BASE $*