Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] refind: account for btrfs setups when generating manual stanzas
@ 2024-02-24  1:28 slymattz
  2024-02-24 11:19 ` [PR PATCH] [Updated] " slymattz
                   ` (41 more replies)
  0 siblings, 42 replies; 43+ messages in thread
From: slymattz @ 2024-02-24  1:28 UTC (permalink / raw)
  To: ml

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

There is a new 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: **briefly**

#### 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 vmlinux 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.


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: 1736 bytes --]

From 9b3a34a754a12cfa73921bf2a4f8aea32cdb5fba Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <401237-mattz7@users.noreply.gitlab.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH] refind: account for btrfs setups when generating manual
 stanzas

---
 srcpkgs/refind/files/kernel.post-install | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..3b416721222f3e 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -22,12 +22,27 @@ tmpfile=$(mktemp /tmp/refind.XXXXXXX)
 
 zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 
+# establish ESP mounting point
+efipath=$(echo $REFIND_CONF | sed 's/\/EFI.*$//')
+if [ $efipath = "/boot" ]; then # mounting ESP to /boot with vmlinuz- and intramfs- stored on the EFI partition
+    efiprefix=""
+else
+    efiprefix="\/$(dirname $efipath)" # mounting ESP to /boot/efi or another path
+fi
+rootfslabel=$(blkid -s LABEL -o value $(df -P / | awk 'NR==2 {print $1}'))
+
+# account for the BTRFS setups including subvolumes
+if df -T / | awk 'NR==2 && $2 == "btrfs" {print "Root filesystem is Btrfs"}'; then
+    rootfssubvol=$(btrfs subvolume show / | head -n1)
+    echo "Btrfs subvol for ROOT is: $rootfssubvol"
+fi
+
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
-	volume   "Void Linux"
-	loader   /vmlinuz-$VERSION
-	initrd   /initramfs-$VERSION.img
-	options  "$OPTIONS"
+        volume   "$rootfslabel"
+        loader   ${rootfssubvol}${efiprefix}/vmlinuz-$VERSION
+        initrd   ${rootfssubvol}${efiprefix}/initramfs-$VERSION.img
+        options  "$OPTIONS"
 }
 EOF
 )

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
@ 2024-02-24 11:19 ` slymattz
  2024-02-25 13:45 ` slymattz
                   ` (40 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-24 11:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2248 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: **briefly**

#### 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 vmlinux 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.


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: 3147 bytes --]

From 9b3a34a754a12cfa73921bf2a4f8aea32cdb5fba Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <401237-mattz7@users.noreply.gitlab.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH 1/2] refind: account for btrfs setups when generating manual
 stanzas

---
 srcpkgs/refind/files/kernel.post-install | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..3b416721222f3e 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -22,12 +22,27 @@ tmpfile=$(mktemp /tmp/refind.XXXXXXX)
 
 zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 
+# establish ESP mounting point
+efipath=$(echo $REFIND_CONF | sed 's/\/EFI.*$//')
+if [ $efipath = "/boot" ]; then # mounting ESP to /boot with vmlinuz- and intramfs- stored on the EFI partition
+    efiprefix=""
+else
+    efiprefix="\/$(dirname $efipath)" # mounting ESP to /boot/efi or another path
+fi
+rootfslabel=$(blkid -s LABEL -o value $(df -P / | awk 'NR==2 {print $1}'))
+
+# account for the BTRFS setups including subvolumes
+if df -T / | awk 'NR==2 && $2 == "btrfs" {print "Root filesystem is Btrfs"}'; then
+    rootfssubvol=$(btrfs subvolume show / | head -n1)
+    echo "Btrfs subvol for ROOT is: $rootfssubvol"
+fi
+
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
-	volume   "Void Linux"
-	loader   /vmlinuz-$VERSION
-	initrd   /initramfs-$VERSION.img
-	options  "$OPTIONS"
+        volume   "$rootfslabel"
+        loader   ${rootfssubvol}${efiprefix}/vmlinuz-$VERSION
+        initrd   ${rootfssubvol}${efiprefix}/initramfs-$VERSION.img
+        options  "$OPTIONS"
 }
 EOF
 )

From f9432ff5b259c594d23aab9cd5c20a17b363c7db Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <401237-mattz7@users.noreply.gitlab.com>
Date: Sat, 24 Feb 2024 12:19:35 +0100
Subject: [PATCH 2/2] refind: add btrfs-progs to depends

---
 srcpkgs/refind/template | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/refind/template b/srcpkgs/refind/template
index 94eda5ffc19543..0296c9f5026b56 100644
--- a/srcpkgs/refind/template
+++ b/srcpkgs/refind/template
@@ -4,7 +4,7 @@ version=0.14.0.2
 revision=2
 archs="x86_64* i686* aarch64*"
 makedepends="gnu-efi-libs"
-depends="bash dosfstools efibootmgr"
+depends="bash dosfstools efibootmgr btrfs-progs"
 short_desc="EFI boot manager utility"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="GPL-3.0-only, BSD-3-Clause, BSD-2-Clause, GPL-2.0-only, LGPL-2.1-only"
@@ -73,10 +73,7 @@ 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
-	vinstall ${FILESDIR}/kernel.post-remove 744 \
-		etc/kernel.d/post-remove 50-refind
+	vinstall "${FILESDIR}/kernel.post-install" 744 etc/kernel.d/post-install 50-refind
+	vinstall "${FILESDIR}/kernel.post-remove" 744 etc/kernel.d/post-remove 50-refind
 }

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
  2024-02-24 11:19 ` [PR PATCH] [Updated] " slymattz
@ 2024-02-25 13:45 ` slymattz
  2024-02-25 14:51 ` sgn
                   ` (39 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 13:45 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1962945972

Comment:
@sgn @ahesford May I ask you to please take a look at this commit. I already set my git commit email to a non-no-reply one. I would probably have to git-rebase or something. 

As for the errors in compiling for aarch64, I have no idea why this package didn't compile successfully this time around as I had made no changes to the compilation phase but only to the post-install kernel hook.

Thank you in advance :)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas 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
                   ` (38 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: sgn @ 2024-02-25 14:51 UTC (permalink / raw)
  To: ml

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

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1962964315

Comment:
> @sgn @ahesford May I ask you to please take a look at this commit. I already set my git commit email to a non-no-reply one. I would probably have to git-rebase or something.

`git commit --amend --reset-author`

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (2 preceding siblings ...)
  2024-02-25 14:51 ` sgn
@ 2024-02-25 14:53 ` sgn
  2024-02-25 15:01 ` [PR PATCH] [Updated] " slymattz
                   ` (37 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: sgn @ 2024-02-25 14:53 UTC (permalink / raw)
  To: ml

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

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1501837103

Comment:
nope!

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (3 preceding siblings ...)
  2024-02-25 14:53 ` [PR REVIEW] " sgn
@ 2024-02-25 15:01 ` slymattz
  2024-02-25 15:34 ` [PR REVIEW] " ahesford
                   ` (36 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 15:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2433 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: **briefly**

#### Local build testing
I built this PR locally for my native architecture, x86_64-glibc

#### 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: 2751 bytes --]

From 9b3a34a754a12cfa73921bf2a4f8aea32cdb5fba Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <401237-mattz7@users.noreply.gitlab.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH 1/2] refind: account for btrfs setups when generating manual
 stanzas

---
 srcpkgs/refind/files/kernel.post-install | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe0..3b416721222f3 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -22,12 +22,27 @@ tmpfile=$(mktemp /tmp/refind.XXXXXXX)
 
 zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 
+# establish ESP mounting point
+efipath=$(echo $REFIND_CONF | sed 's/\/EFI.*$//')
+if [ $efipath = "/boot" ]; then # mounting ESP to /boot with vmlinuz- and intramfs- stored on the EFI partition
+    efiprefix=""
+else
+    efiprefix="\/$(dirname $efipath)" # mounting ESP to /boot/efi or another path
+fi
+rootfslabel=$(blkid -s LABEL -o value $(df -P / | awk 'NR==2 {print $1}'))
+
+# account for the BTRFS setups including subvolumes
+if df -T / | awk 'NR==2 && $2 == "btrfs" {print "Root filesystem is Btrfs"}'; then
+    rootfssubvol=$(btrfs subvolume show / | head -n1)
+    echo "Btrfs subvol for ROOT is: $rootfssubvol"
+fi
+
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
-	volume   "Void Linux"
-	loader   /vmlinuz-$VERSION
-	initrd   /initramfs-$VERSION.img
-	options  "$OPTIONS"
+        volume   "$rootfslabel"
+        loader   ${rootfssubvol}${efiprefix}/vmlinuz-$VERSION
+        initrd   ${rootfssubvol}${efiprefix}/initramfs-$VERSION.img
+        options  "$OPTIONS"
 }
 EOF
 )

From 5a8f305b99b2003adcfd8ef9bd6ae02a06756600 Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Sun, 25 Feb 2024 15:58:55 +0100
Subject: [PATCH 2/2] refind: remove btrfs-progs from depends

---
 srcpkgs/refind/template | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/srcpkgs/refind/template b/srcpkgs/refind/template
index 94eda5ffc1954..5e28116894571 100644
--- a/srcpkgs/refind/template
+++ b/srcpkgs/refind/template
@@ -73,10 +73,7 @@ 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
-	vinstall ${FILESDIR}/kernel.post-remove 744 \
-		etc/kernel.d/post-remove 50-refind
+	vinstall "${FILESDIR}/kernel.post-install" 744 etc/kernel.d/post-install 50-refind
+	vinstall "${FILESDIR}/kernel.post-remove" 744 etc/kernel.d/post-remove 50-refind
 }

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (4 preceding siblings ...)
  2024-02-25 15:01 ` [PR PATCH] [Updated] " slymattz
@ 2024-02-25 15:34 ` ahesford
  2024-02-25 16:06 ` slymattz
                   ` (35 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: ahesford @ 2024-02-25 15:34 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1501843899

Comment:
These changes should be dropped. The line continuations are a bit easier to read and honor the preferred 80-column text limit.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (5 preceding siblings ...)
  2024-02-25 15:34 ` [PR REVIEW] " ahesford
@ 2024-02-25 16:06 ` slymattz
  2024-02-25 16:12 ` slymattz
                   ` (34 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 16:06 UTC (permalink / raw)
  To: ml

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

New review comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1501850156

Comment:
I like the REFIND_MENU_LABEL and REFIND_BOOT_PREFIX idea in /etc/default/refind-kernel-hook.conf. It kind of adheres to the KISS rule.

What we would need besides setting these two variables that would default to `Void Linux` and `""` respectively would be some kind of a snippet that would, for instance, find the available and explicitly installed versions of linux in REFIND_BOOT_PREFIX and add these entries to the refind.conf file and preferably remove them also when they are uninstalled (so far it has been the job of the hooks). From what I understand, we still need some kind of a trigger. If I've misinterpreted your idea, please correct me.

Left-over kernels (the ones that vkpurge can deal with) can still be detected through the internal mode in refind.conf and the setting also_scan_dirs:
```
scanfor internal,manual
also_scan_dirs boot,void/ROOT/boot
```
this internal mode works in combination with /boot/refind_linux.conf which is independent of refind.conf:
```
"Boot with standard options"  "root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT mem_sleep_default=deep i915.modeset=1 video=1920x1080 loglevel=4"
"Boot to single-user mode"    "root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT mem_sleep_default=deep i915.modeset=1 video=1920x1080 loglevel=4 single"
"Boot with minimal options"   "root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT"
```
Such "subentries" populate only one "slot" when rEFInd is launched and can be accessed after pressing TAB whereas manual stanzas (the ones in refind.conf) are separate entities in the rEFInd menu. I realize manual vs internal may sound confusing but that's the way I've seen things work in rEFInd. 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (6 preceding siblings ...)
  2024-02-25 16:06 ` slymattz
@ 2024-02-25 16:12 ` slymattz
  2024-02-25 16:43 ` [PR PATCH] [Updated] " slymattz
                   ` (33 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 16:12 UTC (permalink / raw)
  To: ml

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

New review comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1501851378

Comment:
Sorry, I think I have misread your post. Now I realize you referred to the formatting criteria. Sure, I'll drop the cosmetic changes. 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (7 preceding siblings ...)
  2024-02-25 16:12 ` slymattz
@ 2024-02-25 16:43 ` slymattz
  2024-02-25 16:55 ` slymattz
                   ` (32 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 16:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2433 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: **briefly**

#### Local build testing
I built this PR locally for my native architecture, x86_64-glibc

#### 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: 4825 bytes --]

From 9b3a34a754a12cfa73921bf2a4f8aea32cdb5fba Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <401237-mattz7@users.noreply.gitlab.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH 1/2] refind: account for btrfs setups when generating manual
 stanzas

---
 srcpkgs/refind/files/kernel.post-install | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..3b416721222f3e 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -22,12 +22,27 @@ tmpfile=$(mktemp /tmp/refind.XXXXXXX)
 
 zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 
+# establish ESP mounting point
+efipath=$(echo $REFIND_CONF | sed 's/\/EFI.*$//')
+if [ $efipath = "/boot" ]; then # mounting ESP to /boot with vmlinuz- and intramfs- stored on the EFI partition
+    efiprefix=""
+else
+    efiprefix="\/$(dirname $efipath)" # mounting ESP to /boot/efi or another path
+fi
+rootfslabel=$(blkid -s LABEL -o value $(df -P / | awk 'NR==2 {print $1}'))
+
+# account for the BTRFS setups including subvolumes
+if df -T / | awk 'NR==2 && $2 == "btrfs" {print "Root filesystem is Btrfs"}'; then
+    rootfssubvol=$(btrfs subvolume show / | head -n1)
+    echo "Btrfs subvol for ROOT is: $rootfssubvol"
+fi
+
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
-	volume   "Void Linux"
-	loader   /vmlinuz-$VERSION
-	initrd   /initramfs-$VERSION.img
-	options  "$OPTIONS"
+        volume   "$rootfslabel"
+        loader   ${rootfssubvol}${efiprefix}/vmlinuz-$VERSION
+        initrd   ${rootfssubvol}${efiprefix}/initramfs-$VERSION.img
+        options  "$OPTIONS"
 }
 EOF
 )

From ac296e2730e335c4b4ed0c36fbdada4021242600 Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Sun, 25 Feb 2024 15:58:55 +0100
Subject: [PATCH 2/2] refind: add LABEL and PREFIX variables

---
 srcpkgs/refind/files/kernel.post-install     | 24 +++++---------------
 srcpkgs/refind/files/refind-kernel-hook.conf |  8 ++++++-
 srcpkgs/refind/template                      |  1 -
 3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index 3b416721222f3e..0a31aa747fe563 100755
--- a/srcpkgs/refind/files/kernel.post-install
+++ b/srcpkgs/refind/files/kernel.post-install
@@ -20,28 +20,16 @@ touch "$REFIND_CONF"
 
 tmpfile=$(mktemp /tmp/refind.XXXXXXX)
 
-zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
-
-# establish ESP mounting point
-efipath=$(echo $REFIND_CONF | sed 's/\/EFI.*$//')
-if [ $efipath = "/boot" ]; then # mounting ESP to /boot with vmlinuz- and intramfs- stored on the EFI partition
-    efiprefix=""
-else
-    efiprefix="\/$(dirname $efipath)" # mounting ESP to /boot/efi or another path
-fi
-rootfslabel=$(blkid -s LABEL -o value $(df -P / | awk 'NR==2 {print $1}'))
+: ${REFIND_LABEL:="Void Linux"}
+: ${REFIND_BOOT_PREFIX:=""}
 
-# account for the BTRFS setups including subvolumes
-if df -T / | awk 'NR==2 && $2 == "btrfs" {print "Root filesystem is Btrfs"}'; then
-    rootfssubvol=$(btrfs subvolume show / | head -n1)
-    echo "Btrfs subvol for ROOT is: $rootfssubvol"
-fi
+zversion=$(echo "$VERSION" | sed 's/[.]/[.]/g')
 
 zentry=$(cat <<EOF
 menuentry "Void Linux $VERSION" {
-        volume   "$rootfslabel"
-        loader   ${rootfssubvol}${efiprefix}/vmlinuz-$VERSION
-        initrd   ${rootfssubvol}${efiprefix}/initramfs-$VERSION.img
+        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..9282941fd7114c 100644
--- a/srcpkgs/refind/template
+++ b/srcpkgs/refind/template
@@ -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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (8 preceding siblings ...)
  2024-02-25 16:43 ` [PR PATCH] [Updated] " slymattz
@ 2024-02-25 16:55 ` slymattz
  2024-02-25 16:59 ` slymattz
                   ` (31 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 16:55 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1962998828

Comment:
[ac296e2](https://github.com/void-linux/void-packages/pull/48906/commits/ac296e2730e335c4b4ed0c36fbdada4021242600)
I tested the following 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

# Set the label of the Void Linux filesystem
REFIND_LABEL="KC1TB-tank"

# Set the path relative to / where rEFInd should look for vmlinuz and initramfs files 
REFIND_BOOT_PREFIX=void/ROOT/boot

# additional kernel cmdline
OPTIONS="root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT mem_sleep_default=deep i915.modeset=1 video=1920x1080 loglevel=4"
```
After running `xbps-reconfigure -f linux6.6 linux6.1` and rebooting, the manual boot entries boot successfully :)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (9 preceding siblings ...)
  2024-02-25 16:55 ` slymattz
@ 2024-02-25 16:59 ` slymattz
  2024-02-27 14:32 ` slymattz
                   ` (30 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-25 16:59 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1962998828

Comment:
[ac296e2](https://github.com/void-linux/void-packages/pull/48906/commits/ac296e2730e335c4b4ed0c36fbdada4021242600)
I tested the following 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

# Set the label of the Void Linux filesystem
REFIND_LABEL="KC1TB-tank"

# Set the path pointing to where rEFInd should look for vmlinuz and initramfs files, e.g. /boot
REFIND_BOOT_PREFIX=void/ROOT/boot

# Additional kernel cmdline parameters
OPTIONS="root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT mem_sleep_default=deep i915.modeset=1 video=1920x1080 loglevel=4"
```
After running `xbps-reconfigure -f linux6.6 linux6.1` and rebooting, the manual boot entries boot successfully :)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (10 preceding siblings ...)
  2024-02-25 16:59 ` slymattz
@ 2024-02-27 14:32 ` slymattz
  2024-02-27 14:35 ` slymattz
                   ` (29 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-27 14:32 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1966683233

Comment:
@sgn maintainer ping

Although initially my PR focused on btrfs setups, the simple changes proposed by @ahesford in both _/etc/default/refind-kernel-hook.conf_ and _/etc/kernel.d/post-install/50-refind_ are more universal as they can save a lot of trouble when installing  Void manually (either through chroot from a different distribution or xchroot from Void). My argument is that these ways of installation are officially documented in Void Linux Docs (so refind could include the appropriate changes). On top of that, the part where `mkfs.ext4` is listed (see https://docs.voidlinux.org/installation/guides/chroot.html#prepare-filesystems) doesn't mention the necessity to use `-L "Void Linux"` for painless installation of refind. Even if it did mention this detail, I believe REFIND_CONF, REFIND_LABEL and REFIND_BOOT_PREFIX would have to be tweaked if we were to retain the partition-and-filesystem setup proposed in Docs (see https://docs.voidlinux.org/installation/guides/chroot.html#configure-fstab).

P.S. the first workflow run failed for aarch64 (both glibc and musl) but I ran a cross-compilation of aarch64-glibc on the upstream tree yesterday and it succeeded this time so the compilation errors must've had to do with some dependency incompatibilities at the time or something. That's my guess. 

What do y'all think?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (11 preceding siblings ...)
  2024-02-27 14:32 ` slymattz
@ 2024-02-27 14:35 ` slymattz
  2024-03-04 11:01 ` [PR REVIEW] " slymattz
                   ` (28 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-02-27 14:35 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1966683233

Comment:
@sgn maintainer ping

Although initially my PR focused on btrfs setups, the simple changes proposed by @ahesford in both _/etc/default/refind-kernel-hook.conf_ and _/etc/kernel.d/post-install/50-refind_ are more universal as they can save a lot of trouble when installing  Void manually (either through chroot from a different distribution or xchroot from Void). My argument is that these ways of installation are officially documented in Void Linux Docs (so refind could include the appropriate changes). On top of that, the part where `mkfs.ext4` is listed (see https://docs.voidlinux.org/installation/guides/chroot.html#prepare-filesystems) doesn't mention the necessity to use `-L "Void Linux"` for painless installation of refind. Even if it did mention this detail, I believe REFIND_CONF and REFIND_BOOT_PREFIX would have to be tweaked if we were to retain the partition-and-filesystem setup proposed in Docs (see https://docs.voidlinux.org/installation/guides/chroot.html#configure-fstab).

P.S. the first workflow run failed for aarch64 (both glibc and musl) but I ran a cross-compilation of aarch64-glibc on the upstream tree yesterday and it succeeded this time so the compilation errors must've had to do with some dependency incompatibilities at the time or something. That's my guess. 

What do y'all think?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (12 preceding siblings ...)
  2024-02-27 14:35 ` slymattz
@ 2024-03-04 11:01 ` slymattz
  2024-03-06 19:49 ` [PR PATCH] [Updated] " slymattz
                   ` (27 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-04 11:01 UTC (permalink / raw)
  To: ml

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

New review comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1501850156

Comment:
I like the REFIND_MENU_LABEL and REFIND_BOOT_PREFIX idea in /etc/default/refind-kernel-hook.conf. It kind of adheres to the KISS rule.

What we would need besides setting these two variables that would default to `Void Linux` and `""` respectively would be some kind of a snippet that would, for instance, find the available and explicitly installed versions of linux in REFIND_BOOT_PREFIX and add these entries to the refind.conf file and preferably remove them also when they are uninstalled or vmkpurge-d (so far it has been the job of the hooks). From what I understand, we still need some kind of a trigger. If I've misinterpreted your idea, please correct me.

Both installed kernels and left-over ones can still be detected through the internal mode in refind.conf and the setting also_scan_dirs:
```
scanfor internal,manual
also_scan_dirs boot,void/ROOT/boot
```
this internal mode works in combination with /boot/refind_linux.conf which is independent of refind.conf:
```
"Boot with standard options"  "root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT mem_sleep_default=deep i915.modeset=1 video=1920x1080 loglevel=4"
"Boot to single-user mode"    "root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT mem_sleep_default=deep i915.modeset=1 video=1920x1080 loglevel=4 single"
"Boot with minimal options"   "root=UUID=a9ee6e45-d348-4214-9560-0d0c73ab8077 ro rootflags=subvol=void/ROOT"
```
Such "subentries" populate only one "slot" when rEFInd is launched and can be accessed after pressing TAB whereas manual stanzas (the ones in refind.conf) are separate entities in the rEFInd menu. I realize manual vs internal may sound confusing but that's the way I've seen things work in rEFInd. 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (13 preceding siblings ...)
  2024-03-04 11:01 ` [PR REVIEW] " slymattz
@ 2024-03-06 19:49 ` slymattz
  2024-03-06 20:27 ` slymattz
                   ` (26 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-06 19:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2499 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: **briefly**

#### 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: 2387 bytes --]

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

refind: add LABEL and PREFIX variables
---
 srcpkgs/refind/files/kernel.post-install     | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf |  8 +++++++-
 srcpkgs/refind/template                      |  1 -
 3 files changed, 14 insertions(+), 6 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..9282941fd7114c 100644
--- a/srcpkgs/refind/template
+++ b/srcpkgs/refind/template
@@ -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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (14 preceding siblings ...)
  2024-03-06 19:49 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-06 20:27 ` slymattz
  2024-03-07 12:55 ` slymattz
                   ` (25 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-06 20:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2499 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: **briefly**

#### 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: 2552 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] 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (15 preceding siblings ...)
  2024-03-06 20:27 ` slymattz
@ 2024-03-07 12:55 ` slymattz
  2024-03-08 16:39 ` [PR PATCH] [Updated] " slymattz
                   ` (24 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-07 12:55 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1983451008

Comment:
As rEFInd won't cross-compile for aarch64 (both glibc and musl), I created this bug report https://github.com/void-linux/void-packages/issues/49170 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (16 preceding siblings ...)
  2024-03-07 12:55 ` slymattz
@ 2024-03-08 16:39 ` slymattz
  2024-03-08 16:41 ` slymattz
                   ` (23 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-08 16:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2499 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: **briefly**

#### 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: 4888 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/2] 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/2] 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
+ 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (17 preceding siblings ...)
  2024-03-08 16:39 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-08 16:41 ` slymattz
  2024-03-09  0:49 ` sgn
                   ` (22 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-08 16:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2499 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: **briefly**

#### 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: 6779 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/3] 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/3] 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/3] 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)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (18 preceding siblings ...)
  2024-03-08 16:41 ` slymattz
@ 2024-03-09  0:49 ` sgn
  2024-03-09  8:21 ` slymattz
                   ` (21 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: sgn @ 2024-03-09  0:49 UTC (permalink / raw)
  To: ml

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

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1986641229

Comment:
Why do you remove the patch?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (19 preceding siblings ...)
  2024-03-09  0:49 ` sgn
@ 2024-03-09  8:21 ` slymattz
  2024-03-09 20:30 ` slymattz
                   ` (20 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-09  8:21 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1986791751

Comment:
> Why do you remove the patch?

I combined [add-cross-compile-support.patch](https://github.com/void-linux/void-packages/pull/48906/commits/8f60d7410c76cd192636349b19231eb07a082e4c#diff-332203e155a15c1ddecac26ff4800e45423c1d6c701dc0cd51b672292419710f) with your patch to fix aarch64 build. I thought that was the right way to do it since both patches make changes in Make.common

If that's not the right way, please let me know.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (20 preceding siblings ...)
  2024-03-09  8:21 ` slymattz
@ 2024-03-09 20:30 ` slymattz
  2024-03-14 19:05 ` slymattz
                   ` (19 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-09 20:30 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1986791751

Comment:
@sgn When you take a look at the entire thing - https://github.com/void-linux/void-packages/pull/48906/files, you'll see that the patch is not removed but it comes with your new patch. Also the name is changed from _add-cross-compile-support.patch_ to _add-cross-compile-support-and-fix-binutils-aarch64.patch_ to reflect the added changes. If you want me to squash any of the three commits, please let me know.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (21 preceding siblings ...)
  2024-03-09 20:30 ` slymattz
@ 2024-03-14 19:05 ` slymattz
  2024-03-15 18:15 ` [PR REVIEW] " ahesford
                   ` (18 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-14 19:05 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-1998168969

Comment:
@ahesford @sgn is this PR mergable?

If I were to argue for the merge, I'd say that not only does it introduce sgn's patch that fixes aarch64 build, but it also makes necessary changes in the post-install kernel hook. So far, the hook has only been able to generate entries that work with EFI mounted in /boot. I'm really surprised no one ever raised this issue before. 

![refind-path](https://github.com/void-linux/void-packages/assets/76883004/57451059-9571-487c-9e75-ef74ebb4bbd7)
Source: https://wiki.archlinux.org/title/REFInd#For_manual_boot_stanzas

Given what I said before, I would even argue that the defaults could be `REFIND_CONF=/boot/efi/EFI/refind/refind.conf` and `REFIND_BOOT_PREFIX=/boot` since this is the standard approach of keeping kernels as part of the ROOTFS filesystem. Mounting the EFI part in /boot/efi (as opposed to /boot) is also recommended in the official Void docs. Although some people do store kernels on the EFI partition, I doubt whether this is a standard approach.

Looking forward to hearing from you guys :)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (22 preceding siblings ...)
  2024-03-14 19:05 ` slymattz
@ 2024-03-15 18:15 ` ahesford
  2024-03-15 18:15 ` ahesford
                   ` (17 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: ahesford @ 2024-03-15 18:15 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1526660826

Comment:
Leave the value commented out by default, and make the leading comment more descriptive:
```suggestion
# Set a custom label for Void boot entries
#REFIND_LABEL="Void Linux"
```

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (24 preceding siblings ...)
  2024-03-15 18:15 ` ahesford
@ 2024-03-15 18:15 ` ahesford
  2024-03-16 21:03 ` [PR PATCH] [Updated] " slymattz
                   ` (15 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: ahesford @ 2024-03-15 18:15 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1526663218

Comment:
As above, leave the default value commented and perhaps make the documentation more explicit:
```suggestion
# Prefix prepended to kernel and initramfs paths in Void boot entries
#REFIND_BOOT_PREFIX=""
```

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR REVIEW] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (23 preceding siblings ...)
  2024-03-15 18:15 ` [PR REVIEW] " ahesford
@ 2024-03-15 18:15 ` ahesford
  2024-03-15 18:15 ` ahesford
                   ` (16 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: ahesford @ 2024-03-15 18:15 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#discussion_r1526658520

Comment:
This should probably be quoted. `$REFIND_BOOT_PREFIX` is unsanitized and might contain spaces that may produce unexpected side effects.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (25 preceding siblings ...)
  2024-03-15 18:15 ` ahesford
@ 2024-03-16 21:03 ` slymattz
  2024-03-16 21:09 ` slymattz
                   ` (14 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-16 21:03 UTC (permalink / raw)
  To: ml

[-- 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"

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (26 preceding siblings ...)
  2024-03-16 21:03 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-16 21:09 ` slymattz
  2024-03-18 15:18 ` ahesford
                   ` (13 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-16 21:09 UTC (permalink / raw)
  To: ml

[-- 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: 4110 bytes --]

From 5126b01cf0d79664f58f569e566df03d32d69916 Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH] refind: add BOOT_PREFIX and LABEL for misc setups         fix
 binutils 2.38+ for aarch64

---
 srcpkgs/refind/files/kernel.post-install          | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf      |  8 +++++++-
 ...ompile-support-and-fix-binutils-aarch64.patch} | 15 ++++++++++++++-
 srcpkgs/refind/template                           |  3 +--
 4 files changed, 29 insertions(+), 8 deletions(-)
 rename srcpkgs/refind/patches/{add-cross-compile-support.patch => add-cross-compile-support-and-fix-binutils-aarch64.patch} (75%)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..6262cecf5f445e 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..9572534db7eada 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 a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
+
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
similarity index 75%
rename from srcpkgs/refind/patches/add-cross-compile-support.patch
rename to srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
index e506758d3297ed..58bf38b85cbd03 100644
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ b/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
@@ -1,6 +1,6 @@
 --- a/Make.common
 +++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
+@@ -40,21 +40,13 @@
  # Note: TIANOBASE is defined in master Makefile and exported
  GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
  prefix          = /usr/bin/
@@ -29,3 +29,16 @@
  
  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
+ 
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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (27 preceding siblings ...)
  2024-03-16 21:09 ` slymattz
@ 2024-03-18 15:18 ` ahesford
  2024-03-18 17:33 ` [PR PATCH] [Updated] " slymattz
                   ` (12 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: ahesford @ 2024-03-18 15:18 UTC (permalink / raw)
  To: ml

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

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004194785

Comment:
I don't think you should rename the patch; its original name is sufficiently descriptive, and changing the name makes tracking changes a little more confusing.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (28 preceding siblings ...)
  2024-03-18 15:18 ` ahesford
@ 2024-03-18 17:33 ` slymattz
  2024-03-18 17:36 ` slymattz
                   ` (11 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 17:33 UTC (permalink / raw)
  To: ml

[-- 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: 6329 bytes --]

From 5126b01cf0d79664f58f569e566df03d32d69916 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/2] refind: add BOOT_PREFIX and LABEL for misc setups        
 fix binutils 2.38+ for aarch64

---
 srcpkgs/refind/files/kernel.post-install          | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf      |  8 +++++++-
 ...ompile-support-and-fix-binutils-aarch64.patch} | 15 ++++++++++++++-
 srcpkgs/refind/template                           |  3 +--
 4 files changed, 29 insertions(+), 8 deletions(-)
 rename srcpkgs/refind/patches/{add-cross-compile-support.patch => add-cross-compile-support-and-fix-binutils-aarch64.patch} (75%)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..6262cecf5f445e 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..9572534db7eada 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 a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
+
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
similarity index 75%
rename from srcpkgs/refind/patches/add-cross-compile-support.patch
rename to srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
index e506758d3297ed..58bf38b85cbd03 100644
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ b/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
@@ -1,6 +1,6 @@
 --- a/Make.common
 +++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
+@@ -40,21 +40,13 @@
  # Note: TIANOBASE is defined in master Makefile and exported
  GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
  prefix          = /usr/bin/
@@ -29,3 +29,16 @@
  
  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
+ 
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 7ea7607162f10ecc955db617c232d3585630e176 Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Mon, 18 Mar 2024 18:31:10 +0100
Subject: [PATCH 2/2] refind: rename patch

---
 .../patches/add-cross-compile-support.patch   | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create 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
new file mode 100644
index 00000000000000..58bf38b85cbd03
--- /dev/null
+++ b/srcpkgs/refind/patches/add-cross-compile-support.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
+ 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (29 preceding siblings ...)
  2024-03-18 17:33 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-18 17:36 ` slymattz
  2024-03-18 17:37 ` slymattz
                   ` (10 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 17:36 UTC (permalink / raw)
  To: ml

[-- 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: 3757 bytes --]

From cc09e35cb7080c21a268464e5a7d3aef6f02c583 Mon Sep 17 00:00:00 2001
From: Mateusz Sylwestrzak <slymattz@gmail.com>
Date: Sat, 24 Feb 2024 01:53:23 +0100
Subject: [PATCH] refind: add BOOT_PREFIX and LABEL for misc setups         fix
 aarch64 build for binutils 2.38+

---
 srcpkgs/refind/files/kernel.post-install          | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf      |  8 +++++++-
 .../patches/add-cross-compile-support.patch       | 15 ++++++++++++++-
 srcpkgs/refind/template                           |  3 +--
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..6262cecf5f445e 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..9572534db7eada 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 a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
+
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support.patch
index e506758d3297ed..58bf38b85cbd03 100644
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ b/srcpkgs/refind/patches/add-cross-compile-support.patch
@@ -1,6 +1,6 @@
 --- a/Make.common
 +++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
+@@ -40,21 +40,13 @@
  # Note: TIANOBASE is defined in master Makefile and exported
  GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
  prefix          = /usr/bin/
@@ -29,3 +29,16 @@
  
  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
+ 
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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (30 preceding siblings ...)
  2024-03-18 17:36 ` slymattz
@ 2024-03-18 17:37 ` slymattz
  2024-03-18 18:50 ` [PR PATCH] [Updated] " slymattz
                   ` (9 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 17:37 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004543333

Comment:
> I don't think you should rename the patch; its original name is sufficiently descriptive, and changing the name makes tracking changes a little more confusing.

OK, done. Is it OK now? :)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (31 preceding siblings ...)
  2024-03-18 17:37 ` slymattz
@ 2024-03-18 18:50 ` slymattz
  2024-03-18 18:53 ` slymattz
                   ` (8 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 18:50 UTC (permalink / raw)
  To: ml

[-- 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: 3711 bytes --]

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

---
 srcpkgs/refind/files/kernel.post-install          | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf      |  8 +++++++-
 .../patches/add-cross-compile-support.patch       | 15 ++++++++++++++-
 srcpkgs/refind/template                           |  3 +--
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..6262cecf5f445e 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..9572534db7eada 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 a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
+
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support.patch
index e506758d3297ed..58bf38b85cbd03 100644
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ b/srcpkgs/refind/patches/add-cross-compile-support.patch
@@ -1,6 +1,6 @@
 --- a/Make.common
 +++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
+@@ -40,21 +40,13 @@
  # Note: TIANOBASE is defined in master Makefile and exported
  GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
  prefix          = /usr/bin/
@@ -29,3 +29,16 @@
  
  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
+ 
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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (32 preceding siblings ...)
  2024-03-18 18:50 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-18 18:53 ` slymattz
  2024-03-18 19:09 ` slymattz
                   ` (7 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 18:53 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004691025

Comment:
Got a lint error saying the second line should be empty. So I amended the description of the last commit and now it should be fine.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (33 preceding siblings ...)
  2024-03-18 18:53 ` slymattz
@ 2024-03-18 19:09 ` slymattz
  2024-03-18 19:40 ` [PR PATCH] [Updated] " slymattz
                   ` (6 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 19:09 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004691025

Comment:

![image](https://github.com/void-linux/void-packages/assets/76883004/df4107b8-33d3-480f-9bae-4f1675d0753f)

Got a lint error saying the second line should be empty. So I amended the description of the last commit and now it should be fine.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (34 preceding siblings ...)
  2024-03-18 19:09 ` slymattz
@ 2024-03-18 19:40 ` slymattz
  2024-03-18 19:47 ` slymattz
                   ` (5 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 19:40 UTC (permalink / raw)
  To: ml

[-- 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: 3936 bytes --]

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

While REFIND_LABEL identifies the volume on which vmlinuz and initramfs files reside REFIND_BOOT_PREFIX prepends a path that is relative to this volume.
This commit also fixes aarch64 build problems related to binutils 2.38+
---
 srcpkgs/refind/files/kernel.post-install          | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf      |  8 +++++++-
 .../patches/add-cross-compile-support.patch       | 15 ++++++++++++++-
 srcpkgs/refind/template                           |  3 +--
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..6262cecf5f445e 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..9572534db7eada 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 a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
+
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support.patch
index e506758d3297ed..58bf38b85cbd03 100644
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ b/srcpkgs/refind/patches/add-cross-compile-support.patch
@@ -1,6 +1,6 @@
 --- a/Make.common
 +++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
+@@ -40,21 +40,13 @@
  # Note: TIANOBASE is defined in master Makefile and exported
  GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
  prefix          = /usr/bin/
@@ -29,3 +29,16 @@
  
  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
+ 
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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (35 preceding siblings ...)
  2024-03-18 19:40 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-18 19:47 ` slymattz
  2024-03-18 20:12 ` slymattz
                   ` (4 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 19:47 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004691025

Comment:
![image](https://github.com/void-linux/void-packages/assets/76883004/df4107b8-33d3-480f-9bae-4f1675d0753f)

Got a lint error saying the second line should be empty. So I amended the description of the last commit and now commit 32fff16 should pass the test just fine.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (36 preceding siblings ...)
  2024-03-18 19:47 ` slymattz
@ 2024-03-18 20:12 ` slymattz
  2024-03-18 20:13 ` slymattz
                   ` (3 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 20:12 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004691025

Comment:
![image](https://github.com/void-linux/void-packages/assets/76883004/df4107b8-33d3-480f-9bae-4f1675d0753f)

Got a lint error saying the second line should be blank. So I amended the description of the last commit and added an extra return line between subject and body and now commit 32fff16 should pass the test just fine.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (37 preceding siblings ...)
  2024-03-18 20:12 ` slymattz
@ 2024-03-18 20:13 ` slymattz
  2024-03-19 18:31 ` slymattz
                   ` (2 subsequent siblings)
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-18 20:13 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2004691025

Comment:
![image](https://github.com/void-linux/void-packages/assets/76883004/df4107b8-33d3-480f-9bae-4f1675d0753f)

Got a lint error saying the second line should be blank. So I amended the description of the last commit and added an extra return line after subject so that git parses body as body. I believe commit 32fff16 should pass the test just fine.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (38 preceding siblings ...)
  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
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-19 18:31 UTC (permalink / raw)
  To: ml

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

New comment by slymattz on void-packages repository

https://github.com/void-linux/void-packages/pull/48906#issuecomment-2007868614

Comment:
@ahesford Hi! Can you please review my commit https://github.com/void-linux/void-packages/pull/48906/commits/32fff164aee6fb18296cc394857754a84a88a047 and re-run a workflow check? Thanks in advance.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Updated] refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (39 preceding siblings ...)
  2024-03-19 18:31 ` slymattz
@ 2024-03-21 14:49 ` slymattz
  2024-03-21 15:23 ` [PR PATCH] [Closed]: " ahesford
  41 siblings, 0 replies; 43+ messages in thread
From: slymattz @ 2024-03-21 14:49 UTC (permalink / raw)
  To: ml

[-- 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: 3936 bytes --]

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

While REFIND_LABEL identifies the volume on which vmlinuz and initramfs files
reside REFIND_BOOT_PREFIX prepends a path that is relative to this volume.
This commit also fixes aarch64 build problems related to binutils 2.38+
---
 srcpkgs/refind/files/kernel.post-install          | 11 +++++++----
 srcpkgs/refind/files/refind-kernel-hook.conf      |  8 +++++++-
 .../patches/add-cross-compile-support.patch       | 15 ++++++++++++++-
 srcpkgs/refind/template                           |  3 +--
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install
index fd18f9c45ffe07..6262cecf5f445e 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..9572534db7eada 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 a custom label for Void boot entries
+#REFIND_LABEL="Void Linux"
+
+# Prefix prepended to kernel and initramfs paths in Void boot entries
+#REFIND_BOOT_PREFIX=""
+
+# Additional kernel cmdline parameters
 OPTIONS="quiet loglevel=4"
diff --git a/srcpkgs/refind/patches/add-cross-compile-support.patch b/srcpkgs/refind/patches/add-cross-compile-support.patch
index e506758d3297ed..58bf38b85cbd03 100644
--- a/srcpkgs/refind/patches/add-cross-compile-support.patch
+++ b/srcpkgs/refind/patches/add-cross-compile-support.patch
@@ -1,6 +1,6 @@
 --- a/Make.common
 +++ b/Make.common
-@@ -40,21 +40,13 @@ REFIND_SBAT_CSV = refind-sbat.csv
+@@ -40,21 +40,13 @@
  # Note: TIANOBASE is defined in master Makefile and exported
  GENFW           = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
  prefix          = /usr/bin/
@@ -29,3 +29,16 @@
  
  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
+ 
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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PR PATCH] [Closed]: refind: account for btrfs setups when generating manual stanzas
  2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas slymattz
                   ` (40 preceding siblings ...)
  2024-03-21 14:49 ` [PR PATCH] [Updated] " slymattz
@ 2024-03-21 15:23 ` ahesford
  41 siblings, 0 replies; 43+ messages in thread
From: ahesford @ 2024-03-21 15:23 UTC (permalink / raw)
  To: ml

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

There's a closed pull request on the void-packages repository

refind: account for btrfs setups when generating manual stanzas
https://github.com/void-linux/void-packages/pull/48906

Description:
<!-- 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_)


^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2024-03-21 15:23 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-24  1:28 [PR PATCH] refind: account for btrfs setups when generating manual stanzas 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 ` [PR PATCH] [Updated] " slymattz
2024-03-16 21:09 ` 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

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).