Changeset View
Changeset View
Standalone View
Standalone View
head/tools/boot/install-boot.sh
Show All 37 Lines | case ${TARGET:-$(uname -m)} in | ||||
arm64) echo bootaa64 ;; | arm64) echo bootaa64 ;; | ||||
i386) echo bootia32 ;; | i386) echo bootia32 ;; | ||||
arm) echo bootarm ;; | arm) echo bootarm ;; | ||||
*) die "machine type $(uname -m) doesn't support UEFI" ;; | *) die "machine type $(uname -m) doesn't support UEFI" ;; | ||||
esac | esac | ||||
} | } | ||||
make_esp_file() { | make_esp_file() { | ||||
local file sizekb loader device mntpt fatbits efibootname | local file sizekb loader device stagedir fatbits efibootname | ||||
file=$1 | file=$1 | ||||
sizekb=$2 | sizekb=$2 | ||||
loader=$3 | loader=$3 | ||||
if [ "$sizekb" -ge "$fat32min" ]; then | if [ "$sizekb" -ge "$fat32min" ]; then | ||||
fatbits=32 | fatbits=32 | ||||
elif [ "$sizekb" -ge "$fat16min" ]; then | elif [ "$sizekb" -ge "$fat16min" ]; then | ||||
fatbits=16 | fatbits=16 | ||||
else | else | ||||
fatbits=12 | fatbits=12 | ||||
fi | fi | ||||
dd if=/dev/zero of="${file}" bs=1k count="${sizekb}" | stagedir=$(mktemp -d /tmp/stand-test.XXXXXX) | ||||
device=$(mdconfig -a -t vnode -f "${file}") | mkdir -p "${stagedir}/EFI/BOOT" | ||||
newfs_msdos -F "${fatbits}" -c 1 -L EFISYS "/dev/${device}" > /dev/null 2>&1 | |||||
mntpt=$(mktemp -d /tmp/stand-test.XXXXXX) | |||||
mount -t msdosfs "/dev/${device}" "${mntpt}" | |||||
mkdir -p "${mntpt}/EFI/BOOT" | |||||
efibootname=$(get_uefi_bootname) | efibootname=$(get_uefi_bootname) | ||||
cp "${loader}" "${mntpt}/EFI/BOOT/${efibootname}.efi" | cp "${loader}" "${stagedir}/EFI/BOOT/${efibootname}.efi" | ||||
umount "${mntpt}" | makefs -t msdos \ | ||||
rmdir "${mntpt}" | -o fat_type=${fatbits} \ | ||||
mdconfig -d -u "${device}" | -o sectors_per_cluster=1 \ | ||||
-o volume_label=EFISYS \ | |||||
-s ${sizekb}k \ | |||||
"${file}" "${stagedir}" | |||||
rm -rf "${stagedir}" | |||||
} | } | ||||
make_esp_device() { | make_esp_device() { | ||||
local dev file mntpt fstype efibootname kbfree loadersize efibootfile | local dev file mntpt fstype efibootname kbfree loadersize efibootfile | ||||
local isboot1 existingbootentryloaderfile bootorder bootentry | local isboot1 existingbootentryloaderfile bootorder bootentry | ||||
# ESP device node | # ESP device node | ||||
dev=$1 | dev=$1 | ||||
▲ Show 20 Lines • Show All 364 Lines • Show Last 20 Lines |