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 844CCC433F5 for ; Mon, 4 Apr 2022 05:41:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A08483C91; Mon, 4 Apr 2022 07:40:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=freebsd.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=freebsd.org header.i=@freebsd.org header.b="Tg9o3NCu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80CDF83C0D; Mon, 4 Apr 2022 07:40:52 +0200 (CEST) Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 26DC783B47 for ; Mon, 4 Apr 2022 07:40:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=freebsd.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kevans@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 693458205C for ; Mon, 4 Apr 2022 05:40:30 +0000 (UTC) (envelope-from kevans@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 4KX03y21Rsz3wGg for ; Mon, 4 Apr 2022 05:40:30 +0000 (UTC) (envelope-from kevans@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649050830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WP2Ua1zW9YG3YJ5MEhl8W148tuDamjaguyJdRay8LHc=; b=Tg9o3NCu5+UcxxXg3eljs7g1Kte1cY9qgn27STmHTygdE/wsneH99vCAbN6RdFlqajq6D8 K8fxc6TtGw4FO2qubrgXuWGNVi0gsICL1Ki6DSpj8XVQobq0+Fq4bulWmCsr34t7Lz7T43 VN1I4aflgEFUrp3v6X2EEq+vjvmIE7D2ms/nmJWFUlGjyeXZciWdHd/Txzu5R5dYDIZptP BYHedDnaX2p+43qYNz9/a9WsjfVp5aFpzgJklEhrPWQ1gnvYmuacp6TceyaJixW57d72Mv 7IYUqEa/WGxPS6uLHZGE+IwljH2fXvP1d0JGpULzEZzIFggG1dFK7fSx7YGizA== Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 17C8F2662 for ; Mon, 4 Apr 2022 05:40:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf1-f41.google.com with SMTP id y36so12284145lfa.6 for ; Sun, 03 Apr 2022 22:40:30 -0700 (PDT) X-Gm-Message-State: AOAM532fn7nm4oaLFYE3YGr6vAAwuOOIC1miuQb+ZXDyB5qGC0EXGC2P Wgt8cwALXF4SFwOR/JMEMNzATcmqIvHYViTnp/M= X-Google-Smtp-Source: ABdhPJx+2a8+ZvQyBy+qcBoD6t+wGGZScBmYuQvZVfoo0rmq6vl9HiUyBlhkZdEGBRLRe5VCnT2S/5hSA2vuHIixBYw= X-Received: by 2002:a05:6512:22d3:b0:44a:518d:c23b with SMTP id g19-20020a05651222d300b0044a518dc23bmr21507998lfu.21.1649050828599; Sun, 03 Apr 2022 22:40:28 -0700 (PDT) MIME-Version: 1.0 References: <20210112195842.252946-1-xypron.glpk@gmx.de> <20210112195842.252946-4-xypron.glpk@gmx.de> <7304AC06-9D2D-4F24-8066-F9CF854F7334@gmx.de> In-Reply-To: <7304AC06-9D2D-4F24-8066-F9CF854F7334@gmx.de> From: Kyle Evans Date: Mon, 4 Apr 2022 00:40:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] efi_loader: setting boot device To: Heinrich Schuchardt Cc: Alexander Graf , Joe Hershberger , Simon Glass , Joao Marcos Costa , Richard Genoud , Niel Fourie , u-boot@lists.denx.de Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649050830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WP2Ua1zW9YG3YJ5MEhl8W148tuDamjaguyJdRay8LHc=; b=vnrRJy8AiTEvy5SGaMc0l7l1Rs+XN6UYkfHX6gCmjGw/85GJMQGf6FrnzttCqstlFjhR8b 5MGXP/UStxqpL6suuZC9lAruSOuR/IQDYaH473dqptjcgS3uPkrx4PeqNV6wf/LPygkJHD 6CCl4fyiyHoVwaawhn8EUJ+LudoZo7QwPFnHphX0x9ProrvVKRD85TUElGTAvDDKcX6eS1 wUmStI6nD5wdAbLIl271FoCswMGzz5js4k+HnR2jMtEcG+bGkDuWT1ErdTYgiNa6fW2K1u RXAk3Mka2aJTjUJk8+1/+zAcXlEMdhcYjsiLQi2zRrPzA1phsKJWwKujml5wgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649050830; a=rsa-sha256; cv=none; b=kxgqk1v2LbuKyQfhJMhhw4Fzyjv5YVf80A0XJlGoE9wc2VE4lN1rz1A5bSEOO7VnhCfHFz 9QKw5ttAfodNneylQd4wNtQ0gNuM4JsXTnygsgQmHh6sb6C78gDMi1NzmZZPMo/7/UZvD0 qEqvAxZ9/SzZ4t2yaP43oao0hb5o4n/6SSRXngAzBocz9T/TBE1z1n//TWqwAPd4pJ8LLC gDs9e2W85LoN31fmHJLZ71fQakYWIzDbbrIOuH/W0VKCpSWg65nw2k4RYyvdRgbyfeUNtd 2mMCpXCy5qUt3d4/mjV5uMhtJXMJ0rvq5FIalww7O+iVPigtU1IKQcoOw2kKtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 On Mon, Apr 4, 2022 at 12:09 AM Heinrich Schuchardt wrote: > > Am 3. April 2022 23:08:33 MESZ schrieb Kyle Evans : > > On Tue, Jan 12, 2021 at 1:59 PM Heinrich Schuchardt wrote: > >> > >> Up to now the bootefi command used the last file loaded to determine the > >> boot partition. This has led to errors when the fdt had been loaded from > >> another partition after the EFI binary. > >> > >> Before setting the boot device from a loaded file check if it is a PE-COFF > >> image or a FIT image. > >> > >> For a PE-COFF image remember address and size, boot device and path. > >> > >> For a FIT image remember boot device and path. > >> > >> If the PE-COFF image is overwritten by loading another file, forget it. > >> > >> Do not allow to start an image via bootefi which is not the last loaded > >> PE-COFF image. > >> > > > >Hi, > > > >I'm only a little late on this, but may I ask what the rationale of > >this last part is? I'm afraid there are some real-world use cases > >where a compromise would be great, allowing bootefi to accept a random > >region of memory to boot -- in my case, I have the payload (FreeBSD's > >loader.efi) already in memory when U-Boot starts and it's unclear that > > Could you, please, describe your use case in some more detail. > > Why can't you load loader.efi from the ESP? > I'm explicitly trying to override the loader.efi from ESP, because it's broken and I can't (easily) keep switching it out. This is on Apple's M1, so I can happily inject the new loader.efi from m1n1 (much like the JTAG use-case mentioned in this file) for testing new iterations. > >I can come up with some other way to boot it that doesn't involve a > >lot of backflips. > >My specific suggestion, which I can formally post to the list if you > >don't immediately object, is this: > >https://people.freebsd.org/~kevans/uboot.patch > > > >It basically adds another form: > > > >`bootefi addr [fdt [size]]` > > What should size be used for? > Both EFI binaries and device-trees provide their size in a header field. > Right now it's used because efi_run_image() wants the buffer size to construct the memory-based device path. I'm not familiar enough with U-Boot to know if there's a sensible API for grabbing the size from this PE image in memory.