mkisoimages.sh revision 264995
180183Sjkh#!/bin/sh
280183Sjkh#
380183Sjkh# Module: mkisoimages.sh
480183Sjkh# Author: Jordan K Hubbard
580183Sjkh# Date:   22 June 2001
680183Sjkh#
780183Sjkh# $FreeBSD: head/release/amd64/mkisoimages-uefi.sh 264995 2014-04-27 01:06:02Z nwhitehorn $
880183Sjkh#
980183Sjkh# This script is used by release/Makefile to build the (optional) ISO images
1080183Sjkh# for a FreeBSD release.  It is considered architecture dependent since each
1180183Sjkh# platform has a slightly unique way of making bootable CDs.  This script
1280183Sjkh# is also allowed to generate any number of images since that is more of
1380183Sjkh# publishing decision than anything else.
1480183Sjkh#
1580183Sjkh# Usage:
1680183Sjkh#
1780183Sjkh# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
1880183Sjkh#
1980183Sjkh# Where -b is passed if the ISO image should be made "bootable" by
2080183Sjkh# whatever standards this architecture supports (may be unsupported),
2180183Sjkh# image-label is the ISO image label, image-name is the filename of the
2280183Sjkh# resulting ISO image, base-bits-dir contains the image contents and
2380183Sjkh# extra-bits-dir, if provided, contains additional files to be merged
2480183Sjkh# into base-bits-dir as part of making the image.
2580183Sjkh
2680183Sjkhif [ "x$1" = "x-b" ]; then
2780183Sjkh	# This is highly x86-centric and will be used directly below.
28221466Snwhitehorn	bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
29264995Snwhitehorn
30264995Snwhitehorn	# Make EFI system partition (should be done with makefs in the future)
31264995Snwhitehorn	dd if=/dev/zero of=efiboot.img bs=4k count=100
32264995Snwhitehorn	device=`mdconfig -a -t vnode -f efiboot.img`
33264995Snwhitehorn	newfs_msdos -F 12 -m 0xf8 /dev/$device
34264995Snwhitehorn	mkdir efi
35264995Snwhitehorn	mount -t msdosfs /dev/$device efi
36264995Snwhitehorn	mkdir -p efi/efi/boot
37264995Snwhitehorn	cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi
38264995Snwhitehorn	umount efi
39264995Snwhitehorn	rmdir efi
40264995Snwhitehorn	mdconfig -d -u $device
41264995Snwhitehorn	bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable"
42264995Snwhitehorn	
4380183Sjkh	shift
4480183Sjkhelse
4580183Sjkh	bootable=""
4680183Sjkhfi
4780183Sjkh
4880183Sjkhif [ $# -lt 3 ]; then
4980183Sjkh	echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
5080183Sjkh	exit 1
5180183Sjkhfi
5280183Sjkh
53245177ShrsLABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
5480183SjkhNAME=$1; shift
5580183Sjkh
56246283Shrspublisher="The FreeBSD Project.  http://www.FreeBSD.org/"
57245177Shrsecho "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
58246283Shrsmakefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
59219856Snwhitehornrm $1/etc/fstab
60264995Snwhitehornrm -f efiboot.img
61