From owner-freebsd-stable@freebsd.org Fri Feb 19 21:41:04 2021 Return-Path: Delivered-To: freebsd-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B562753FDF1 for ; Fri, 19 Feb 2021 21:41:04 +0000 (UTC) (envelope-from se@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dj4l44WRtz3MHK; Fri, 19 Feb 2021 21:41:04 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-449.fritz.box (p200300cd5f19c7006033fbb929f29f5c.dip0.t-ipconnect.de [IPv6:2003:cd:5f19:c700:6033:fbb9:29f2:9f5c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id F40D8246F4; Fri, 19 Feb 2021 21:41:03 +0000 (UTC) (envelope-from se@freebsd.org) To: Warner Losh , Greg Rivers Cc: FreeBSD-STABLE Mailing List References: <2027600.x0N0T6uNKo@no.place.like.home> From: Stefan Esser Subject: Re: FreeBSD 13/stable and zpool upgrade Message-ID: <371a184d-21c7-fb16-df26-ff19c6718cdd@freebsd.org> Date: Fri, 19 Feb 2021 22:40:55 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ARGH3UhTQvUf6gHZmHoQy21gVvB69YCS5" X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 21:41:04 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ARGH3UhTQvUf6gHZmHoQy21gVvB69YCS5 Content-Type: multipart/mixed; boundary="RE6kC5ckjMPAlFN5YxdZeWIu99npz7Qgb"; protected-headers="v1" From: Stefan Esser To: Warner Losh , Greg Rivers Cc: FreeBSD-STABLE Mailing List Message-ID: <371a184d-21c7-fb16-df26-ff19c6718cdd@freebsd.org> Subject: Re: FreeBSD 13/stable and zpool upgrade References: <2027600.x0N0T6uNKo@no.place.like.home> In-Reply-To: --RE6kC5ckjMPAlFN5YxdZeWIu99npz7Qgb Content-Type: multipart/mixed; boundary="------------02C30B0CF2875C26057FA7A9" Content-Language: en-US This is a multi-part message in MIME format. --------------02C30B0CF2875C26057FA7A9 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Am 19.02.21 um 22:07 schrieb Warner Losh: >> To avoid confusion and errors, I think a proper boot1.efifat should be= put >> back into the base system so that people don't have to track the above= >> recipe (which is likely to change). >> >=20 > There's no safe way to do this. The old process has been deprecated bec= ause > it is dangerous and inflexible. >=20 > For upgrading from an old-style installation, the new process is actual= ly > fairly simple: >=20 > mount -t msdos /dev/daXsY /mnt > cp /boot/loader.efi /mnt/efi/boot/bootx64.efi > umount /mnt >=20 > Though if you're using eftbootmgr to select things, you'll need to copy= to > efi/freebsd/loader.efi. Different BIOS vendors have a number of differe= nt > bugs that make this trickier than it should be, alas. I have been using the attached script to update book blocks on EFI or GPT ZFS MBR boot disks for quite some time. More partition schemes and boot block types could be supported by extending the covered cases and/or passing the partition type (GPT vs. MBR). Regards, STefan --------------02C30B0CF2875C26057FA7A9 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="update-bootcode" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="update-bootcode" #!/bin/sh MOUNTPOINT=3D/.efi BOOT1=3D/boot/pmbr BOOT2=3D/boot/gptzfsboot BOOTEFI=3D/boot/loader.efi update_gptzfsboot () { disk=3D$1 partname=3D$2 if strings /dev/$partname | grep -q ZFS; then index=3D${partname##*p} gpart bootcode -b $BOOT1 -p $BOOT2 -i $index $disk fi } update_efiboot () { disk=3D$1 partname=3D$2 efidir=3D$MOUNTPOINT/efi/boot umount $MOUNTPOINT 2>/dev/null if mount -t msdos "/dev/$partname" $MOUNTPOINT; then mkdir -p $efidir rm -f $efidir/BOOTx64o.efi mv $efidir/BOOTx64.efi $efidir/BOOTx64o.efi cp $BOOTEFI /.efi/efi/boot/BOOTx64.efi umount $MOUNTPOINT fi } while read line do set - $line if [ "$1" =3D "=3D>" ]; then disk=3D$4 partscheme=3D$5 else partname=3D$3 parttype=3D$4 case $parttype in efi) update_efiboot $disk $partname ;; freebsd-boot) update_gptzfsboot $disk $partname ;; esac fi done <<*EOF $(gpart show -p) *EOF --------------02C30B0CF2875C26057FA7A9-- --RE6kC5ckjMPAlFN5YxdZeWIu99npz7Qgb-- --ARGH3UhTQvUf6gHZmHoQy21gVvB69YCS5 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmAwMGcFAwAAAAAACgkQR+u171r99USH rQgAmJkJw2e/2sNprf2u86K4aXcFkgCua4nt/cMX02D281Lk905tnTj7Z0qNTqa2t92BfcfjlM9q jZz+5Q2wmn7xl/TZnrbxaRYonSMdZBpdTGsc/ru7ra8+oXCLhbiL69ZuTvo29TtFqqCuVOLI/+Mt CzB7d5wmOGsrWU6pyVyrFpXqWxuotfm80A/2qFlK2yQxF/J1Mnw+VhUYUZEXkKUAP0cocE2R27a2 eJQ4buHBvWYUKAQ7Y/PlcgB7XeEhL4CE1E9hw4eCVn7SI4mMqvakwMs9VSolz9PY93gduqvM1Kol 5AMXbgrzfH2Vj5J0slUwzV7v2y7PVfSn7hR71OwKVw== =Bvw0 -----END PGP SIGNATURE----- --ARGH3UhTQvUf6gHZmHoQy21gVvB69YCS5--