From patchwork Wed Dec 30 15:07:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 355270 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp11402897jai; Wed, 30 Dec 2020 07:07:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyH2D3jAlDsE+fEBOzcLlYZ1vKatV9NNuC3WyLG3NPsaadcOHiRcMbTB6e1yFf+TzJ1gsyR X-Received: by 2002:a17:906:85cf:: with SMTP id i15mr52167092ejy.373.1609340855586; Wed, 30 Dec 2020 07:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609340855; cv=none; d=google.com; s=arc-20160816; b=lbZSfBiIzetqIM3b1Fzsone3HKj5W/rVe8SyB2201y82RecS33G7ab8mAsEnDrhYoG wJtd4/TO0v+hhQ6jKNReBT5S7ncB7tR4Y7UAxwM8l2fQ7op0cOgQhO6tcAwOj2xzRnpW NUeq/tcBFdT1ZqWa4McdynPPXKiHgI8NL2DU4QrAI4RT+rN1o8Gxd6oobwsIPgxVwfSe lqz/pYpPPmpTv6hfZ7de8voeSP1T1sumiDcI74K9ZDAsNlsTl3xaKaHbu/ZtTZ4DdJwh FRDoFS7m1lmn/oWnIaafyxbrDxMOfgfuySupTI2CajP+wl5giGPkt37i0uCJ2iJN697X dN4Q== 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=1aYKmu6UA5As90bWVLeiAnz7HMC80jUtR5FGZA7Jv5E=; b=zlYnn7rTxTiPGrttGi84vpMoMaZc9k0G2ShzeMSxDZ8pCBb4KXKK6D77Ot6Uud0BQ2 8fhCFyehVbIaGPgFtpT1NA0ooqSG9HiahfZTieZX8TtnO9LzgGJrX4LnUHxfoUs65sJh i4kFwL5cOcxyIEoSTvXeBNn3qbDxUzY/JOZiy2feGtJY8L8+LI0XpUwx4Fer+Oj6nYyJ v576lrhY5b3ZNbvpJQlxS0G/Rkvn/I2AiRgR7F8iS9981gZKJUMSHnzC6l0ZpMsmT26P hf/vMSO4GgevyfOuQ+wLVR8jZfINvJZPMW4aGVkODcD0VA8mLkc3q04a9cA5mOnnXEH8 b8FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SJlx2ZwV; 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 u6si24231769edy.204.2020.12.30.07.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 07:07:35 -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=SJlx2ZwV; 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 B7A9A82540; Wed, 30 Dec 2020 16:07:31 +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="SJlx2ZwV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A68AE8257D; Wed, 30 Dec 2020 16:07:29 +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-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 1838682496 for ; Wed, 30 Dec 2020 16:07:26 +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-wr1-x42c.google.com with SMTP id c5so17674202wrp.6 for ; Wed, 30 Dec 2020 07:07:26 -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=1aYKmu6UA5As90bWVLeiAnz7HMC80jUtR5FGZA7Jv5E=; b=SJlx2ZwVuQiRJOhAaZT4wGkX581c1S3vHTSgDeQ9eQu6XFtKKC5CulHpz9rrtIEcPt /9w8VTBOLIPX6LG+XH72rVAnk9YeevShlNVEelHnlzCtCFQ6MiaDnahXdNvQl4VeiQPP eL5H7FVEJg/R+rWJewlrFnc8wiYsd6x5tEYEVuvzWXToT0o+hbPctZGOA1E3silAIRDi Nmk2CC6PwVQZaxMrO2qgBKIxHQNGDG1R7Pd2sB0/URanuXaJxMTjmrmp44SELkhQSjoq yeRcSgKL8CVwY/u18NgpZN1+My5kt8E09ndghVdh3aIDlM8y6ZSis7VhuChZbmqoiFGC kJTQ== 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=1aYKmu6UA5As90bWVLeiAnz7HMC80jUtR5FGZA7Jv5E=; b=IDeygBBhFaqB8EBomLGZvaW6fbjyI7tcR64+C88nRUE/noeNIZ8bw6Mk7dWFZ66zaE 51f3QRYx12cIOGcZyT6oJOmzRo/Hmbcws2o9YSB44bxAl6VaE0pkRLkzt8uaXNJVY15/ iL0NDsx3i2Lu1EmCilEsa9ZMavJezH/LuIGcjZKFBn135xS7tku594BPpGbq+R4xXLpR xHswuWKVYs/TLxjATKMIFhvFsxAKpfddvpMuxfIg07t4DCuIi9/da3SL9o+kw50YavvI P0sk0YXF9Z2pzcbAjTBqGAKEQnX2vh6G4rq0X7PbCaqdKs89KvqlHUBIQMPEq0eTzT+S q/nw== X-Gm-Message-State: AOAM532RjO1UPaPBY6TqZblNvYOVQK9Fy3wGsMeipKycm/eEwKzrxweT YiE70fx68DXzWQCvfl4JE8dREg== X-Received: by 2002:a5d:528a:: with SMTP id c10mr53607325wrv.117.1609340845484; Wed, 30 Dec 2020 07:07:25 -0800 (PST) Received: from localhost.localdomain (athedsl-4484548.home.otenet.gr. [94.71.57.204]) by smtp.gmail.com with ESMTPSA id k10sm62062721wrq.38.2020.12.30.07.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 07:07:25 -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/8 v2] Change logic of EFI LoadFile2 protocol for initrd loading Date: Wed, 30 Dec 2020 17:07:12 +0200 Message-Id: <20201230150722.154663-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 Hi! This is v2 of [1]. There's been a couple of changes regarding where we install the protocol. The initial patchset was completely disregarding BootNext, so that's taken into account now and we can use the new feature. This brought a few changes on the selftests as well, since we now use the loaded image handle to install the protocol, as a consequence the custom handle in the tests is now uninstalled during the test .teardown(), but the overall approach remains identical. Changes since v1: - Use efi_create_indexed_name() instead of open coding it. An extra patch has been applied to efi_create_indexed_name() to ensure the destination buffer is big enough for our variable name. - Install the protocol during do_efibootmgr() on the loaded image handle and adjust selftests accordingly. The protocol will be uninstalled if efi_exit() is called from and EFI app now. - Make sure strings are null terminated in efi_helper.c - Added documentation in uefi.rst describing the new feature. [1] https://lists.denx.de/pipermail/u-boot/2020-December/436080.html Ilias Apalodimas (8): efi_loader: Remove unused headers from efi_load_initrd.c efi_loader: Remove unconditional installation of file2 protocol for initrd efi_loader: Add size checks to efi_create_indexed_name() efi_loader: Introduce helper functions for EFI efi_loader: bootmgr: Use get_var from efi_helper file efi_loader: Replace config option with EFI variable for initrd loading efi_selftest: Modify self-tests for initrd loading via Loadfile2 doc: uefi: Add instruction for initrd loading cmd/bootefi.c | 13 ++ doc/uefi/uefi.rst | 15 ++ include/efi_helper.h | 28 +++ include/efi_loader.h | 5 +- lib/efi_loader/Kconfig | 13 +- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_bootmgr.c | 37 +--- lib/efi_loader/efi_helper.c | 180 ++++++++++++++++++++ lib/efi_loader/efi_load_initrd.c | 101 ++++------- lib/efi_loader/efi_setup.c | 5 - lib/efi_loader/efi_string.c | 10 +- lib/efi_selftest/efi_selftest_load_initrd.c | 100 ++++++++++- test/unicode_ut.c | 2 +- 13 files changed, 384 insertions(+), 127 deletions(-) create mode 100644 include/efi_helper.h create mode 100644 lib/efi_loader/efi_helper.c -- 2.30.0