mkisoimages.sh revision 302408
174462Salfred#!/bin/sh
274462Salfred#
3261057Smav# Module: mkisoimages.sh
4261057Smav# Author: Jordan K Hubbard
5261057Smav# Date:   22 June 2001
68870Srgrimes#
7261057Smav# $FreeBSD: stable/11/release/powerpc/mkisoimages.sh 293223 2016-01-05 21:05:17Z gjb $
8261057Smav#
9261057Smav# This script is used by release/Makefile to build the (optional) ISO images
10261057Smav# for a FreeBSD release.  It is considered architecture dependent since each
11261057Smav# platform has a slightly unique way of making bootable CDs.  This script
12261057Smav# is also allowed to generate any number of images since that is more of
13261057Smav# publishing decision than anything else.
14261057Smav#
15261057Smav# Usage:
16261057Smav#
17261057Smav# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
18261057Smav#
19261057Smav# Where -b is passed if the ISO image should be made "bootable" by
20261057Smav# whatever standards this architecture supports (may be unsupported),
21261057Smav# image-label is the ISO image label, image-name is the filename of the
22261057Smav# resulting ISO image, base-bits-dir contains the image contents and
23261057Smav# extra-bits-dir, if provided, contains additional files to be merged
24261057Smav# into base-bits-dir as part of making the image.
25261057Smav
26261057Smavif [ "x$1" = "x-b" ]; then
27261057Smav	# Apple boot code
28261057Smav	uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu"
291901Swollman	bzip2 -d /tmp/hfs-boot-block.bz2
301901Swollman	OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ')
311901Swollman	OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}')
32136581Sobrien	dd if="$4/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
3374462Salfred
341901Swollman	bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot"
3592990Sobrien
3692990Sobrien	# pSeries/PAPR boot code
371901Swollman	mkdir -p "$4/ppc/chrp"
381901Swollman	cp "$4/boot/loader" "$4/ppc/chrp"
391901Swollman	cat > "$4/ppc/bootinfo.txt" << EOF
401901Swollman<chrp-boot>
411901Swollman<description>FreeBSD Install</description>
421901Swollman<os-name>FreeBSD</os-name>
431901Swollman<boot-script>boot &device;:,\ppc\chrp\loader</boot-script>
441901Swollman</chrp-boot>
4574462SalfredEOF
4674462Salfred	bootable="$bootable -o chrp-boot"
4711666Sphk
4811666Sphk	# Playstation 3 boot code
4974462Salfred	echo "FreeBSD Install='/boot/loader.ps3'" > "$4/etc/kboot.conf"
501901Swollman
5174462Salfred	shift
521901Swollmanelse
531901Swollman	bootable=""
541901Swollmanfi
551901Swollman
561901Swollmanif [ $# -lt 3 ]; then
571901Swollman	echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
5874462Salfred	exit 1
5974462Salfredfi
601901Swollman
61173763SjbLABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
6274462SalfredNAME="$1"; shift
6374462Salfred
641901Swollmanpublisher="The FreeBSD Project.  http://www.FreeBSD.org/"
6574462Salfredecho "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
6674462Salfredmakefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
6774462Salfredrm -f "$1/etc/fstab"
681901Swollmanrm -f /tmp/hfs-boot-block
691901Swollmanrm -rf "$1/ppc"
701901Swollman