Github messages for voidlinux
 help / color / mirror / Atom feed
From: 08A <08A@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] efibootmgr: add LOADER_PATH to the kernel hook
Date: Sat, 10 Sep 2022 19:32:02 +0200	[thread overview]
Message-ID: <20220910173202.5y0Q4MJhq214cpUN-Fa2ZanTTThBQpfnOaWWJG75pqg@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-39214@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]

There is an updated pull request by 08A against master on the void-packages repository

https://github.com/08A/void-packages efibootmgr-add-loader-path
https://github.com/void-linux/void-packages/pull/39214

efibootmgr: add LOADER_PATH to the kernel hook
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

# Description

## efibootmgr: fix when no bootorder is configured

When no bootorder is configured, the script fail because `$bootorder` is empty.

## efibootmgr: add LOADER_PATH to the kernel hook

I use the dracut-uefi hook. It creates an EFI binary to a custom location. Because voidlinux keep olds kernels, I need to update with `efibootmgr` every time. This commit provides a new variable to configure the location of the loader.

PS: In theory, it is the last step for a secure boot ready voidlinux.


A patch file from https://github.com/void-linux/void-packages/pull/39214.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-efibootmgr-add-loader-path-39214.patch --]
[-- Type: text/x-diff, Size: 3929 bytes --]

From f759dab4a32b54fa1db52f0a2c911b1c6cbcf8af Mon Sep 17 00:00:00 2001
From: Alexis Ehret <git@08a.re>
Date: Sat, 10 Sep 2022 19:15:52 +0200
Subject: [PATCH 1/2] efibootmgr: fix when no bootorder is configured

---
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 4 +++-
 srcpkgs/efibootmgr/template                               | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..8ee051fed3fb 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -42,4 +42,6 @@ fi
 efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
 
 # restore the boot order
-efibootmgr -qo $bootorder
+if [ -n "$bootorder" ]; then
+    efibootmgr -qo $bootorder
+fi
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index 2f636914a566..8db1f68fd3f6 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=18
-revision=1
+revision=2
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

From 3800ed69612755df99141fa475c735ec25542d4a Mon Sep 17 00:00:00 2001
From: Alexis Ehret <git@08a.re>
Date: Sat, 10 Sep 2022 19:17:28 +0200
Subject: [PATCH 2/2] efibootmgr: add LOADER_PATH to the kernel hook

---
 srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd    | 2 ++
 .../efibootmgr/files/kernel.d/efibootmgr.post-install    | 9 ++++++---
 srcpkgs/efibootmgr/template                              | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..25f0f99fdba9 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# To choose an alternative loader path, set
+# LOADER_PATH=/efi/EFI/void/linux-${VERSION}.efi
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index 8ee051fed3fb..ace3af262258 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -12,8 +12,6 @@ if [ "x${MODIFY_EFI_ENTRIES}" != x1 ]; then
 	exit 0
 fi
 
-OPTIONS="${OPTIONS} initrd=/initramfs-${VERSION}.img"
-
 args=""
 if [ "x${DISK}" != x ]; then
 	args="-d $DISK"
@@ -39,7 +37,12 @@ if [ "$existing_entry" != "" ]; then
 fi
 
 # create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+if [ -z "${LOADER_PATH}" ]; then
+    OPTIONS="${OPTIONS} initrd=/initramfs-${VERSION}.img"
+    efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+else
+    efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l "${LOADER_PATH}"
+fi
 
 # restore the boot order
 if [ -n "$bootorder" ]; then
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index 8db1f68fd3f6..35ca33ef9897 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=18
-revision=2
+revision=3
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

  reply	other threads:[~2022-09-10 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10 17:30 [PR PATCH] " 08A
2022-09-10 17:32 ` 08A [this message]
2022-12-10  1:58 ` github-actions
2022-12-25  1:58 ` [PR PATCH] [Closed]: " github-actions
2023-11-26 13:47 ` Barbaross93
2023-12-01 12:31 ` 08A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220910173202.5y0Q4MJhq214cpUN-Fa2ZanTTThBQpfnOaWWJG75pqg@z \
    --to=08a@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).