aboutsummaryrefslogtreecommitdiff
path: root/release/amd64
diff options
context:
space:
mode:
authorBenno Rice <benno@FreeBSD.org>2018-04-17 22:33:41 +0000
committerBenno Rice <benno@FreeBSD.org>2018-04-17 22:33:41 +0000
commit0279ac04edcf87a92216a80acc7be76a2ff51957 (patch)
treeae31c5e933f76df919e85474e3f8b7992dd4e935 /release/amd64
parentedba22b0fb9a515a5a75ea6cf95a6679082131ca (diff)
downloadsrc-0279ac04edcf87a92216a80acc7be76a2ff51957.tar.gz
src-0279ac04edcf87a92216a80acc7be76a2ff51957.zip
Generate hybrid ISO images for amd64.
This keeps the existing El Torito entries for BIOS and UEFI boot code and adds a GPT in the ISO image's System Area containing boot code for BIOS that will load /boot/loader from the ISO filesystem and execute it. We then use etdump to find the EFI System Partition image in the El Torito catalog and add an entry to the GPT that allows EFI to find it. Reviewed by: gjb, imp Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D15051
Notes
Notes: svn path=/head/; revision=332661
Diffstat (limited to 'release/amd64')
-rw-r--r--release/amd64/mkisoimages.sh28
1 files changed, 27 insertions, 1 deletions
diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh
index b09e34de491b..9ebc3e3430d9 100644
--- a/release/amd64/mkisoimages.sh
+++ b/release/amd64/mkisoimages.sh
@@ -38,7 +38,7 @@ if [ "$1" = "-b" ]; then
umount efi
rmdir efi
mdconfig -d -u $device
- bootable="-o bootimage=i386;efiboot.img -o no-emul-boot -o platformid=efi $bootable"
+ bootable="$bootable -o bootimage=i386;efiboot.img -o no-emul-boot -o platformid=efi"
shift
else
@@ -58,3 +58,29 @@ echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
rm -f "$1/etc/fstab"
rm -f efiboot.img
+
+if [ "$bootable" != "" ]; then
+ # Look for the EFI System Partition image we dropped in the ISO image.
+ for entry in `etdump --format shell $NAME`; do
+ eval $entry
+ if [ "$et_platform" = "efi" ]; then
+ espstart=`expr $et_lba \* 2048`
+ espsize=`expr $et_sectors \* 512`
+ espparam="-p efi::$espsize:$espstart"
+ break
+ fi
+ done
+
+ # Create a GPT image containing the partitions we need for hybrid boot.
+ imgsize=`stat -f %z $NAME`
+ mkimg -s gpt \
+ --capacity $imgsize \
+ -b $4/boot/pmbr \
+ $espparam \
+ -p freebsd-boot:=$4/boot/isoboot \
+ -o hybrid.img
+
+ # Drop the PMBR, GPT, and boot code into the System Area of the ISO.
+ dd if=hybrid.img of=$NAME bs=32k count=1 conv=notrunc
+ rm -f hybrid.img
+fi