render / rpms / edk2

Forked from rpms/edk2 2 months ago
Clone

Blame build-iso.sh

Gerd Hoffmann 46ac25
#!/bin/sh
Gerd Hoffmann 46ac25
Gerd Hoffmann 46ac25
# args
Gerd Hoffmann 46ac25
dir="$1"
Gerd Hoffmann 46ac25
Gerd Hoffmann 46ac25
# cfg
Gerd Hoffmann 46ac25
shell="$dir/Shell.efi"
Gerd Hoffmann 46ac25
enroll="$dir/EnrollDefaultKeys.efi"
Gerd Hoffmann 46ac25
vfat="$dir/shell.img"
Gerd Hoffmann 46ac25
iso="$dir/UefiShell.iso"
Gerd Hoffmann 46ac25
export MTOOLS_SKIP_CHECK=1
Gerd Hoffmann 46ac25
Gerd Hoffmann 46ac25
# calc size
Gerd Hoffmann 46ac25
s1=$(stat --format=%s -- $shell)
Gerd Hoffmann 46ac25
s2=$(stat --format=%s -- $enroll)
Gerd Hoffmann 46ac25
size=$(( ($s1 + $s2) * 11 / 10 ))
Gerd Hoffmann 46ac25
set -x
Gerd Hoffmann 46ac25
Gerd Hoffmann 46ac25
# create non-partitioned FAT image
Gerd Hoffmann 46ac25
/usr/sbin/mkdosfs -C "$vfat" -n UEFI_SHELL -- "$(( $size / 1024 ))"
Gerd Hoffmann 46ac25
mmd	-i "$vfat"			::efi
Gerd Hoffmann 46ac25
mmd	-i "$vfat"			::efi/boot
Gerd Hoffmann 46ac25
mcopy	-i "$vfat"	"$shell"	::efi/boot/bootx64.efi
Gerd Hoffmann 46ac25
mcopy	-i "$vfat"	"$enroll"	::
Gerd Hoffmann 46ac25
#mdir	-i "$vfat"	-/		::
Gerd Hoffmann 46ac25
Gerd Hoffmann 46ac25
# build ISO with FAT image file as El Torito EFI boot image
Gerd Hoffmann 46ac25
genisoimage -input-charset ASCII -J -rational-rock \
Gerd Hoffmann 46ac25
	-efi-boot "${vfat##*/}" -no-emul-boot -o "$iso" -- "$vfat"
Gerd Hoffmann 46ac25
rm -f "$vfat"