summaryrefslogtreecommitdiffstats
path: root/release/ia64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2002-11-10 09:12:42 +0000
committermarcel <marcel@FreeBSD.org>2002-11-10 09:12:42 +0000
commit672a8a4c66767928d72d5a124640e33c41ae382a (patch)
treee448a06c77284c66d79a92f9380b904a043a4e14 /release/ia64
parent58ac802ff11ff12e3450b14a22b63e751aec1f2e (diff)
downloadFreeBSD-src-672a8a4c66767928d72d5a124640e33c41ae382a.zip
FreeBSD-src-672a8a4c66767928d72d5a124640e33c41ae382a.tar.gz
Make bootable ISO images by either 1) extacting the EFI partition
we created for the boot floppy, or 2) construct an EFI partition by copying bits from /boot. The first approach creates a bootable CD image that loads a memory disk and starts sysinstall, the second approach creates a generic bootable CD.
Diffstat (limited to 'release/ia64')
-rw-r--r--release/ia64/mkisoimages.sh94
1 files changed, 63 insertions, 31 deletions
diff --git a/release/ia64/mkisoimages.sh b/release/ia64/mkisoimages.sh
index 437753b..cca79ce 100644
--- a/release/ia64/mkisoimages.sh
+++ b/release/ia64/mkisoimages.sh
@@ -23,48 +23,80 @@
# extra-bits-dir, if provided, contains additional files to be merged
# into base-bits-dir as part of making the image.
-IMG=/tmp/bootfs
-LOADER=/boot/loader
-MNT=/mnt
+set -e
+
+# The hackery function is to help with the development of the release
+# process. It's not intended to be an integral part of it. JFYI...
+hackery() {
+ echo "Sorry, no hackery today and you're out of milk too"
+ exit 2
+}
+
+MKISOFS_PORT=/usr/ports/sysutils/mkisofs
if [ "x$1" = "x-b" ]; then
- dd if=/dev/zero of=${IMG} bs=512 count=1024
- MD=`mdconfig -a -t vnode -f ${IMG}`
- disklabel -Brw ${MD} auto
- newfs /dev/${MD}c
- mount /dev/${MD}c ${MNT}
- mkdir ${MNT}/boot
- cp ${LOADER} ${MNT}/boot
- umount ${MNT}
- mdconfig -d -u ${MD#md}
- bootable="-B ,,,,${IMG}"
- shift
+ bootable=yes
+ shift
else
- bootable=""
+ bootable=no
fi
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
- rm -f ${IMG}
- exit 1
+ echo usage: $0 '[-b] label iso-name base-dir [extra-dir]'
+ exit 1
fi
-type mkisofs 2>&1 | grep " is " >/dev/null
-if [ $? -ne 0 ]; then
- echo The mkisofs port is not installed. Trying to get it now.
+BOOTOPTS=""
+LABEL=$1; shift
+NAME=$1; shift
+BASE=$1; shift
+
+if ! which mkisofs; then
+ echo 'mkisofs(8) does not exist. Fetching the package...'
+ if ! pkg_add -r mkisofs; then
if [ -f /usr/ports/sysutils/mkisofs/Makefile ]; then
- cd /usr/ports/sysutils/mkisofs && make install && make clean
+ echo "Don't worry; building the port..."
+ if ! (cd $MKISOFS_PORT && make install && make clean); then
+ echo "Worry; reverting to hackery..."
+ hackery
+ fi
else
- if ! pkg_add -r mkisofs; then
- echo "Could not get it via pkg_add - please go install this"
- echo "from the ports collection and run this script again."
- exit 2
- fi
+ echo "Ports not present. Reverting to hackery..."
+ hackery
fi
+ fi
fi
-LABEL=$1; shift
-NAME=$1; shift
+EFIPART=efipart.sys
+
+# To create a bootable CD under EFI, the boot image should be an EFI
+# system partition. Since we already made that on the boot floppy,
+# we sneakily extract that.
+if [ $bootable = yes ]; then
+ if [ -f $BASE/floppies/boot.flp ]; then
+ md=`mdconfig -a -t vnode -f $BASE/floppies/boot.flp`
+ dd if=/dev/${md}p1 of=$BASE/$EFIPART
+ mdconfig -d -u $md
+ else
+ EFISZ=10240
+ MNT=/mnt
+ dd if=/dev/zero of=$BASE/$EFIPART count=$EFISZ
+ md=`mdconfig -a -t vnode -f $BASE/$EFIPART`
+ newfs_msdos -F 12 -S 512 -h 4 -o 0 -s $EFISZ -u 16 $md
+ mount -t msdos /dev/$md $MNT
+ mkdir -p $MNT/efi/boot $MNT/boot $MNT/boot/kernel
+ cp -R $BASE/boot/defaults $MNT/boot
+ cp $BASE/boot/kernel/kernel $MNT/boot/kernel
+ cp $BASE/boot/device.hints $MNT/boot
+ cp $BASE/boot/loader.* $MNT/boot
+ cp $BASE/boot/support.4th $MNT/boot
+ mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi
+ umount $MNT
+ mdconfig -d -u $md
+ fi
+ BOOTOPTS="-b $EFIPART -no-emul-boot"
+fi
-mkisofs $bootable -r -J -V $LABEL -o $NAME $*
-rm -f ${IMG}
+mkisofs $BOOTOPTS -r -J -V $LABEL -o $NAME $BASE $*
+rm -f $BASE/$EFIPART
+exit 0
OpenPOWER on IntegriCloud