Github messages for voidlinux
 help / color / mirror / Atom feed
From: slymattz <slymattz@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
Date: Sat, 16 Mar 2024 22:03:33 +0100	[thread overview]
Message-ID: <20240316210333.D66832737B@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-48906@inbox.vuxu.org>

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

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

https://github.com/slymattz/void-packages refind
https://github.com/void-linux/void-packages/pull/48906

refind: account for btrfs setups when generating manual stanzas
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **yes** (I've been running it on x64-glibc for the past two weeks)

#### Local build testing
I built this PR locally for my native architecture, x86_64-glibc as well as for aarch64-glibc [EDIT: Feb 26 09:34:52 PM CET 2024].

#### My setup
/etc/default/refind-kernel-hook.conf
```
#!/bin/sh

# Change this line to 1 to update refind conf whenever new kernel is installed
UPDATE_REFIND_CONF=1

# refind.conf location
# It usually stays in
#
# /boot/EFI/refind/refind.conf
#       if you use all default configuration and EFI partition mounted to /boot
# /boot/efi/EFI/refind/refind.conf
#       if using default configuration and EFI partition mounted to /boot/efi
# /boot/EFI/BOOT/refind.conf
#       if you run refind-install --usedefault and EFI partition mounted to /boot
# /boot/efi/EFI/BOOT/refind.conf
#       likewise, EFI mounted to /boot/efi
# /efi/EFI/refind/refind.conf
# /efi/EFI/BOOT/refind.conf
REFIND_CONF=/boot/efi/EFI/refind/refind.conf

# addition kernel cmdline
OPTIONS="root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT quiet loglevel=4 mem_sleep_default=deep i915.modeset=1 video=1920x1080"
```
/boot/efi/EFI/refind/refind.conf
```
timeout 5
use_nvram false
scanfor internal,optical,manual
also_scan_dirs void/ROOT/boot
dont_scan_volumes FIRE1TB-EFI,FIRE1TB-tank,KC1TB-EFI,KC2TB-EFI,KC2TB-tank,WD1TB-EFI,WD1TB-tank
resolution 1920 1080
```
_scanfor internal_ works as it takes _also_scan_dirs_ as a prefix to where to find _vmlinuz_ and _initramfs_ files.

However, manual stanzas generated by _/etc/kernel.d/post-install/50-refind_ hook get me nowhere near bootable entries.

The patch that I came up with may not be perfect but it works on my installation.

Further testing is needed, especially for people with EFI mounted at /boot and using filesystems other than btrfs. 

To test the changes one needs to run xbps-reconfigure -f linux6.6 or whichever kernel one's running (also make sure to adjust the settings in _/etc/default/refind-kernel-hook.conf_)


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

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

From 11c917a0a353e4dfde7d940ef4fcdebca1be900f Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH 1/4] refind: add BOOT_PREFIX and LABEL for misc setups

---
 srcpkgs/refind/files/kernel.post-install     | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf |  8 +++++++-
 srcpkgs/refind/template                      |  3 +--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..0a31aa747fe563 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -20,14 +20,17 @@ touch "$REFIND_CONF"
 
 tmpfile=$(mktemp /tmp/refind.XXXXXXX)
 
+: ${REFIND_LABEL:="Void Linux"}
+: ${REFIND_BOOT_PREFIX:=""}
+
 zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
-	volume   "Void Linux"
-	loader   /vmlinuz-$VERSION
-	initrd   /initramfs-$VERSION.img
-	options  "$OPTIONS"
+        volume   "$REFIND_LABEL"
+        loader   $REFIND_BOOT_PREFIX/vmlinuz-$VERSION
+        initrd   $REFIND_BOOT_PREFIX/initramfs-$VERSION.img
+        options  "$OPTIONS"
 }
 EOF
 )
diff --git a/srcpkgs/refind/files/refind-kernel-hook.conf b/srcpkgs/refind/files/refind-kernel-hook.conf
index 5c48e89ebedad3..61b7ae64284a8a 100644
--- a/srcpkgs/refind/files/refind-kernel-hook.conf
+++ b/srcpkgs/refind/files/refind-kernel-hook.conf
@@ -18,5 +18,11 @@ UPDATE_REFIND_CONF=0
 # /efi/EFI/BOOT/refind.conf
 REFIND_CONF=/boot/EFI/refind/refind.conf
 
-# addition kernel cmdline
+# Set the label of the Void Linux filesystem
+REFIND_LABEL="Void Linux"
+
+# Set the path pointing to where rEFInd should look for vmlinuz and initramfs files, e.g. /boot
+REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/template b/srcpkgs/refind/template
index 94eda5ffc19543..54725bff299a9e 100644
--- a/srcpkgs/refind/template
+++ b/srcpkgs/refind/template
@@ -1,7 +1,7 @@
 # Template file for 'refind'
 pkgname=refind
 version=0.14.0.2
-revision=2
+revision=3
 archs="x86_64* i686* aarch64*"
 makedepends="gnu-efi-libs"
 depends="bash dosfstools efibootmgr"
@@ -73,7 +73,6 @@ do_install() {
 	vinstall gptsync/gptsync_${_EFI_ARCH}.efi 644 \
 		usr/share/refind/tools_${_EFI_ARCH}/
 
-
 	vinstall "${FILESDIR}/refind-kernel-hook.conf" 644 etc/default
 	vinstall ${FILESDIR}/kernel.post-install 744 \
 		etc/kernel.d/post-install 50-refind

From af18344517fe4da3708596b94b5081bb6b970e5c Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Fri, 8 Mar 2024 17:36:04 +0100
Subject: [PATCH 2/4] refind: fix binutils 2.38+ for aarch64

---
 ...ile-support-and-fix-binutils-aarch64.patch | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch

diff --git a/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch b/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
new file mode 100644
index 00000000000000..58bf38b85cbd03
--- /dev/null
+++ b/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
@@ -0,0 +1,44 @@
+--- a/Make.common
++++ b/Make.common
+@@ -40,21 +40,13 @@
+ # Note: TIANOBASE is defined in master Makefile and exported
+ GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
+ prefix          = /usr/bin/
+-ifeq ($(ARCH),aarch64)
+-  CC            = $(prefix)aarch64-linux-gnu-gcc
+-  AS            = $(prefix)aarch64-linux-gnu-as
+-  LD            = $(prefix)aarch64-linux-gnu-ld
+-  AR            = $(prefix)aarch64-linux-gnu-ar
+-  RANLIB        = $(prefix)aarch64-linux-gnu-ranlib
+-  OBJCOPY       = $(prefix)aarch64-linux-gnu-objcopy
+-else
+-  CC            = $(prefix)gcc
+-  AS            = $(prefix)as
+-  LD            = $(prefix)ld
+-  AR            = $(prefix)ar
+-  RANLIB        = $(prefix)ranlib
+-  OBJCOPY       = $(prefix)objcopy
+-endif
++
++CC            = $(prefix)$(CROSS_COMPILE)gcc
++AS            = $(prefix)$(CROSS_COMPILE)as
++LD            = $(prefix)$(CROSS_COMPILE)ld
++AR            = $(prefix)$(CROSS_COMPILE)ar
++RANLIB        = $(prefix)$(CROSS_COMPILE)ranlib
++OBJCOPY       = $(prefix)$(CROSS_COMPILE)objcopy
+ 
+ ifeq ($(MAKEWITH),TIANO)
+ # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, GCC46, or GCC47)
+@@ -148,8 +140,10 @@
+ 
+ ifeq ($(ARCH), aarch64)
+   GNUEFI_CFLAGS += -DEFIAARCH64
+-  FORMAT          = -O binary
+-  FORMAT_DRIVER   = -O binary
++  ifneq ($(OBJCOPY_LT_2_38),)
++    FORMAT = -O binary
++    FORMAT_DRIVER = -O binary
++  endif
+   SUBSYSTEM_LDFLAG = -defsym=EFI_SUBSYSTEM=0xa
+   LDFLAGS         += --warn-common --no-undefined --fatal-warnings
+ 

From 8f60d7410c76cd192636349b19231eb07a082e4c Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Fri, 8 Mar 2024 17:41:37 +0100
Subject: [PATCH 3/4] refind: remove obsolete patch

---
 .../patches/add-cross-compile-support.patch   | 31 -------------------
 1 file changed, 31 deletions(-)
 delete mode 100644 srcpkgs/refind/patches/add-cross-compile-support.patch

diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support.patch
deleted file mode 100644
index e506758d3297ed..00000000000000
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/Make.common
-+++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
- # Note: TIANOBASE is defined in master Makefile and exported
- GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
- prefix          = /usr/bin/
--ifeq ($(ARCH),aarch64)
--  CC            = $(prefix)aarch64-linux-gnu-gcc
--  AS            = $(prefix)aarch64-linux-gnu-as
--  LD            = $(prefix)aarch64-linux-gnu-ld
--  AR            = $(prefix)aarch64-linux-gnu-ar
--  RANLIB        = $(prefix)aarch64-linux-gnu-ranlib
--  OBJCOPY       = $(prefix)aarch64-linux-gnu-objcopy
--else
--  CC            = $(prefix)gcc
--  AS            = $(prefix)as
--  LD            = $(prefix)ld
--  AR            = $(prefix)ar
--  RANLIB        = $(prefix)ranlib
--  OBJCOPY       = $(prefix)objcopy
--endif
-+
-+CC            = $(prefix)$(CROSS_COMPILE)gcc
-+AS            = $(prefix)$(CROSS_COMPILE)as
-+LD            = $(prefix)$(CROSS_COMPILE)ld
-+AR            = $(prefix)$(CROSS_COMPILE)ar
-+RANLIB        = $(prefix)$(CROSS_COMPILE)ranlib
-+OBJCOPY       = $(prefix)$(CROSS_COMPILE)objcopy
- 
- ifeq ($(MAKEWITH),TIANO)
- # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, GCC46, or GCC47)

From 357c1982f527aef11610be0073b70585e833efee Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Sat, 16 Mar 2024 22:02:28 +0100
Subject: [PATCH 4/4] refind: sanitize entries and comment out vars

---
 srcpkgs/refind/files/kernel.post-install     | 4 ++--
 srcpkgs/refind/files/refind-kernel-hook.conf | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index 0a31aa747fe563..6262cecf5f445e 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -28,8 +28,8 @@ zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
         volume   "$REFIND_LABEL"
-        loader   $REFIND_BOOT_PREFIX/vmlinuz-$VERSION
-        initrd   $REFIND_BOOT_PREFIX/initramfs-$VERSION.img
+        loader   "$REFIND_BOOT_PREFIX/vmlinuz-$VERSION"
+        initrd   "$REFIND_BOOT_PREFIX/initramfs-$VERSION.img"
         options  "$OPTIONS"
 }
 EOF
diff --git a/srcpkgs/refind/files/refind-kernel-hook.conf b/srcpkgs/refind/files/refind-kernel-hook.conf
index 61b7ae64284a8a..9572534db7eada 100644
--- a/srcpkgs/refind/files/refind-kernel-hook.conf
+++ b/srcpkgs/refind/files/refind-kernel-hook.conf
@@ -18,11 +18,11 @@ UPDATE_REFIND_CONF=0
 # /efi/EFI/BOOT/refind.conf
 REFIND_CONF=/boot/EFI/refind/refind.conf
 
-# Set the label of the Void Linux filesystem
-REFIND_LABEL="Void Linux"
+# Set a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
 
-# Set the path pointing to where rEFInd should look for vmlinuz and initramfs files, e.g. /boot
-REFIND_BOOT_PREFIX=""
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
 
 # Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"

  parent reply	other threads:[~2024-03-16 21:03 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-24  1:28 [PR PATCH] " slymattz
2024-02-24 11:19 ` [PR PATCH] [Updated] " slymattz
2024-02-25 13:45 ` slymattz
2024-02-25 14:51 ` sgn
2024-02-25 14:53 ` [PR REVIEW] " sgn
2024-02-25 15:01 ` [PR PATCH] [Updated] " slymattz
2024-02-25 15:34 ` [PR REVIEW] " ahesford
2024-02-25 16:06 ` slymattz
2024-02-25 16:12 ` slymattz
2024-02-25 16:43 ` [PR PATCH] [Updated] " slymattz
2024-02-25 16:55 ` slymattz
2024-02-25 16:59 ` slymattz
2024-02-27 14:32 ` slymattz
2024-02-27 14:35 ` slymattz
2024-03-04 11:01 ` [PR REVIEW] " slymattz
2024-03-06 19:49 ` [PR PATCH] [Updated] " slymattz
2024-03-06 20:27 ` slymattz
2024-03-07 12:55 ` slymattz
2024-03-08 16:39 ` [PR PATCH] [Updated] " slymattz
2024-03-08 16:41 ` slymattz
2024-03-09  0:49 ` sgn
2024-03-09  8:21 ` slymattz
2024-03-09 20:30 ` slymattz
2024-03-14 19:05 ` slymattz
2024-03-15 18:15 ` [PR REVIEW] " ahesford
2024-03-15 18:15 ` ahesford
2024-03-15 18:15 ` ahesford
2024-03-16 21:03 ` slymattz [this message]
2024-03-16 21:09 ` [PR PATCH] [Updated] " slymattz
2024-03-18 15:18 ` ahesford
2024-03-18 17:33 ` [PR PATCH] [Updated] " slymattz
2024-03-18 17:36 ` slymattz
2024-03-18 17:37 ` slymattz
2024-03-18 18:50 ` [PR PATCH] [Updated] " slymattz
2024-03-18 18:53 ` slymattz
2024-03-18 19:09 ` slymattz
2024-03-18 19:40 ` [PR PATCH] [Updated] " slymattz
2024-03-18 19:47 ` slymattz
2024-03-18 20:12 ` slymattz
2024-03-18 20:13 ` slymattz
2024-03-19 18:31 ` slymattz
2024-03-21 14:49 ` [PR PATCH] [Updated] " slymattz
2024-03-21 15:23 ` [PR PATCH] [Closed]: " ahesford

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=20240316210333.D66832737B@inbox.vuxu.org \
    --to=slymattz@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).