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 14E78C433EF for ; Sun, 3 Apr 2022 21:09:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6C46D83B34; Sun, 3 Apr 2022 23:08:58 +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="RrIJyffH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7555483868; Sun, 3 Apr 2022 23:08:54 +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 31AA583B34 for ; Sun, 3 Apr 2022 23:08:48 +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 [IPv6:2610:1c1:1:606c::19:1]) (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 C1E2A7F644 for ; Sun, 3 Apr 2022 21:08:46 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 4KWmjV4G50z3q8k for ; Sun, 3 Apr 2022 21:08:46 +0000 (UTC) (envelope-from kevans@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649020126; 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=6fIfRGYA2bK50OVZLEojfKYgja0bkSyIkwo++dpO8YA=; b=RrIJyffHVmKy7AtIBd2EqhjEpzloQXcrzhNB2XQadRiu/+1AZWDbWPZyOQY7LNjAlzTN9z ZU7HK6J5Ck4Zq3xs++NJa3KX2FyWPMJ+MPkT1l3ZYhGAzUg04Nz1jOnL0+CYkfCa/mfjGb TrkB8IVyH9bKm7TAjca1R8Ge7wGGvSzG3WPpz6ml5BEaIr1ktdB0Vf8p4C8LUwbyXfVhJn hD/6uHK63UYxS5uUrYZI7k6j/KGkB9ge14MEGx+nk1tXc/YDkEZa2JlxWpYUB3nRvHLoIr VueNYJSQOYpj4c+nNqr7bUrGDJNtpemp5z7q1jv+PGHjwmht7TfOF795ERqhcg== Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 6D2612DCF7 for ; Sun, 3 Apr 2022 21:08:46 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f173.google.com with SMTP id 17so10548825ljw.8 for ; Sun, 03 Apr 2022 14:08:46 -0700 (PDT) X-Gm-Message-State: AOAM532Dm6dsNe4V4xOvITPj1sGNTnuGatlzNRdiMgXlG5Dcrnq7PNtV 9cuVXGO+v7Tux1sVNbIILq9fs/aFlnxNf5LMx3Y= X-Google-Smtp-Source: ABdhPJxWHnG0doytQMyJeABti77mPWiUK5z6a8MUPmcrI+iWObVo953ShfWdVdSHraqwWAzJnPV83BgLKHGN+ik5d+c= X-Received: by 2002:a2e:9e19:0:b0:247:deb7:cd9f with SMTP id e25-20020a2e9e19000000b00247deb7cd9fmr19097893ljk.261.1649020125089; Sun, 03 Apr 2022 14:08:45 -0700 (PDT) MIME-Version: 1.0 References: <20210112195842.252946-1-xypron.glpk@gmx.de> <20210112195842.252946-4-xypron.glpk@gmx.de> In-Reply-To: <20210112195842.252946-4-xypron.glpk@gmx.de> From: Kyle Evans Date: Sun, 3 Apr 2022 16:08:33 -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=1649020126; 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=6fIfRGYA2bK50OVZLEojfKYgja0bkSyIkwo++dpO8YA=; b=d2BM5bo5N1+rojuMw52oMVzbU12HFG6XsYi8wiTpN0vNjbAFnK9rr08g8n/e7anrKMhO42 Pj0MuNbea2I9u/5/CabsDN304Avvx2+STe+NRUYvpjxpdreLAmNtB/JuPevQQv53Kr19VM dxFRP0ASXKPeHxz2sfroQCZ7i8yHskD03XT2aCnE80A3AzUY/pKxboUzvv7+qtfciDJgax qCTmlzQ2s0WWb6bKeG/i+ItwVltzs520BGjiEOe6RUbcfhBH9uaKyA2TJUe0SLY64QKvoj HdmnsKphbI5A2DJBLXBBo0cdn/qRa/8njPB0H/omzR2kRohzTNEqHiVdAQFqEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649020126; a=rsa-sha256; cv=none; b=EhtwVkZONr1t8yZ/X6J5MCZG6UrPqtNZZteUuUcQuH9g/cV+R+/3obObUmCrz00fUQcS9B VILrwI4q63xdqoJgyCD44TY6kshf3AsGyj05w0PhFu+a/rN2i+EdMpfJt5zwsoP6eVVfcA D8IvR9+LfZz8z2PQz6xajL5qhIQgI8fFHNCIsUj1N81aa9LkNLkg4DXmq42LYgEnYrTynq M+Taku+y/x/iHHWk/PFmA86qi5js3LHwjxJ1DT8lKnbuNZ1/wlzw/XJAizGCpPYS1t/H0E Ksjn7V7mQzSBId6+knx+MBPwMEW6FhHqn6oitXjNwr3TRhLIYf8Nd4dQhC/VGQ== 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 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 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]]` If $addr isn't the last loaded PE-COFF, size must be provided. fdt can be `-` to signal EFI_FDT_USE_INTERNAL. If we provide an address that isn't the last loaded PE-COFF, it wipes out the device path and lets efi_run_image() synthesize it. Providing a size with the address of the last loaded PE-COFF is an error, but that's a bit arbitrary. Obviously our loader doesn't get good source disk information this way and I have to drive it manually, but that's still orders of magnitude better than having to locally shuffle new loader.efis onto a flash drive and keep moving the flash drive back and forth to iterate on it. Thans, Kyle Evans