public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH kernel-helper] zz-proxmox-boot: make grub EFI architecture aware
@ 2026-06-07  6:51 Kaiyang Wu
  0 siblings, 0 replies; only message in thread
From: Kaiyang Wu @ 2026-06-07  6:51 UTC (permalink / raw)
  To: pve-devel; +Cc: Kaiyang Wu

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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-07  6:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-07  6:51 [PATCH kernel-helper] zz-proxmox-boot: make grub EFI architecture aware Kaiyang Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal