From patchwork Mon Dec 28 12:24:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 352610 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9705680jai; Mon, 28 Dec 2020 04:24:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJykVtdqVobd7Un8AvE98tHp1muSzQYX7ps0KvcVr8DuyRflYp6XZnZZ4KcN92zqh+3ONwYO X-Received: by 2002:a05:6402:8d9:: with SMTP id d25mr41665031edz.278.1609158291579; Mon, 28 Dec 2020 04:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609158291; cv=none; d=google.com; s=arc-20160816; b=jwj9bwZNKDCYOccVXvk3A1iVQUQ+itfxH3irS922iG9z8L2VX0HK0i0XDV/C3uYO/E NGWgH2J5TJMPAYZymSWVq/ObanP5iFtL31yAMAly31bPGljyrZ7o46dFQSV/nWwQ7YD7 nJgd/VtNRJCBk+qEMtwXh/D880IruKhvoxS/EueuYk+aAQ3U9Xzt6+d02Ows9LLzQ/Pa dr8IUE1ty55/bvdWR/CK1tKrCilnxJHPA4VAU0a3Njp7Ju45KBF+kAJNh5lrP/gybXfW k7jJy+tQ2jJVF3CCBSbIVvM36c2prqWZPUg+GnMkyKChCRjCRohmNA34MwRqq1MO3BJM e6JQ== 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=kA5gOOORyDMUL87CJm0AJN0X2pqITZ5dI++RgJ7D7j8=; b=dzt4TQ3HgVyz+AGTdjwwDhFXqDouK/hRNZ77n04vVCBuKzMpkwPpmYvoYldMTU+JV0 zZOI+gvuB0CESj99uTisz5/oD/almE/c5FWMCeKBcD4LHdMl2zXea0FMYUhrluXuedWA rKykmQd0RiS4FhwpN0b1Azls1O/zgbiKzlP6Gz2G44hnKJLzybow7g8QL7j+GY1yHuSn 3yAvuHEDxDEfAbKExJOBiQxN/I0kT4+c3Sz6p2yaZCnR4f+53d84CZ3S1yow9OwXnaL0 phazmkC8Kvi8pH1jvgxNylDtIAdeog2xc3kUoQoHFkzjnB0mIw6AHPwUdaM+d7iaTIGq kzkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HxBQgtQC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id u19si18389858ejj.601.2020.12.28.04.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 04:24:51 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HxBQgtQC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 EBD1481260; Mon, 28 Dec 2020 13:24: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="HxBQgtQC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CC308239D; Mon, 28 Dec 2020 13:24:46 +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-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 92AD78002F for ; Mon, 28 Dec 2020 13:24:43 +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-wm1-x336.google.com with SMTP id r4so9659556wmh.5 for ; Mon, 28 Dec 2020 04:24:43 -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=kA5gOOORyDMUL87CJm0AJN0X2pqITZ5dI++RgJ7D7j8=; b=HxBQgtQCNNNCnEyMx0RDX+fnRLBlQGSe9dfk3KXOwWHwgQApzJ7FuuHizQfG74dsEB /PZPNPQmwzJhJGvPLQvGNSDTE0K6A9B36O9dlTD6Sgi7l6rbTjcVZ8E5ZN/uCoXn8sMF ybqmzg+QFXR0b0Nw5zkNoUzKTH6HO7ISeZJJzB93h3H39zBBWE55Lrt3gK21USakinLA zPvdJXzZt/vFQzZBIl1amj5p77cHiYiXiAXUirJUFtABf2qQosK+394EbtUKPLeYxXc4 KbZGWr5eb3f2LaTml0NcOsXAxAIusICFgjDz9jd9CM5+n0+7OtosLAB83ZYVykJt4skF gLVw== 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=kA5gOOORyDMUL87CJm0AJN0X2pqITZ5dI++RgJ7D7j8=; b=DJNLk/wyvkOrrTsZGTEQN/WpUgfOfJAW23F9rQFlKkx2Bc6z/5FP5eHqLrRhYyrJA/ L7xE55dlDnwOs2qAyXQ+ayI9Ovp79UF+tdkZrJaCLvQmgUq3trLUwYXcnY5CClzhiE5d UX926+OL9/0nOnaPHCu170DB/5yZq0LRD+gZLnyGQ9yZFZqjmTRzd0mPcaeE5KF6U0bT e49cjHuSLXC678TVCmK7lbdP+3Ivc3ne7m7lOY2HfAbnvOkTj+CkYXC3yGoQ+VPqQtlJ YKuoehHW5L8vfrDwB9VNmL/I02y8T5IhFHo1utmueMOePmWCklUpbwhKoDiwna3lYNi/ vwhA== X-Gm-Message-State: AOAM531KJY+Rldh0aOURRz4RQeaVygS50UWLpwI54X9LRmndlnNwmvds oLvTvLY8cjDHCjZ/1BVSWWlUxg== X-Received: by 2002:a7b:ce0f:: with SMTP id m15mr20007773wmc.56.1609158283159; Mon, 28 Dec 2020 04:24:43 -0800 (PST) Received: from localhost.localdomain (athedsl-4484548.home.otenet.gr. [94.71.57.204]) by smtp.gmail.com with ESMTPSA id w21sm18710321wmi.45.2020.12.28.04.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 04:24:42 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: takahiro.akashi@linaro.org, ard.biesheuvel@arm.com, Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [PATCH 0/6] Change logic of EFI LoadFile2 protocol for initrd loading Date: Mon, 28 Dec 2020 14:24:32 +0200 Message-Id: <20201228122440.316403-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.30.0.rc2 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 Right now in U-Boot, we unconditionally register the EFI LoadFile2 protocol and the initrd file path is a U-boot .config option. This imposes a number of limitations. Using multiple initrd's implies you'd have to concatenate them into one big file. Alternatively you'd have to recompile U-Boot or overwrite your initrd with a newer one in order to use it. Since linux efi-stub only falls back to the cmdline interpreted initrd if the protocol is not registered, this also creates a problem for EFI installers, since they won't be able to load their own initrd and start the installation if the option is enabled. This patchset is trying to address all of the above, by changing the logic of the protocol registration and initrd discovery. It introduces a new EFI variable 'Initrd####', which we try to match on the BootCurrent value the bootmanager sets up. For example Boot0010 will search for Initrd0010, which should include the full initrd path i.e 'mmc 0:0 initrd'. If the file is present, the protocol will be registered, so the efi-stub can use it. This opens up another path using U-Boot and defines a new boot flow. A user will be able to control the kernel/initrd pairs without explicit cmdline args or GRUB, just by setting the correct 'Initrd####' variable. Ilias Apalodimas (6): efi_loader: remove unconditional initialization of file2 protocol for initrd efi_loader: Introduce helper functions for EFI efi_loader: Replace config option with EFI variable for initrd loading efi_loader: Remove unused headers from efi_load_initrd.c efi_selftest: Modify self-tests for initrd loading efi_loader: bootmgr: use get_var from efi_helper file include/efi_helper.h | 29 +++ lib/efi_loader/Kconfig | 12 +- lib/efi_loader/Makefile | 4 +- lib/efi_loader/efi_bootmgr.c | 39 +--- lib/efi_loader/efi_helper.c | 189 ++++++++++++++++++++ lib/efi_loader/efi_load_initrd.c | 88 +++------ lib/efi_loader/efi_setup.c | 5 - lib/efi_selftest/efi_selftest_load_initrd.c | 90 +++++++++- 8 files changed, 341 insertions(+), 115 deletions(-) create mode 100644 include/efi_helper.h create mode 100644 lib/efi_loader/efi_helper.c -- 2.30.0.rc2