From patchwork Thu Oct 26 05:30:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 738317 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp638281wrq; Wed, 25 Oct 2023 22:31:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZB2gu81iWdp3r6WQJKTLGycAc7RgXMElqX0E+dNiLQZ51/pE/C+zOaxitcAF2rWz7ihAI X-Received: by 2002:a05:600c:4709:b0:408:5a1c:9de7 with SMTP id v9-20020a05600c470900b004085a1c9de7mr11037925wmo.7.1698298281529; Wed, 25 Oct 2023 22:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698298281; cv=none; d=google.com; s=arc-20160816; b=QgxkxhJ3Dq3+3U1J85AhF36A+89Mq6RrhDh9ttYTIDAx6FCBU6JpY8E8tZVzqWl201 q/ZfbQI++UCBKlN7HF8MY0pGoB8j5ij4zZQPxUnW3nbzfGol2+hHQE9AiNIP0fnbK3V6 HvREE4MESGRkRN3I+jempcYHnelMI4tO2CPcIl1DNW9tPFXuoCiztpyM0XO3aMJGcCSZ e1w9zOBw3BvqDmyD/k+qyOClJP7lnSUNmUpExLpP64HoQz58cWJffisI9aV+LC6AIMrc fiJYC7jW+cPaJla8VW+T+zy81SzHfOurL9sTzoNMQly6G7YMksJ7MEb8VMM5yH9jqvQG Hupw== 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=3kwsvL4rKbgWqOLjp2zBIkwHCyoilydeGcjvJoEOjhw=; fh=RsKNQde3hXRhkFNkXZDJxhxJUE2DI5qQDMHikPj4pmY=; b=drixssECDpCkSBQDVbBm3nE3CR3PV403n2omE0gFUeWjebbcpB4OpSSAx7tj28aqbn O57cXCd3ZddHNt+2FeqAbHWstDEmznr8nSjz1js8XtgBxv5EER+g91dps2eXnvr4kigr +Sio40D/uiyYUnnthOSk/AOBjpRFWZq5GbMKSx7T6Jto3HOCVa8rB9cewrzU89kzCLmN BdnCl88xhPorDgvkn+9ZX7ujeR9b5miJoPaPX1W1pn1QYVV1NHlijP4YLAi//P6/jKQ8 7GW7xdFXDdiiGZs/VZUCm8sSf2Qj7RsqyeX4EiCFPjg44sHdk8LKEARroJGkSLz5w7YP hgxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KpIgqTUJ; 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 h18-20020a05600c351200b00404f9162fbdsi1081000wmq.208.2023.10.25.22.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 22:31:21 -0700 (PDT) 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=KpIgqTUJ; 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 1F00487ADA; Thu, 26 Oct 2023 07:31:20 +0200 (CEST) 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="KpIgqTUJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E00F987AE3; Thu, 26 Oct 2023 07:31:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (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 028C38755E for ; Thu, 26 Oct 2023 07:31:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6bb744262caso113093b3a.0 for ; Wed, 25 Oct 2023 22:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698298272; x=1698903072; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3kwsvL4rKbgWqOLjp2zBIkwHCyoilydeGcjvJoEOjhw=; b=KpIgqTUJNyA3ifO0R1nyDQaSE3yNAKUkZ8iLQc5RbZCNa+993pfdVAa+QxOZ1hIbJZ yE7t5v8XI7gaDhb5aPWb2ASWedFfwk7lytYFLcOpiGNEuPwF7sqdfzo6IeEH3k6LIzRr jO0RO6XTo5PKDlyqgJQp5Z6b33LOQNbWr3x+fOkU02X9XT/eiJ/kx6Jf6jPYg4q5fBLz mN7R85QTduVafQH/C/sc64wwxxoFDmtQmcf++P0HS8w30dZEGOw+9NPfIFktwWkGp9ih 47ptLU0BpvHuUotCM6yihfXAbTwjtctf8KsJpYqPKgGSpCJUSMmNNCAWv1T8HcmtJcR4 VF5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698298272; x=1698903072; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3kwsvL4rKbgWqOLjp2zBIkwHCyoilydeGcjvJoEOjhw=; b=Aoo23j0E1tOxtp4S/Z+aP3w5IrWRS0pBO3ZS6l5JwAd17uR+4NAIivkcHDGq/mIzVU CXnJoHMfiFMgpsTgf3FWGGxkwybU1MXY6vG8bTsV52kvmdxJDcnYaLovabW1uvWc+DAx 7dcdcskqGqm20EiQ9Z4n40kEkxBvCAPyUzVvg4Y2rD56Hw/IJtqirkPKz0b+YOPqoN+v O9Muu5cgYSOkPjQGrHS58jU0ukEgjEc5UrgvVd/w97He6v6rtBpvgpfCerv2f7gHcz23 0FyDAjYwWgVnvbTalIjFdUEBgUJKMrhM2Ff2GgKNiHxk0+6fDr1AaZIoY2W7KjWmmo6c Lv2A== X-Gm-Message-State: AOJu0YzAg8Q6/2IagN1a+l/vCGJgToQZ0YZY/OFEV4WPHAHyvcWAZT+Z TV1AWLA+1buiBljxYLAJMNYrfg== X-Received: by 2002:a62:b518:0:b0:690:c79c:1912 with SMTP id y24-20020a62b518000000b00690c79c1912mr17004732pfe.0.1698298272072; Wed, 25 Oct 2023 22:31:12 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:bca9:3af7:89e9:80b7]) by smtp.gmail.com with ESMTPSA id fa13-20020a056a002d0d00b006c06804cd39sm440715pfb.153.2023.10.25.22.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 22:31:11 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, ilias.apalodimas@linaro.org Cc: jbx6244@gmail.com, u-boot@lists.denx.de, AKASHI Takahiro Subject: [RFC 00/13] cmd: bootefi: refactor the code for bootmgr Date: Thu, 26 Oct 2023 14:30:39 +0900 Message-Id: <20231026053052.622453-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This patch set is motivated by the discussion[1] regarding CONFIG_BOOTEFI_BOOTMGR option. At the end, bootefi.c will be decomposed into two parts, one for providing the command itself and one for implementing helper functions. EFI_LOADER will now be available without CONFIG_CMDLINE or specifically CONFIG_CMD_BOOTEFI if invoked via bootmeth/bootstd. Then, EFI_LOADER library side will be further split into two options for fine-grain control: CONFIG_EFI_BINARY_EXEC: execute UEFI binaries which are to be explicitly loaded by U-Boot's load commands/functions or other methods (like a jtag debugger?) It supports bootmeth_efi as well as "bootefi |hello"(/"bootm"?). CONFIG_EFI_BOOTMGR: provide EFI boot manger functionality It supports bootmeth_efi_mgr as well as "bootefi bootmgr". As such, We will no longer need CONFIG_BINARY_EXEC if we want to only make use of the boot manger for booting a next stage OS. Prerequisite ============ This patch set is based on top of Simon/Tom's [2]. Patches ======= Patch#1-#11: I hope that those commits show step-by-step refactoring without introducing degradation. Patch#12-#13: Those are not directly related to the patch's aim, but they are necessary to compile U-Boot on sandbox (sandbox_defconfig) without CONFIG_CMDLINE. [1] https://lists.denx.de/pipermail/u-boot/2023-October/534598.html [2] origin/TEST/v4.1-tidy-up-use-of-CONFIG_CMDLINE AKASHI Takahiro (13): cmd: bootefi: unfold do_bootefi_image() cmd: bootefi: re-organize do_bootefi_image() cmd: bootefi: carve out EFI boot manager interface cmd: bootefi: carve out binary execution interface cmd: bootefi: move library interfaces under lib/efi_loader cmd: efidebug: ease efi configuration dependency bootmeth: use efi_loader interfaces instead of bootefi command efi_loader: split unrelated code from efi_bootmgr.c efi_loader: rename BOOTEFI_BOOTMGR to EFI_BOOTMGR net: tftp: remove explicit efi configuration dependency fs: remove explicit efi configuration dependency lib: uuid: move CONFIG_RANDOM_UUID block: rkmtd: select CONFIG_RANDOM_UUID explicitly boot/Kconfig | 4 +- boot/Makefile | 2 +- boot/bootm_os.c | 31 +- boot/bootmeth_efi.c | 8 +- boot/bootmeth_efi_mgr.c | 3 +- cmd/Kconfig | 28 +- cmd/bootefi.c | 658 +++++-------------------------- cmd/efidebug.c | 4 +- drivers/block/Kconfig | 1 + fs/fs.c | 7 +- include/efi_loader.h | 34 +- lib/Kconfig | 7 + lib/efi_loader/Kconfig | 11 +- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_bootmgr.c | 37 ++ lib/efi_loader/efi_device_path.c | 3 +- lib/efi_loader/efi_helper.c | 486 ++++++++++++++++++++++- net/tftp.c | 10 +- test/boot/bootflow.c | 2 +- 19 files changed, 697 insertions(+), 641 deletions(-)