From patchwork Wed Feb 10 10:54:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 380214 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1042035jah; Wed, 10 Feb 2021 02:54:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAOvSl4zuhU30sPV+GdgJPeuVxHxvUQjfk6d74j5HPyUd2DVWqIW6R5heCRO8fMh2ydc8v X-Received: by 2002:a17:906:e03:: with SMTP id l3mr2355577eji.64.1612954491443; Wed, 10 Feb 2021 02:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612954491; cv=none; d=google.com; s=arc-20160816; b=GZBDCZoVHMWmoqAYOyLMbTTJjGlTkkRmqi8S4Awkpurt3y/MX51Mo9qbyGlwtzzYXS 6plAqSHOGiGEkl/ONlBdYATm/SU0g6/p0uvzncNhITqbMwVo3BCtjXU+Jyh5zeGdXBAL VQbHRTl+o1oBM4bt1gGPDxfnmhJPYUZBU5Pze0D84GmJ2HZrCsDiVzgxeg+n2gbE7f/s 93SwFyAw53K/HEofnmBpdt8MIUdKXJqT/bwGNn37Oepy31NHUQDajBXEbNQQzBmvaxZ2 VvZhXIZ036xTcPEQznkoHEoifhdQzKG6EVd4rjnSjawKcvz1gZTNJt4sJqskyADfvkSy UHBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Ah25foyzLpdXMVb+1DZM8KLYGeXia0hMPn4E2U2DwXI=; b=fUsQGI7MY96LhNftdaEyOeKkE9VsnbD17qvf49mEgPjr5+tcBa0tbUtYwHRVhvUMdH LaK3+2OyVbHXV9WdBPqZsSKhYVbczP4hlh9FZgWWDvXHHo74vCGgauUgt9dIYEtostzn E3iqz7F3e4NPSpjRJJv2CvShwV0SiMCToAURJWe183zmsZXWYvw3ItahsTu1v4hsg3Wp YBVbgwFYoYewMd50ZuYJyPBmyES+mCrmhIhOItCagiY+Z8oKEZORHe+rrW2B3FaqMrKb Qm4vDevaD86A8sskrzIAxWk+pbRkshv4ALjZMpWkp1ps2YY8WkDO4e77QY9J9e5ijs61 JsJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FA9Q1cVu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id i23si1162218ejj.317.2021.02.10.02.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 02:54:51 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FA9Q1cVu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E4A88270A; Wed, 10 Feb 2021 11:54:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FA9Q1cVu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CBE8826A5; Wed, 10 Feb 2021 11:54:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) (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 AF19182AFC for ; Wed, 10 Feb 2021 11:54:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52c.google.com with SMTP id g10so2427283eds.2 for ; Wed, 10 Feb 2021 02:54:33 -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=Ah25foyzLpdXMVb+1DZM8KLYGeXia0hMPn4E2U2DwXI=; b=FA9Q1cVuSWV1gY2aeqwaVEPO/Ivvzzyc/ucwSsTU6iY1d7nY9InDlh/RseZcApeENE 5UjLK5LGYWeN9PqonNiYhz7lqq7sQkAifLup1Es/NlxdtKwVwnOcbIy8V0Zg7zgUEFyk A2eBer/Dq9LZi5BWnSzaNbL7dCSzoTbpYZ57JT5gpP1QTpiuh9lw6sMiYGCX2OnGAam1 ZXuis7h1vu0cdA4l9c1YIEWrOdqj7HyZHK1ZrOX9YtamlwjSM1mN3WPSo0GVjI4HbAD6 d5yGFNkEo0ChB2cofi5o0nRuyqRDcb4PDA0lj8+3u2e5msbOOuw8NiaBtuFDW53WIcJH /4rg== 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=Ah25foyzLpdXMVb+1DZM8KLYGeXia0hMPn4E2U2DwXI=; b=mjjS+YMXnXZmpwVMIGG5zB0telwqOAAfQOWxrKicvxcsyrG+9euQKvioAFvCoRyDJc gi7NkXwH6DXLKIq9lKxgbVQ7zc4ZgCxf48jqTGat2UWvhl3kdB4tdUvCxqRf31Giux8o BucHDr/rX3P7ywkfonJBxjzjdfEmMBUBEisabrejTaOF3yv8X+Ex3FI7xWhbjXmPIHpe HL/MYzTT76PoLhpCGofIcpri5PCtUn/RWLpI29vcDuKrkGf6lGaKqEcH5fTATMriEaWX 9h0WdtTWUWCTFw0QiOMt0izSWDYqr2RUyW+upETuwVwYLv/TEZOAxZ+Lfsn/8jy7yNwz BlNw== X-Gm-Message-State: AOAM530y5OKqBxtY8oAAoeuFastYGzRoscSawGdHS+Rnr5UBYCXrXq6O Hh/Ys20Q4vrXeXhpvPO732RK+g== X-Received: by 2002:a05:6402:c7:: with SMTP id i7mr2619674edu.328.1612954472899; Wed, 10 Feb 2021 02:54:32 -0800 (PST) Received: from apalos.home ([2a02:587:4647:e6c6:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id a6sm857854ejs.79.2021.02.10.02.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 02:54:32 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de, takahiro.akashi@linaro.org Cc: Ilias Apalodimas , Alexander Graf , Simon Glass , Bin Meng , Vladimir Olovyannikov , Sughosh Ganu , u-boot@lists.denx.de Subject: [PATCH] efidebug: Introduce bootmgr command Date: Wed, 10 Feb 2021 12:54:23 +0200 Message-Id: <20210210105425.356131-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own. So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there. Signed-off-by: Ilias Apalodimas --- cmd/Makefile | 1 + cmd/bootmgr.c | 640 ++++++++++++++++++ cmd/efidebug.c | 580 +--------------- doc/board/emulation/qemu_capsule_update.rst | 8 +- doc/uefi/uefi.rst | 2 +- .../test_efi_capsule/test_capsule_firmware.py | 12 +- test/py/tests/test_efi_secboot/test_signed.py | 48 +- .../test_efi_secboot/test_signed_intca.py | 22 +- .../tests/test_efi_secboot/test_unsigned.py | 22 +- 9 files changed, 699 insertions(+), 636 deletions(-) create mode 100644 cmd/bootmgr.c -- 2.30.0 diff --git a/cmd/Makefile b/cmd/Makefile index 176bf925fdc4..c50fe9204757 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_CMD_BLOCK_CACHE) += blkcache.o obj-$(CONFIG_CMD_BMP) += bmp.o obj-$(CONFIG_CMD_BOOTCOUNT) += bootcount.o obj-$(CONFIG_CMD_BOOTEFI) += bootefi.o +obj-$(CONFIG_CMD_BOOTEFI_BOOTMGR) += bootmgr.o obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o obj-$(CONFIG_CMD_BOOTZ) += bootz.o diff --git a/cmd/bootmgr.c b/cmd/bootmgr.c new file mode 100644 index 000000000000..332aac4198bc --- /dev/null +++ b/cmd/bootmgr.c @@ -0,0 +1,640 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * UEFI Bootmanager configuration + * + * Copyright (c) 2018 AKASHI Takahiro, Linaro Limited + */ +#include +#include +#include +#include +#include +#include +#include + +static char bootmgr_help_text[] = + " - UEFI Shell-like interface to configure UEFI Boot Manager\n" + "bootmgr boot add