all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Kaiyang Wu <wukaiyang2003@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Kaiyang Wu <wukaiyang@loongfans.cn>
Subject: [PATCH kernel-helper] zz-proxmox-boot: make grub EFI architecture aware
Date: Sun,  7 Jun 2026 14:51:09 +0800	[thread overview]
Message-ID: <20260607065119.120120-1-wukaiyang@loongfans.cn> (raw)

Add architecture based Grub EFI bootloader detection and processing.

Signed-off-by: Kaiyang Wu <wukaiyang@loongfans.cn>
---
 src/proxmox-boot/zz-proxmox-boot | 38 ++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/proxmox-boot/zz-proxmox-boot b/src/proxmox-boot/zz-proxmox-boot
index 541a982..e80e2f3 100755
--- a/src/proxmox-boot/zz-proxmox-boot
+++ b/src/proxmox-boot/zz-proxmox-boot
@@ -41,6 +41,8 @@ elif [ -d /usr/share/doc/proxmox-backup/ ]; then
 	LOADER_TITLE="Proxmox Backup Server"
 fi
 
+ARCH="$(dpkg --print-architecture)"
+
 update_esps() {
 	if [ ! -f "${ESP_LIST}" ]; then
 	    warn "No ${ESP_LIST} found, skipping ESP sync."
@@ -78,7 +80,16 @@ update_esp_func() {
 	mount -t vfat -o umask=0077 "${path}" "${mountpoint}" || \
 		{ warn "mount of ${path} failed - skipping"; return; }
 
-	if [ -e "${mountpoint}/EFI/proxmox/grubx64.efi" ]; then
+	grub_efi_binary=""
+	if [ "$ARCH" = "amd64" ]; then
+		grub_efi_binary="grubx64.efi"
+	elif [ "$ARCH" = "arm64" ]; then
+		grub_efi_binary="grubaa64.efi"
+	else
+		warn "Unsupported architecture ${ARCH}"
+	fi
+
+	if [ -e "${mountpoint}/EFI/proxmox/${grub_efi_binary}" ]; then
 		grub=1
 	fi
 	if [ -d /sys/firmware/efi ] && [ "$grub" != 1 ]; then
@@ -235,12 +246,12 @@ check_grub_efi_package() {
 		return
 	fi
 
-	if [ -f /usr/share/doc/grub-efi-amd64/changelog.Debian.gz ]; then
+	if [ -f /usr/share/doc/grub-efi-${ARCH}/changelog.Debian.gz ]; then
 		return
 	fi
 
-	warn "System booted in EFI-mode but 'grub-efi-amd64' meta-package not installed!"
-	warn "Install 'grub-efi-amd64' to get updates."
+	warn "System booted in EFI-mode but 'grub-efi-${ARCH}' meta-package not installed!"
+	warn "Install 'grub-efi-${ARCH}' to get updates."
 }
 
 check_grub_efi_removable_status() {
@@ -249,12 +260,21 @@ check_grub_efi_removable_status() {
 		return
 	fi
 
+	removable_efi_binary=""
+	if [ "$ARCH" = "amd64" ]; then
+		removable_efi_binary="BOOTX64.efi"
+	elif [ "$ARCH" = "arm64" ]; then
+		removable_efi_binary="BOOTAA64.efi"
+	else
+		warn "Unsupported architecture ${ARCH}"
+	fi
+
 	# no removable bootloader
-	if [ ! -f "/boot/efi/EFI/BOOT/BOOTX64.efi" ]; then
+	if [ ! -f "/boot/efi/EFI/BOOT/${removable_efi_binary}" ]; then
 		return
 	fi
 
-	debconf_value="$(debconf-show --db configdb grub-efi-amd64 grub-pc | grep 'force_efi_extra_removable')"
+	debconf_value="$(debconf-show --db configdb grub-efi-${ARCH} grub-pc | grep 'force_efi_extra_removable')"
 
 	# packages already set up to install a removable copy, let's trust that it works
 	if echo "${debconf_value}" | grep -qE ': true$'; then
@@ -262,12 +282,12 @@ check_grub_efi_removable_status() {
 	fi
 
 	echo ""
-	echo "Removable bootloader found at '/boot/efi/EFI/BOOT/BOOTX64.efi', but GRUB packages not set up to update it!"
+	echo "Removable bootloader found at '/boot/efi/EFI/BOOT/${removable_efi_binary}', but GRUB packages not set up to update it!"
 	echo "Run the following command:"
 	echo ""
-	echo "echo 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u"
+	echo "echo 'grub-efi-${ARCH} grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u"
 	echo ""
-	echo "Then reinstall GRUB with 'apt install --reinstall grub-efi-amd64'"
+	echo "Then reinstall GRUB with 'apt install --reinstall grub-efi-${ARCH}'"
 	echo ""
 }
 
-- 
2.52.0




                 reply	other threads:[~2026-06-07  6:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260607065119.120120-1-wukaiyang@loongfans.cn \
    --to=wukaiyang2003@gmail.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=wukaiyang@loongfans.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal