mkisoimages.sh revision 287635
1204076Spjd#!/bin/sh
2204076Spjd#
3204076Spjd# Module: mkisoimages.sh
4204076Spjd# Author: Jordan K Hubbard
5204076Spjd# Date:   22 June 2001
6204076Spjd#
7204076Spjd# $FreeBSD: head/release/amd64/mkisoimages.sh 287635 2015-09-10 22:47:26Z dteske $
8204076Spjd#
9204076Spjd# This script is used by release/Makefile to build the (optional) ISO images
10204076Spjd# for a FreeBSD release.  It is considered architecture dependent since each
11204076Spjd# platform has a slightly unique way of making bootable CDs.  This script
12204076Spjd# is also allowed to generate any number of images since that is more of
13204076Spjd# publishing decision than anything else.
14204076Spjd#
15204076Spjd# Usage:
16204076Spjd#
17204076Spjd# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
18204076Spjd#
19204076Spjd# Where -b is passed if the ISO image should be made "bootable" by
20204076Spjd# whatever standards this architecture supports (may be unsupported),
21204076Spjd# image-label is the ISO image label, image-name is the filename of the
22204076Spjd# resulting ISO image, base-bits-dir contains the image contents and
23204076Spjd# extra-bits-dir, if provided, contains additional files to be merged
24204076Spjd# into base-bits-dir as part of making the image.
25204076Spjd
26204076Spjdif [ "x$1" = "x-b" ]; then
27204076Spjd	# This is highly x86-centric and will be used directly below.
28204076Spjd	bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
29204076Spjd
30204076Spjd	# Make EFI system partition (should be done with makefs in the future)
31204076Spjd	dd if=/dev/zero of=efiboot.img bs=4k count=100
32204076Spjd	device=`mdconfig -a -t vnode -f efiboot.img`
33204076Spjd	newfs_msdos -F 12 -m 0xf8 /dev/$device
34204076Spjd	mkdir efi
35204076Spjd	mount -t msdosfs /dev/$device efi
36204076Spjd	mkdir -p efi/efi/boot
37204076Spjd	cp "$4/boot/loader.efi" efi/efi/boot/bootx64.efi
38204076Spjd	umount efi
39204076Spjd	rmdir efi
40204076Spjd	mdconfig -d -u $device
41204076Spjd	bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable"
42204076Spjd	
43204076Spjd	shift
44204076Spjdelse
45204076Spjd	bootable=""
46204076Spjdfi
47204076Spjd
48204076Spjdif [ $# -lt 3 ]; then
49204076Spjd	echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
50204076Spjd	exit 1
51204076Spjdfi
52204076Spjd
53204076SpjdLABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
54204076SpjdNAME="$1"; shift
55204076Spjd
56204076Spjdpublisher="The FreeBSD Project.  http://www.FreeBSD.org/"
57204076Spjdecho "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
58204076Spjdmakefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
59204076Spjdrm "$1/etc/fstab"
60204076Spjdrm -f efiboot.img
61204076Spjd