From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 372D5C433EF for ; Fri, 21 Jan 2022 19:17:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 599BA81DD6; Fri, 21 Jan 2022 20:17:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CStTAtX9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 06D1A81B53; Fri, 21 Jan 2022 20:17:56 +0100 (CET) Received: from mail-vk1-xa33.google.com (mail-vk1-xa33.google.com [IPv6:2607:f8b0:4864:20::a33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EA74881B53 for ; Fri, 21 Jan 2022 20:17:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa33.google.com with SMTP id l196so3255457vki.5 for ; Fri, 21 Jan 2022 11:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lFubn2tPQJ300txtLyLhfD30BAHJLu1Im2NAfM5rRVg=; b=CStTAtX9joWQrQ+H1CwvglcQnRC5ojW/hHwRE6fHWdVplWgWtRRkevNT/m2nReXOCT FwxyooaWzgQaSZ9gHAVxB3sTLUJYQNWQUrdYf7XUw6ZW1tEH0vTUqVlehtQnLONw1LpM +0ftsTuWWdy7Y9gNmUvHAhe6GPeygqjlc8h9k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lFubn2tPQJ300txtLyLhfD30BAHJLu1Im2NAfM5rRVg=; b=HFO37GC1DQw+1xBRRuE38WPl5J+5J2F/DjZiKj2xSZSMzz7P/DsGKxRSNPTcRoihlU 8EJuWb3ZvyEbhbnwJ4UDTrk9F2z1ATiw4TYQ1/pSDuxOBjvUdeUGx17L82disjZdYamP i7nyxobxfI5qL3Q7B5XvCwQe2kr5fwVAxNEb3UMpHeI6kv9DjhMepiKZCpL5gv4fUxCr qAH9z7cslEpdnjwcVhBztOwdB2F4LsZ9OwwYaUTixVd1KlzLL74ES7xdvloyCmmM2JQt n9QwjxUgBF7nNesrDnpQeYgDwusf3lcU3A4krqSuBCfp0BS9QQ4TzXU38nYPuCKambRF JJfA== X-Gm-Message-State: AOAM532Vt3e/Ijtzl+NoW9BZYlV/ZZdve0/OZixaUNbtSogT79Ofst2i iITKrNvuPCo1WrfXb1PitgTTqbBj/zXkIPe6766qIQ== X-Google-Smtp-Source: ABdhPJztSm/ththC16rHAaIqOgJSFxu4i5mrHEEaDNEzSjrXwssp8MBGa4eC8R7OO+GjF+NBh0OLN6AYEQ/lzvMIvqE= X-Received: by 2002:a1f:2d8a:: with SMTP id t132mr2528715vkt.3.1642792671397; Fri, 21 Jan 2022 11:17:51 -0800 (PST) MIME-Version: 1.0 References: <20220119014315.1938157-1-sjg@chromium.org> <20220119014315.1938157-20-sjg@chromium.org> <28d88952-e1aa-46cd-fd60-ac52cd2ab43b@canonical.com> <20220121150850.GT7004@bill-the-cat> In-Reply-To: From: Simon Glass Date: Fri, 21 Jan 2022 12:17:40 -0700 Message-ID: Subject: Re: [PATCH v3 30/31] bootstd: doc: Add documentation To: Mark Kettenis Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Daniel Schwierzeck , Dennis Gilmore , Steffen Jaeckel , Lukas Auer , Michal Simek , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Mark, On Fri, 21 Jan 2022 at 11:23, Mark Kettenis wrote: > > > From: Simon Glass > > Date: Fri, 21 Jan 2022 09:53:37 -0700 > > > > Hi Mark, > > > > On Fri, 21 Jan 2022 at 09:03, Mark Kettenis wrote: > > > > > > > From: Simon Glass > > > > Date: Fri, 21 Jan 2022 08:20:17 -0700 > > > > > > > > Hi, > > > > > > > > On Fri, 21 Jan 2022 at 08:08, Tom Rini wrote: > > > > > > > > > > On Wed, Jan 19, 2022 at 12:39:03PM +0100, Heinrich Schuchardt wrote: > > > > > > On 1/19/22 02:43, Simon Glass wrote: > > > > > > > Add documentation for this feature, including the commands and full > > > > > > > devicetree bindings. > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > --- > > > > > > > > > > > > > > Changes in v3: > > > > > > > - Update docs for "bootmeths" and "boot_targets" env vars > > > > > > > > > > > > > > MAINTAINERS | 4 + > > > > > > > doc/develop/bootstd.rst | 638 ++++++++++++++++++++++++++ > > > > > > > doc/develop/distro.rst | 3 + > > > > > > > doc/develop/index.rst | 1 + > > > > > > > doc/device-tree-bindings/bootdev.txt | 18 + > > > > > > > doc/device-tree-bindings/bootmeth.txt | 31 ++ > > > > > > > doc/device-tree-bindings/bootstd.txt | 8 + > > > > > > > doc/usage/bootdev.rst | 135 ++++++ > > > > > > > doc/usage/bootflow.rst | 427 +++++++++++++++++ > > > > > > > doc/usage/bootmeth.rst | 108 +++++ > > > > > > > doc/usage/index.rst | 3 + > > > > > > > 11 files changed, 1376 insertions(+) > > > > > > > create mode 100644 doc/develop/bootstd.rst > > > > > > > create mode 100644 doc/device-tree-bindings/bootmeth.txt > > > > > > > create mode 100644 doc/usage/bootdev.rst > > > > > > > create mode 100644 doc/usage/bootflow.rst > > > > > > > create mode 100644 doc/usage/bootmeth.rst > > > > > > > > > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > > > > > > index 8ad70d3d968..c2af8ada3c9 100644 > > > > > > > --- a/MAINTAINERS > > > > > > > +++ b/MAINTAINERS > > > > > > > @@ -669,6 +669,10 @@ F: boot/bootmeth*.c > > > > > > > F: boot/bootstd.c > > > > > > > F: cmd/bootdev.c > > > > > > > F: cmd/bootflow.c > > > > > > > +F: doc/develop/bootstd.rst > > > > > > > +F: doc/usage/bootdev.rst > > > > > > > +F: doc/usage/bootflow.rst > > > > > > > +F: doc/usage/bootmeth.rst > > > > > > > F: drivers/mmc/mmc_bootdev.c > > > > > > > F: include/bootdev.h > > > > > > > F: include/bootflow.h > > > > > > > diff --git a/doc/develop/bootstd.rst b/doc/develop/bootstd.rst > > > > > > > new file mode 100644 > > > > > > > index 00000000000..1b65a806efb > > > > > > > --- /dev/null > > > > > > > +++ b/doc/develop/bootstd.rst > > > > > > > @@ -0,0 +1,638 @@ > > > > > > > +.. SPDX-License-Identifier: GPL-2.0+: > > > > > > > + > > > > > > > +U-Boot Standard Boot > > > > > > > +==================== > > > > > > > + > > > > > > > +Introduction > > > > > > > +------------ > > > > > > > + > > > > > > > +Standard boot provides a built-in way for U-Boot to automatically boot > > > > > > > +an Operating System without custom scripting and other customisation. It > > > > > > > +introduces the following concepts: > > > > > > > + > > > > > > > + - bootdev - a device which can hold or access a distro (e.g. MMC, Ethernet) > > > > > > > + - bootmeth - a method to scan a bootdev to find bootflows (e.g. distro boot) > > > > > > > + - bootflow - a description of how to boot (provided by the distro) > > > > > > > + > > > > > > > +For Linux, the distro (Linux distribution, e.g. Debian, Fedora) is responsible > > > > > > > +for creating a bootflow for each kernel combination that it wants to offer. > > > > > > > > > > > > This gets it completely wrong. There is one standardized boot flow: UEFI. > > > > > > All major distros support this. U-Boot has to offer UEFI booting out of the > > > > > > box. > > > > > > > > > > I want to jump up and down and emphasize this part as well. While I > > > > > believe our UEFI bootmgr is still missing the normal scan code, that's > > > > > something that has been promised to be implemented. And that turns the > > > > > bootcmd for platforms that just want to support modern off the shelf > > > > > distros in to something fairly small. > > > > > > > > Sigh... > > > > > > > > UEFI is a bootflow in this model, one of many. If we don't support the > > > > others, then U-Boot is not U-Boot anymore, it is just EFI Boot. > > > > > > > > If we get EFI bootmgr going, then are you saying you want to disable > > > > everything else? > > > > > > > > You say 'major distros' but there are many that don't use it, > > > > particularly in the embedded space. I'll go out on a limb and say that > > > > the vast majority of embedded devices in the world don't use it. Are > > > > you really saying we should drop support for everything else? Even the > > > > distro stuff supports other options. > > > > > > And U-Boot supports a wide variety of CPUs and some of those don't > > > even have official UEFI support. > > > > > > However, on arm64 (and possibly riscv64) even the embedded folks > > > should seriously consider using the UEFI bootflow. Linux now supports > > > physical address randomization when loaded via the UEFI stub, which is > > > something that can't really be implemented using the legacy boot path. > > > Note that you don't have to use a separate UEFI bootloader as U-Boot > > > can directly boot kernels with the UEFI stub. > > > > 'legacy'? Isn't it just a case of relocating the kernel to a random > > address? I'm pretty sure U-Boot can do that :-) > > The problem is that the legacy boot protocol for the Linux arm64 > kernel requires a 2MB aligned kernel base, which reduces the number of > randomized bits. That also means that virtual addresses are not fully > randomized as the kernel uses large mappings to map itself. My > understanding is that the UEFI stub can relocate the kernel to any 64K > aligned address. I suppose it is possible to add code to achieve the > same thing for the legacy boot path, but I don't think the arm64 > maintainers are really interested in doing that. > > But yes, U-Boot should certainly try to load arm64 kernels at a random > address instead hardcoding the load address ;) This is simply a design decision. Linux wants to be able to do everything in its own tree, hence the decompression code, ALSR, etc. I'm not suggesting we change it, just that it could be done if people wanted it. Another example is x86 kernels. U-Boot supports putting those in a FIT (even an uncompressed 64-bit kernel) which is helpful for signing / verified boot. > > > Re direct boot, the issue seems to me that distros really want to use > > grub. I think a lot of people talk about direct boot, but it doesn't > > seem to be happening? > > I don't think direct boot makes sense for distros. If you want to > support all variations of UEFI firmware you'll need to install your > kernel on a FAT filesystem. And that doesn't work well if you let > your package manager manage the kernel. Using grub is attractive > because x86 users are familliar with it and it offers an interface to > boot different kernels. > > I think direct boot is targeted more at the embedded world or perhaps > virtualized environments. Sounds right. But I keep asking if people have just given up on embedded/custom flows and want U-Boot to just be a UEFI runner? > > > > > Also Heinrich your comment says 'U-Boot has to offer UEFI booting out > > > > of the box'. Which bit of this series is in conflict with that? What > > > > exactly is "completely wrong" ?? Is it just the wording that is > > > > confusing? > > > > > > Possibly. The documentation seems to suggest that OSes have to > > > specify a bootflow for U-Boot. Whereas one of the main advantages of > > > the UEFI bootflow is that this allows OSes not to care whether we're > > > booted by U-Boot, EDK2 or a closed source firmware implementation. I > > > think the docs should say that the bootflow can be customized by an > > > OS, but that in general this isn't necessary. > > > > The definition of a bootflow is pretty broad. In the case of grub, it > > isn't even visible to U-Boot so there is a bootflow ('bootmeth_efi' in > > this series) but no actual file (grub.cfg) is visible to U-Boot other > > than the grub.efi that it boots. But if grub is not used, then the > > bootflow may be a file. > > > > We could perhaps use the next U-Boot contributor call to discuss it. Regards, SImon