From patchwork Tue Mar 5 05:53:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1051621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VUxUdzHT"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44D5cr519hz9s1B for ; Tue, 5 Mar 2019 16:51:54 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BA63DC21D74; Tue, 5 Mar 2019 05:51:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3EBB9C21C3F; Tue, 5 Mar 2019 05:51:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 24402C21D83; Tue, 5 Mar 2019 05:51:46 +0000 (UTC) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) by lists.denx.de (Postfix) with ESMTPS id 9DC0CC21C3F for ; Tue, 5 Mar 2019 05:51:45 +0000 (UTC) Received: by mail-yw1-f65.google.com with SMTP id u205so6090039ywe.1 for ; Mon, 04 Mar 2019 21:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8TqLuKfScEpBVn4wLIiLdPxj263nE9X7WOSf9Q68Q1A=; b=VUxUdzHTtf/nQQpBuJLeJyFR8WD2Fh1jbZSaMLCN4WQl4kcsNbGiYbLToKWFPVH/od Fbl0RiV/XIDRP+XlKkzC6UYNt8id5/6DxAvSRW6wuB9UFrdJacaRV2GBquUKNgBlfqXo R/dhHtZCYyPWOWJ6kJwKhKYIpQTntivV4DKtHNcEIfNMsLpISxJElmhwZBWPz6533/8K S3zJ69hGA+WBRLa38KnZqRIbeU07wqx/1+W/tP4DD6qQpC90TsqjrhVkcGr4yCWRsOFU ft04tFQJmXPr1FP9c06TVZGZO2c66jIvry0hbYBK64VEbPn9VNl6eMOEFMzecVpTRf81 9iYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8TqLuKfScEpBVn4wLIiLdPxj263nE9X7WOSf9Q68Q1A=; b=CX6Afb4nLYJqEevnoDUeP8xpUf2ssvuYQDk7N5ocWBngLjXoY7J5EB+brLQIzLEq1k 2bktEjX3EubGhtschtRwKXFk8guB1Rhek2ogtUoaHbrokvG7V4IQ6X26vE1r+KVJ6V6I zeyu22+0wcbmvmpr/TBIbu//KPKi++5yLatMMzDEZ3Qi0bYah38Z6WJgZhO+rIaoXxlf mNTYp072ofbke8EFq++eqHTrn3YK9fT1LggKrszohMjyoIT7fHvXGbwIehTlhTBwhYAw 7rcydT46Iu76xPtYh+mdIKKOWN5HOy97M+bv0m7LdV+oyaLi3rOQI1j+yj4oOSZ11Kdn BzYQ== X-Gm-Message-State: APjAAAUtmnsgY45KmwuJrKpLikS+wPYU/dJIkOyn5XBJefE040P2WuvM YgNJa7yJd/RXhGWwP+Crb10I/w== X-Google-Smtp-Source: APXvYqzVDXvugsNIwLhYETAqFBpXlLlKNH/dySvVMky9zcC2WZdiD2thavCP6Gjc702Nst1p3Y2J+w== X-Received: by 2002:a25:f50d:: with SMTP id a13mr788410ybe.240.1551765104197; Mon, 04 Mar 2019 21:51:44 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id b132sm3345633ywh.79.2019.03.04.21.51.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Mar 2019 21:51:43 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@suse.de Date: Tue, 5 Mar 2019 14:53:29 +0900 Message-Id: <20190305055337.3793-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [RFC 0/8] efi_loader: rework bootefi/bootmgr X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" There are several reasons that I want to rework/refactor bootefi command as well as bootmgr: * Some previous commits on bootefi.c have made the code complicated and a bit hard to understand. * Contrary to the other part, efi_selftest part of the code is unusal in terms of loading/execution path in do_bootefi(). * do_bootefi_exec() would better be implemented using load_image() along with start_image() to be aligned with UEFI interfaces. * do_bootmgr_load() should also return a size of image loaded. This information will be needed at load_image(0 and also be used to verify an image with its signature in "secure boot" in the future. * When we will support "secure boot" in the future, EFI Boot Manager is expected to be invoked as a standalone command without any arguments to mitigate security surfaces. In this patch set, Patch#1 is a bug fix. Patch#2 to #5 are preparatory patches for patch#6. Patch#7 is for standalone boot manager. The concern that I'm aware of is: * load_image() will take an argument of "parent_handle," but obviously we don't have any parent when invoking an application from command line. (See FIXME in patch#6.) -Takahiro Akashi AKASHI Takahiro (8): efi_loader: boottime: don't add device path protocol to image handle efi_loader: boottime: export efi_[un]load_image() efi_loader: bootmgr: return pointer and size of buffer in loading cmd: bootefi: move do_bootefi_bootmgr_exec() forward cmd: bootefi: carve out fdt handling cmd: bootefi: carve out efi_selftest code from do_bootefi() cmd: bootefi: rework do_bootefi(), using load_image API cmd: add efibootmgr command cmd/Kconfig | 8 + cmd/bootefi.c | 434 +++++++++++++++++++++++----------- include/efi_loader.h | 14 +- lib/efi_loader/efi_bootmgr.c | 41 ++-- lib/efi_loader/efi_boottime.c | 39 ++- 5 files changed, 360 insertions(+), 176 deletions(-)