From owner-freebsd-current@freebsd.org Sun Nov 4 23:07:30 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E175810F086E for ; Sun, 4 Nov 2018 23:07:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it1-x133.google.com (mail-it1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 326BB8C226 for ; Sun, 4 Nov 2018 23:07:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it1-x133.google.com with SMTP id t189-v6so6237619itf.1 for ; Sun, 04 Nov 2018 15:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DLxlTrhohhwL49BwLaBakzbuyh2ryIABajULVevZDK8=; b=cL2PFt10fcwuhWj6qoSk+sXU2xhXxRgjrZ1Oq5fz1rn2HLz32FSBGvaVw4ENX5scaE v00NYpDMthoOll2Pd4GV2CjZ7TgOI5OMCEAwpAzF9lNRuNv5kBKSCRafCXafTUYwpPue B08pYAED6v7SowaJg/J/2EQWmCrcBTnEe1fSwRRR+g1cJJxqtNeP2Fgi2p5xO96SvhNC v2NMJ3sDpXJSHe7ZepGdITej36tu5CWL8Y7yNFS+lkafFyB82/1YI7vZaZc9MPjzF78X 5t4fGS2fL1VSEcWGA14UchqvNrTy9nnDbkYto1AI+ACZRLyspzdrKjGEc3OV40uqSzS4 tAWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DLxlTrhohhwL49BwLaBakzbuyh2ryIABajULVevZDK8=; b=U3qOUEKdHxLa1knpU2nOPPagv8hlUPnDynydazt4ac/mvDeAEi4ZZ++cOWHVLp7ZR8 cG55ZiNaDCrGPXu/WlsIGEbS9g5wn3JkqygCki+1xW0G78IyZT3Fp2Qq257FeFVe2os4 aLG4vhMOTcdX6bWmrA/v1UpwTOJHc2z1eZrVeU7C9xkQO0Z/knR1d5nrTlEhYtV3OTHI mwHqTWHxtKgIhrbbQjxlubvf9w6ZvtVcU0xUQ9Gk72v7/vJPcgTjKaaLnRPB9NHI7DiS vTRQvaifHNBHdpyCygWO1miuG735QUMycrIj3bgNRHLUYiCUYGAQ77mveAIq7uB78Mdh OYcA== X-Gm-Message-State: AGRZ1gIfqO+5yTcuFtTf+M5GwO863POpKRJGyTO6LD6n7TOUT2dbdtv8 dAZJxbMkIrlrL1CqnHc0+PhedUh6DeoHo1U/3KLo3cuo X-Google-Smtp-Source: AJdET5eZ94/XOJrdbFynRCK3R2Cihix4dh8i9Rpxy8/pb3/cmGFjTEULbIPDoJ2PEQ9VN9NJ2zk2xPP/MvzqXZEmtTA= X-Received: by 2002:a02:2708:: with SMTP id g8-v6mr17852742jaa.93.1541372848317; Sun, 04 Nov 2018 15:07:28 -0800 (PST) MIME-Version: 1.0 References: <5091656.8gLySxXtyI@photon.int.bluestop.org> In-Reply-To: From: Warner Losh Date: Sun, 4 Nov 2018 16:07:17 -0700 Message-ID: Subject: Re: UEFI: How to go about updating the ESP with loader.efi during installworld To: Allan Jude Cc: FreeBSD Current X-Rspamd-Queue-Id: 326BB8C226 X-Spamd-Result: default: False [-0.43 / 200.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_SHORT(-0.15)[-0.151,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[3.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.27)[ipnet: 2607:f8b0::/32(-0.03), asn: 15169(-1.24), country: US(-0.07)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 23:07:30 -0000 On Sun, Nov 4, 2018 at 2:27 PM Allan Jude wrote: > On 2018-11-04 16:20, Rebecca Cran wrote: > > I'm currently working on creating and updating the ESP (EFI System > Partition) > > for UEFI booting during installation and installworld. > > > > During installation, with my changes it gets mounted on /boot/efi and > loader.efi > > copied into /boot/efi/EFI/FreeBSD and /boot/efi/EFI/BOOT. An entry gets > added to > > /etc/fstab as noauto. > > > > The issue comes during installworld, where we'll need to update the > loader, > > and I'm not sure how we should handle that. > > If NO_ROOT isn't defined, do we just "mount /boot/efi", overwrite the > files then > > unmount it? What should we do if NO_ROOT _is_ defined? > > > > Previous to now, installworld has not updated the boot blocks. You've > had to manually run 'gpart bootcode' to change the boot blocks. > That's not true. It always updated /boot/loader. > However, those boot blocks mostly just loaded /boot/loader, which was > updated by installworld. > > So I can see how this is not directly analogous. > I think you're mistaken. I think this is analogous. It used to be that the boot code was basically unchanging for long periods of time. You can easily load /boot/loader with a FreeBSD 2 era boot2 (well, off a UFS1 partition). However, as things are changing more rapidly and as more functionality has moved into /boot/loader, we need to update it more often. We've moved support for ZFS into it, support for GELI into it, support for LUA and many other things. There's no longer any 'boot blocks' at all to update with gpart. UEFI has eliminated them by moving that functionality into the BIOS itself. Other systems update their files in the ESP when they upgrade. This is no different than that as well. So from an industry perspective, there's a bias towards updating. > I wouldn't depend on the /etc/fstab entry existing. I am not sure I want > installworld randomly fobbing around in my EFI partition. Especially if, > for example, my EFI/BOOT is not FreeBSD, but rEFInd or something. > Yes. It was a huge mistake to *NOT* standardize on this back in the day when UEFI support came in. But we'd install it in both places (both /boot/loader*.efi and in //EFI/FREEBSD/LOADER.EFI), so that would still work with your rEFInd setup. Finally, I have a /dev/efi/esp pseudo label support coded up for geom (along with /dev/efi/boot for the putative root device). There's some issues with it, so I set it aside some time ago to work on other higher priority things. We could assume that if there's a filesystem mounted on /dev/efi/esp, we should update the boot blocks there. We could, by default, mount it as /efi. A weaker test, though one also in keeping with tradition, would be to only install into /efi if it's a directory, and it's also a mount point. that would preserve the status quo and not even need my /dev/efi/esp code so would work out better from a number of assumptions point of view. tl;dr: EFIROOT?=/efi If ${EFIROOT} is a mount point, install loader*.efi there. Warner