From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1qOlcJ-0000ZS-BA for mharc-grub-devel@gnu.org; Wed, 26 Jul 2023 17:00:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOlcH-0000Xc-BW for grub-devel@gnu.org; Wed, 26 Jul 2023 17:00:17 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOlcD-0003yA-7d for grub-devel@gnu.org; Wed, 26 Jul 2023 17:00:17 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-565db4666d7so205083eaf.0 for ; Wed, 26 Jul 2023 14:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20221208.gappssmtp.com; s=20221208; t=1690405210; x=1691010010; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vN48kkvJB5WFcZREU0b7/E/tx6SUxA1kBtIpulCEQC8=; b=fYphfSJQs+pJBozXNOv+7sl3qbuwKg4F0yXvbyaiP5XRUjFTLUZo3wrJ8sw2LdC9l9 gB8GzhL7EbovJDnLt/WAOziHtNEvEaW8BT65TKy8ByV5YKlJNBcqfc4zriZZMNPW4Emw io+tqWIURpJgqOUPQZ59wHtad7sQL+eQo00lT23JKgwWNrpiAnY59I5GgUa1cinYdOeD ZECEG0WtzVWwYb/zvLTeCCAb9sFm6NbCUl4a0ClN/U1lbXWZPhUKCX/tQaLkqGaO3hN1 ROwG3dT/U2D0dqGo20CIapRrywHz9jAZNLlhItdVVQur7JjXNMv+jLdSw0QQdSaipBPf Ee3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690405210; x=1691010010; 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=vN48kkvJB5WFcZREU0b7/E/tx6SUxA1kBtIpulCEQC8=; b=OOrC423ynDPFHcZMY0bbCucps7uGUtAYWT2MB/wWG9fffcrioLpmIIWZLHElNks1Nw XHpvGAOZdU0jMT1co6ATHldVJh/VUfvYFeskgsreetjegojBhHo8Mwri0Ci5VUDRdt/7 3nm+hPdW+9PM2VwsqDPrPCKHY8Ps8VWwvA0DqM5IMRPQWtNTgqyS3Sum/QCuKk1DrUTp Ms+NcfEbCl9uBQdAmOO0N4E/kIiNJI/V6jpINZQZsY+3v7npGdD0eiDOhp8NzN+gU4oy LqRqJl5AnvDGvdn8ZmvuL48g0QshCYGj5MznBZlrR2nLWQztb23GNkhwv8QzvlocMNEZ 73xA== X-Gm-Message-State: ABy/qLbZYEAsSyd+8nSLYcUfaQ+8PX7kcEgj3ibG56p/NRK09Dz3jX+E vIrYGErRrkrk4TiTdIkzkBlA8asu1fBslhSGty8= X-Google-Smtp-Source: APBJJlHJrHWk0zy/FI/0Py/6tAK0V2xE4TzeTFzB9mTYQZZegr3jPkvhf+o9eW8a119KNKT8YR4KvQ== X-Received: by 2002:a05:6358:6f8d:b0:134:d617:e2c9 with SMTP id s13-20020a0563586f8d00b00134d617e2c9mr160432rwn.29.1690405209639; Wed, 26 Jul 2023 14:00:09 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id k16-20020a9f30d0000000b00786e3afb765sm14506uab.0.2023.07.26.14.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 14:00:08 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Peter Jones , Glenn Washburn Subject: [PATCH 0/4] EFI envblk Date: Wed, 26 Jul 2023 15:59:58 -0500 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=development@efficientek.com; helo=mail-oo1-xc33.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2023 21:00:17 -0000 This patch series (for me) was motivated by the "gdb: Add more support for debugging on EFI platforms" patch series, which allowed printing in early EFI init of the GDB command for properly loading symbols. That approach of having the functionality be included at compile time was ultimately rejected. During the discussion of that series, Robbie suggested[1] using patches by Peter and in the Redhat downstream repo which uses an EFI variable to store a GRUB env block. Using this, a user could store a variable in the env block stored in the EFI variable and then have GRUB load that env block in early init as a way to enable the printing of the GDB command. I've taken the original patches by Peter, made more suitable for including in GRUB, fixed some bugs, and added a minor feature. The first patch, adds env block loading in early EFI init from the GRUB_ENV EFI variable. The second patch is included to provide tools for GRUB to set this EFI env block itself, as opposed to needing to use the method suggested by Robbie[1], which requires GNU/Linux and the user-space grub2-editenv utility. Of course, if GRUB is crashing before one can run the efi-export-env command, then other ways of creating and setting the EFI envblk variable are necessary. The third patch adds a test which checks the usability of the commands and the early init loading. And the last patch, whichvmotivated this series, prints the GDB command string if the GRUB variable named "enable_earlyinit_gdbinfo" is present and is set to "1", after the env block is loaded from the GRUB_ENV EFI variable. We might want a different name for the GRUB variable, I don't really have a preference. Glenn [1] https://mail.gnu.org/archive/html/grub-devel/2023-03/msg00072.html Glenn Washburn (2): tests: Add efienv_test for testing efi-export-env and efi-load-env efi: Print GDB command for loading symbols if variable exists Peter Jones (2): efi: Load env block from GRUB_ENV EFI variable in early init efi: Add efi-export-env and efi-load-env commands Makefile.util.def | 6 ++ docs/grub.texi | 24 +++++ grub-core/Makefile.core.def | 7 ++ grub-core/commands/efi/env.c | 182 +++++++++++++++++++++++++++++++++++ grub-core/kern/efi/efi.c | 3 + grub-core/kern/efi/init.c | 37 +++++++ grub-core/lib/envblk.c | 43 +++++++++ include/grub/efi/efi.h | 5 + include/grub/lib/envblk.h | 3 + tests/efienv_test.in | 57 +++++++++++ 10 files changed, 367 insertions(+) create mode 100644 grub-core/commands/efi/env.c create mode 100644 tests/efienv_test.in -- 2.34.1