Date: Wed, 11 Jul 2018 21:53:04 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336213 - head/tools/boot Message-ID: <201807112153.w6BLr4FB073443@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Wed Jul 11 21:53:04 2018 New Revision: 336213 URL: https://svnweb.freebsd.org/changeset/base/336213 Log: Small refactor of install-boot Use newfs_msdos to create the filesystem for the partition requested and use loader.efi instead of boot1.efi. Modified: head/tools/boot/install-boot.sh Modified: head/tools/boot/install-boot.sh ============================================================================== --- head/tools/boot/install-boot.sh Wed Jul 11 20:11:06 2018 (r336212) +++ head/tools/boot/install-boot.sh Wed Jul 11 21:53:04 2018 (r336213) @@ -27,18 +27,33 @@ find-part() { gpart show $dev | tail +2 | awk '$4 == "'$part'" { print $3; }' } -boot_nogeli_gpt_ufs_legacy() { +make_esp() { + local dev dst mntpt + dev=$1 dst=$2 - idx=$(find-part $dev "freebsd-boot") - if [ -z "$idx" ] ; then - die "No freebsd-boot partition found" + newfs_msdos -a 32 /dev/${dev} + mntpt=$(mktemp -d /tmp/stand-test.XXXXXX) + mount -t msdos /dev/${md} ${mntpt} + mkdir -p ${mntpt}/efi/boot + cp ${dst}/boot/loader.efi ${mntpt}/efi/boot/bootx64.efi + umount ${mntpt} + rmdir ${mntpt} +} + +make_esp_mbr() { + dev=$1 + dst=$2 + + s=$(find-part $dev "!239") + if [ -z "$s" ] ; then + die "No ESP slice found" fi - doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev + make_esp /dev/${dev}s${s} ${dst} } -boot_nogeli_gpt_ufs_uefi() { +make_esp_gpt() { dev=$1 dst=$2 @@ -46,9 +61,24 @@ boot_nogeli_gpt_ufs_uefi() { if [ -z "$idx" ] ; then die "No ESP partition found" fi - doit gpart bootcode -p ${efi2} -i $idx $dev + make_esp /dev/${dev}p${idx} ${dst} } +boot_nogeli_gpt_ufs_legacy() { + dev=$1 + dst=$2 + + idx=$(find-part $dev "freebsd-boot") + if [ -z "$idx" ] ; then + die "No freebsd-boot partition found" + fi + doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev +} + +boot_nogeli_gpt_ufs_uefi() { + make_esp_gpt $1 $2 +} + boot_nogeli_gpt_ufs_both() { boot_nogeli_gpt_ufs_legacy $1 $2 $3 boot_nogeli_gpt_ufs_uefi $1 $2 $3 @@ -66,14 +96,7 @@ boot_nogeli_gpt_zfs_legacy() { } boot_nogeli_gpt_zfs_uefi() { - dev=$1 - dst=$2 - - idx=$(find-part $dev "efi") - if [ -z "$idx" ] ; then - die "No ESP partition found" - fi - doit gpart bootcode -p ${efi2} -i $idx $dev + make_esp_gpt $1 $2 } boot_nogeli_gpt_zfs_both() { @@ -94,14 +117,7 @@ boot_nogeli_mbr_ufs_legacy() { } boot_nogeli_mbr_ufs_uefi() { - dev=$1 - dst=$2 - - s=$(find-part ${dev} "!239") - if [ -z "$s" ] ; then - die "No ESP slice found" - fi - doit gpart bootcode -p ${efi2} -i ${s} ${dev} + make_esp_mbr $1 $2 } boot_nogeli_mbr_ufs_both() { @@ -133,14 +149,7 @@ boot_nogeli_mbr_zfs_legacy() { } boot_nogeli_mbr_zfs_uefi() { - dev=$1 - dst=$2 - - s=$(find-part $dev "!239") - if [ -z "$s" ] ; then - die "No ESP slice found" - fi - doit gpart bootcode -p ${efi2} -i ${s} ${dev} + make_eps_mbr $1 $2 } boot_nogeli_mbr_zfs_both() { @@ -245,11 +254,6 @@ dev=$1 gpt0=${DESTDIR}/boot/pmbr gpt2=${DESTDIR}/boot/gptboot gptzfs2=${DESTDIR}/boot/gptzfsboot - -# For gpt + EFI we install the ESP -# XXX This should use newfs or makefs, but it doesn't yet -efi1=${DESTDIR}/boot/boot1.efi -efi2=${DESTDIR}/boot/boot1.efifat # For MBR, we have lots of choices, but select mbr, boot0 has issues with UEFI mbr0=${DESTDIR}/boot/mbr
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807112153.w6BLr4FB073443>