From owner-freebsd-hackers@freebsd.org Tue Jun 4 14:11:03 2019 Return-Path: Delivered-To: freebsd-hackers@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 9469615B1FC3 for ; Tue, 4 Jun 2019 14:11:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 378036AA07 for ; Tue, 4 Jun 2019 14:11:02 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id c11so2887012qkk.8 for ; Tue, 04 Jun 2019 07:11:02 -0700 (PDT) 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=HWd6mdlFVKQU02R192ktO+wr1ULPqtCMG4SCsAgLd0E=; b=ncX5swwWpzEM3h1553gcrSJkgWBfJ2PD6OEGl6LQfNj5qqTlW/4gpZdIR2FXEEVtlC halWdu8TCGgXHDNpdOk3G+XTyCIpL515zM8vaHrq6BCPgM+SzerRWR94LRr7gmPXGKSQ BHMUO+AV5iJ3idkdnEwGNYrBFaTNBJS/HUoyaMdnw0zLeItl4eempM9BxBYpWwihF7zR gjmgotfvcnaYhxaorJ4eeHmQ0JSF9wWt2sRvjNoaY3etX+foImvgyi3pz6b1q7Qc6wkV sDEtppAwEgM53OSSLRKUBjjq6SuPMpDVF+yXK3j3LqRDAUJsYtnFSozJPRNih0b1RGop 9iLw== 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=HWd6mdlFVKQU02R192ktO+wr1ULPqtCMG4SCsAgLd0E=; b=jNSeiZZK1YJEJ337LWxZ6b/AD8gyV1uLcNalOTb9nbMR5biSwcIUNwJrZUlq2e7lGm 7TL5+pcKVfnm+gjZdBaGMXZwP2GIcEg8UooSyAbK3BUdcldYYrXwmwKe2VYCPW+d2JVm fTAD03v+yl1kk9a7/G78uj8N9anqoUEB+1hhmdVoiyzqiedIQcVuwtJo7z0PphbnATwd GvGgY1JfbQbTZ8RIWsq9c1LVF87ruhQbifSwbAocg1mAQtO/78u9eIeExxItv3kKaCVj rCF80YoYc6NLYXJ0+rlEyFnOy+6SDr1Z2IzefS3TiAES2/n9hMr+ippBdd88o++MsrHG MTBw== X-Gm-Message-State: APjAAAVi2mddWb5/jBAn0vY789Kmu/+6qhXgmuKGKgP1IvU3O9gxFSE0 i/tKxO/TdiX5HRI3BttnhpHWklU/DRF1SB+mj7JcBQ4DIyQ= X-Google-Smtp-Source: APXvYqxv07tLw3RGS2hoYKSI9iByfm4IFkQTWvbMxENZX+8ic6pDb+rBvaf49mUCtQOV2Z3vXsjOOcHnxXxAfxYV2/w= X-Received: by 2002:a37:4b48:: with SMTP id y69mr27337561qka.77.1559657461040; Tue, 04 Jun 2019 07:11:01 -0700 (PDT) MIME-Version: 1.0 References: <33262C24-8B1E-4C3D-9E3F-549BD8B9F26D@transactionware.com> In-Reply-To: <33262C24-8B1E-4C3D-9E3F-549BD8B9F26D@transactionware.com> From: Warner Losh Date: Tue, 4 Jun 2019 08:10:49 -0600 Message-ID: Subject: Re: UEFI boot1 vs. GPT bootme/bootonce flags To: Jan Martin Mikkelsen Cc: "freebsd-hackers@freebsd.org" X-Rspamd-Queue-Id: 378036AA07 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=ncX5swwW X-Spamd-Result: default: False [-5.92 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[9.2.7.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)[ALT1.aspmx.l.google.com,aspmx.l.google.com,ALT2.aspmx.l.google.com]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; IP_SCORE(-3.00)[ip: (-9.40), ipnet: 2607:f8b0::/32(-3.24), asn: 15169(-2.29), country: US(-0.06)]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2019 14:11:03 -0000 On Tue, Jun 4, 2019 at 1:06 AM Jan Martin Mikkelsen < janm@transactionware.com> wrote: > Hi, > > The UEFI boot1 loader does not support the GPT bootme/bootonce/bootfailed > flags for selecting which partition to boot. > > Is there a reason for this? > Yes. There's three. First, UEFI provides no way to get to these flags via their block interfaces. Second, the block interfaces are independent, so there was no easy way to know w/o jumping through a bunch of hoops. Third, the UEFI Boot Manager Protocol was championed as being the one-true way to select a boot partition. It's significantly more flexible and reliable than rewriting the partition table from time to time. However, there's significant drawbacks to the UEFI scheme. Vendors suck at not mucking up the UEFI Boot Manager Protocol (I'm looking at you SuperMicro). And the trend in embedded where UEFI has a foothold has been to move away from writable variables at all... Finally, the UEFI Boot Protocol assumes a host + media. There's no media-agnostic way to produce an image with multiple partitions that you ping-pong between (say a recovery USB stick that moves from system to system). So against my better judgement, I've been working on making gptboot.efi. It's not as terrible as I thought it would be, but it shows another issue: loader.efi and boot1.efi process all the partitions they find, but gptboot just does one disk's worth and stops when it successfully boots something: this has required a restructuring of the boot1 code that I started with to rearrange the loops used to find things. An no, the gptboot.efi will not support ZFS, which has its own way to do this outside of UEFI Boot Manager Protocol. If you don't want to wait, there's now a mechanism for loading loader environment variables from a file called \efi\freebsd\loader.env in the ESP that can accomplish much the same thing. Warner