From owner-freebsd-hackers@freebsd.org Tue Jun 4 21:04:11 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 9517215BD477 for ; Tue, 4 Jun 2019 21:04:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) (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 AE3BE860BE for ; Tue, 4 Jun 2019 21:04:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x829.google.com with SMTP id u12so15586874qth.3 for ; Tue, 04 Jun 2019 14:04:10 -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=9CypafFYsBX2Rf6KAJweXDD2DW45CpZJKxHTkQ3Y69s=; b=0GF1zMPG0n0VVogt4UZCx61aR4RZ+SYgn07yXo/zpBz0kjE4912HbfQZ5FJhjKbacP X4EsM34uaufnY+M/gkZwaTjRJ5A863eev/DPmUL59oAd4ic2KCGnwcYo0B5p6JXbHk3h lyEi6unL1ZO2VauF6IKbSykRiq5qizc6DlObUMtwsrsWRCa1b9sjMo0XHkLW7RMddDAb 9cackCw4gOLSPx892uYHCWv8l8iHDGrY9uQceITgr4wr+xFQNcGj//q59eTPtIiVkBaP ZCFQVRu/b7uPwpDbmZRS4jSpsLCVfTzTiOi5zhPz7hPo47LrH5UxmZXGHzUvpKYbNZSC 0N2g== 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=9CypafFYsBX2Rf6KAJweXDD2DW45CpZJKxHTkQ3Y69s=; b=jEshWPq0WpVz1cidpmhE7RkFE+vNhTpzFsKEzrPCE/49hDtFimObtk5YXWdjJAQo7X y4SdDKVhR7dhEjbwSqHPN3Kj2s/udGQmf4Y1Tb9Ey9iMSDBQmgjOF95p0xtVvNnJOgbh YrlT/Yo96JHFnrTmj55S5Mb6eScmSh4wrfEV52IKQC4sOAmqqCk8QzLjbSoYm2lG/fGi M3+PKrZz/A+AFKbpTEAu6hAbIXWhIgQTx0HhOiws7YLGB+s3O5IQ92nlzD7KKChAAJDc jQCqaPswqGFXZXCuOkj4/AyO3nsfgYCrt5VfH61T/0BYGRllJidFectTTDw9a52/kX0n RW8g== X-Gm-Message-State: APjAAAWlZZrrTd299fkFhIpC9wZCf1JQgxw2f3bYJhV0lHqjiCvtRDae AgIARf0Rc7Ek4s5DPHZ5oAOyaFeVAihlbeUjUgGIIJebqG8= X-Google-Smtp-Source: APXvYqzCZsA8MYjY+3P0Hab9TWMmlK4Ilwl2V+n2k8yN4y9D90rid3FFmgflzzSnJfOurAtSE9I002Dyxp2h8bNAY9k= X-Received: by 2002:a0c:d604:: with SMTP id c4mr28690934qvj.27.1559682249750; Tue, 04 Jun 2019 14:04:09 -0700 (PDT) MIME-Version: 1.0 References: <33262C24-8B1E-4C3D-9E3F-549BD8B9F26D@transactionware.com> <74732E11-5735-46CB-AA54-2B49F30CB10A@transactionware.com> In-Reply-To: <74732E11-5735-46CB-AA54-2B49F30CB10A@transactionware.com> From: Warner Losh Date: Tue, 4 Jun 2019 15:03:58 -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: AE3BE860BE X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=0GF1zMPG X-Spamd-Result: default: False [-5.98 / 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.96)[-0.963,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.8.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]; 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.01)[ip: (-9.44), ipnet: 2607:f8b0::/32(-3.24), asn: 15169(-2.30), country: US(-0.06)]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 21:04:11 -0000 On Tue, Jun 4, 2019 at 9:40 AM Jan Martin Mikkelsen < janm@transactionware.com> wrote: > > On 4 Jun 2019, at 16:10, Warner Losh wrote: > > > 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/bootfaile= d >> 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 a= t > 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 gptboo= t > 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 t= o > 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 Manage= r > 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 E= SP > that can accomplish much the same thing. > > > OK. > > I am looking at similar situations: Supermicro servers and various > flavours of embedded systems. For some of the newer embedded systems UEFI > is the necessary approach. I am not at all interested in writable variabl= es > in firmware. I=E2=80=99m also not interested in booting from ZFS. > > My question was because I have been reading the efi/boot1 source code and > deciding what to do to duplicate the bootme/bootonce functionality. That > there were lots of hoops to jump through was clear. However, I was coming > to the conclusion that boot1.efi needed to duplicate the functionality of > gptboot, and was getting ready to implement. > > How far have you gone with your gptboot.efi? What=E2=80=99s missing > I have it mostly written at this point. Nailing down going back and forth between handles and different partition numbers. Warner