Github messages for voidlinux
 help / color / mirror / Atom feed
From: Dko1905 <Dko1905@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
Date: Sat, 27 Mar 2021 14:48:57 +0100	[thread overview]
Message-ID: <20210327134857.lA1EdFZfBzbaujXYAbhq9slF_MZCLV6Ia-AKCUFm0Io@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-29780@inbox.vuxu.org>

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 8014 bytes --]

From 938735b97ce548b606c5cb6b641dd9fcf7cadcb2 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/3] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
---
 srcpkgs/efibootmgr/files/README.voidlinux                | 8 ++++++--
 srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd    | 2 ++
 .../efibootmgr/files/kernel.d/efibootmgr.post-install    | 9 +++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..b7904be2be64 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -17,3 +17,7 @@ This is also required after the first installation of this package.
 The bootorder itself is not changed, so your previous boot loader will
 stay enabled until you can edit the order in your firmware interface or
 using "efibootmgr -o <hexnum>"
+-----------------------------------------------------------------------
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 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
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # 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 adf523e7b1fa..cbbc318aa58d 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -35,11 +35,16 @@ bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-)
 
 # if existing, remove it
 if [ "$existing_entry" != "" ]; then
-  /etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+fi
+
+# if using strict efi suffix, rename vmlinuz
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
+	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
 fi
 
 # create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
 # restore the boot order
 efibootmgr -qo $bootorder

From cb1dd884526c04f3b3534d8ed03e0825ed6b4c1d Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 12:55:26 +0100
Subject: [PATCH 2/3] efibootmgr: Remove the half broken boot order restore
 logic.

---
 srcpkgs/efibootmgr/files/README.voidlinux                 | 4 ----
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 7 -------
 2 files changed, 11 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index b7904be2be64..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -14,10 +14,6 @@ but you always have to reconfigure the kernel:
 
 This is also required after the first installation of this package.
 -----------------------------------------------------------------------
-The bootorder itself is not changed, so your previous boot loader will
-stay enabled until you can edit the order in your firmware interface or
-using "efibootmgr -o <hexnum>"
------------------------------------------------------------------------
 Some EFI implementations require the stub to end with a .efi suffix. If
 your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
 and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index cbbc318aa58d..7653d2db9ff3 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,11 +28,6 @@ major_version=$(echo $PKGNAME | cut -c 6-)
 # look for previous entry for this major kernel version
 existing_entry=$(efibootmgr | grep "Void Linux with kernel ${major_version}")
 
-# get the boot order
-# this is required because when in the next step the existing entry is removed,
-# it is also removed from the order so it needs to be restored later
-bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-)
-
 # if existing, remove it
 if [ "$existing_entry" != "" ]; then
 	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
@@ -46,5 +41,3 @@ fi
 # create the new entry
 efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
-# restore the boot order
-efibootmgr -qo $bootorder

From d0ad886b2506837b9d4f9f1ed1d1917d6a5ee6f3 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 14:47:17 +0100
Subject: [PATCH 3/3] efibootmgr: Fix logic in efibootmgr post install script

There were some quite obvious bugs and issues that I should have seen,
but they are now fixed.
---
 .../files/kernel.d/efibootmgr.post-install    | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index 7653d2db9ff3..6739f3ba17f8 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -33,11 +33,20 @@ if [ "$existing_entry" != "" ]; then
 	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
 fi
 
-# if using strict efi suffix, rename vmlinuz
-if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
-	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		mv -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
 fi
-
-# create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
-

  parent reply	other threads:[~2021-03-27 13:48 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 12:25 [PR PATCH] " Dko1905
2021-03-27 12:46 ` [PR REVIEW] " prez
2021-03-27 12:46 ` prez
2021-03-27 13:14 ` Dko1905
2021-03-27 13:48 ` Dko1905 [this message]
2021-03-27 13:49 ` [PR REVIEW] " Dko1905
2021-03-27 13:50 ` Dko1905
2021-03-27 13:59 ` Dko1905
2021-03-27 16:20 ` Dko1905
2021-03-28  7:54 ` Dko1905
2021-04-11  2:59 ` ericonr
2021-04-11 14:01 ` [PR REVIEW] " sgn
2021-04-11 14:01 ` sgn
2021-04-11 14:01 ` sgn
2021-04-11 14:21 ` Duncaen
2021-04-11 14:23 ` Duncaen
2021-04-11 18:06 ` [PR REVIEW] " Dko1905
2021-04-11 18:07 ` Dko1905
2021-04-11 18:07 ` Dko1905
2021-04-11 18:09 ` Dko1905
2021-04-11 18:12 ` Dko1905
2021-04-27 12:27 ` [PR PATCH] [Updated] " Dko1905
2021-06-16  9:21 ` Dko1905
2021-08-25 20:03 ` Dko1905
2021-08-25 20:13 ` [PR REVIEW] " ericonr
2021-08-25 20:13 ` ericonr
2021-08-26  6:29 ` Dko1905
2021-08-26  6:35 ` Dko1905
2021-08-28 14:52 ` Dko1905
2021-08-28 14:59 ` Dko1905
2021-08-28 15:00 ` Dko1905
2021-08-28 17:46 ` ericonr
2021-08-29 16:15 ` [PR PATCH] [Updated] " Dko1905
2021-08-29 16:17 ` Dko1905
2021-09-04 15:15 ` Dko1905
2021-09-05 10:42 ` [PR PATCH] [Updated] " Dko1905
2021-09-05 10:42 ` Dko1905
2021-09-06 12:54 ` Dko1905
2021-09-06 17:11 ` [PR REVIEW] " tornaria
2021-09-06 17:16 ` tornaria
2021-09-06 17:22 ` tornaria
2021-09-06 17:35 ` tornaria
2021-09-06 17:42 ` ahesford
2021-09-06 17:42 ` ahesford
2021-09-06 17:47 ` tornaria
2021-09-07 15:08 ` Dko1905
2021-09-07 15:09 ` Dko1905
2021-09-07 15:49 ` Dko1905
2021-09-07 15:55 ` [PR PATCH] [Updated] " Dko1905
2021-09-07 15:56 ` [PR REVIEW] " Dko1905
2021-09-07 15:58 ` Dko1905
2021-09-07 16:05 ` ahesford
2021-09-07 22:34 ` tornaria
2021-09-07 22:46 ` tornaria
2021-09-07 22:49 ` tornaria
2021-09-07 22:49 ` tornaria
2021-09-08 11:41 ` [PR PATCH] [Updated] " Dko1905
2021-09-08 11:52 ` Dko1905
2021-09-08 11:52 ` [PR REVIEW] " Dko1905
2021-09-08 11:52 ` Dko1905
2021-09-08 11:52 ` Dko1905
2021-09-08 12:19 ` tornaria
2021-09-08 12:26 ` [PR REVIEW] " tornaria
2021-09-08 12:50 ` ahesford
2021-09-08 12:50 ` ahesford
2021-09-28  8:55 ` [PR PATCH] [Updated] " Dko1905
2021-09-28  8:55 ` [PR PATCH] [Closed]: " Dko1905
2021-09-28  9:16 ` Dko1905

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=20210327134857.lA1EdFZfBzbaujXYAbhq9slF_MZCLV6Ia-AKCUFm0Io@z \
    --to=dko1905@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).