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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-refind-48906.patch --]
[-- Type: text/x-diff, Size: 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

  parent reply	other threads:[~2024-03-18 18:50 UTC|newest]

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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20240318185035.5DF8A2D64D@inbox.vuxu.org \
    --to=slymattz@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

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

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