Author: benno
Date: Tue Apr 17 22:33:41 2018
New Revision: 332661
URL: https://svnweb.freebsd.org/changeset/base/332661

Log:
  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

Modified:
  head/release/amd64/mkisoimages.sh

Modified: head/release/amd64/mkisoimages.sh
==============================================================================
--- head/release/amd64/mkisoimages.sh   Tue Apr 17 22:30:00 2018        
(r332660)
+++ head/release/amd64/mkisoimages.sh   Tue Apr 17 22:33:41 2018        
(r332661)
@@ -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/f
 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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to