Changeset View
Changeset View
Standalone View
Standalone View
release/amd64/mkisoimages.sh
Show All 19 Lines | |||||
# whatever standards this architecture supports (may be unsupported), | # whatever standards this architecture supports (may be unsupported), | ||||
# image-label is the ISO image label, image-name is the filename of the | # image-label is the ISO image label, image-name is the filename of the | ||||
# resulting ISO image, base-bits-dir contains the image contents and | # resulting ISO image, base-bits-dir contains the image contents and | ||||
# extra-bits-dir, if provided, contains additional files to be merged | # extra-bits-dir, if provided, contains additional files to be merged | ||||
# into base-bits-dir as part of making the image. | # into base-bits-dir as part of making the image. | ||||
set -e | set -e | ||||
scriptdir=$(dirname $(realpath $0)) | |||||
. ${scriptdir}/../../tools/boot/install-boot.sh | |||||
if [ -z $ETDUMP ]; then | if [ -z $ETDUMP ]; then | ||||
ETDUMP=etdump | ETDUMP=etdump | ||||
fi | fi | ||||
if [ -z $MAKEFS ]; then | if [ -z $MAKEFS ]; then | ||||
MAKEFS=makefs | MAKEFS=makefs | ||||
fi | fi | ||||
if [ -z $MKIMG ]; then | if [ -z $MKIMG ]; then | ||||
MKIMG=mkimg | MKIMG=mkimg | ||||
fi | fi | ||||
if [ "$1" = "-b" ]; then | if [ "$1" = "-b" ]; then | ||||
BASEBITSDIR="$4" | BASEBITSDIR="$4" | ||||
# This is highly x86-centric and will be used directly below. | # This is highly x86-centric and will be used directly below. | ||||
bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot" | bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot" | ||||
# Make EFI system partition (should be done with makefs in the future) | # Make EFI system partition (should be done with makefs in the future) | ||||
dd if=/dev/zero of=efiboot.img bs=4k count=200 | # The ISO file is a special case, in that it only has a maximum of | ||||
device=`mdconfig -a -t vnode -f efiboot.img` | # 800 KB available for the boot code. So make an 800 KB ESP | ||||
newfs_msdos -F 12 -m 0xf8 /dev/$device | make_esp_file /tmp/efiboot.img 800 ${BASEBITSDIR}/boot/loader.efi | ||||
mkdir efi | bootable="$bootable -o bootimage=i386;/tmp/efiboot.img -o no-emul-boot -o platformid=efi" | ||||
mount -t msdosfs /dev/$device efi | |||||
mkdir -p efi/efi/boot | |||||
cp "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi | |||||
umount efi | |||||
rmdir efi | |||||
mdconfig -d -u $device | |||||
bootable="$bootable -o bootimage=i386;efiboot.img -o no-emul-boot -o platformid=efi" | |||||
shift | shift | ||||
else | else | ||||
BASEBITSDIR="$3" | BASEBITSDIR="$3" | ||||
bootable="" | bootable="" | ||||
fi | fi | ||||
if [ $# -lt 3 ]; then | if [ $# -lt 3 ]; then | ||||
echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" | echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift | LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift | ||||
NAME="$1"; shift | NAME="$1"; shift | ||||
publisher="The FreeBSD Project. https://www.FreeBSD.org/" | publisher="The FreeBSD Project. https://www.FreeBSD.org/" | ||||
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" | echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" | ||||
$MAKEFS -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" | $MAKEFS -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" | ||||
rm -f "$BASEBITSDIR/etc/fstab" | rm -f "$BASEBITSDIR/etc/fstab" | ||||
rm -f efiboot.img | rm -f /tmp/efiboot.img | ||||
if [ "$bootable" != "" ]; then | if [ "$bootable" != "" ]; then | ||||
# Look for the EFI System Partition image we dropped in the ISO image. | # Look for the EFI System Partition image we dropped in the ISO image. | ||||
for entry in `$ETDUMP --format shell $NAME`; do | for entry in `$ETDUMP --format shell $NAME`; do | ||||
eval $entry | eval $entry | ||||
if [ "$et_platform" = "efi" ]; then | if [ "$et_platform" = "efi" ]; then | ||||
espstart=`expr $et_lba \* 2048` | espstart=`expr $et_lba \* 2048` | ||||
espsize=`expr $et_sectors \* 512` | espsize=`expr $et_sectors \* 512` | ||||
Show All 18 Lines |