From 363ce5bc8a19bc9f3aba0c0ed0e496b62fc80602 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sun, 22 Jun 2025 10:25:57 +0200 Subject: [PATCH] fix: boot flag on boot partition The boot partition needs to have a boot flag so it is detected by u-boot as a partition to boot from. Unfortunately Guix uses this flag to check if a partition is root partition, and then sets the uuid of the root partition based on that. As a workaround, move the boot partition as second, this ensures the root partition will be detected as root. However, this is problematic, because the BootROM on the ZynqMP cannot read the whole disk for the boot.bin file. It reads only first part of it. Because of that, if the boot partition was second on the disk, it would not be possible to boot into SPL and U-Boot from it. Because of that, the offset is chosen so that the boot partition actually comes first despite being partition 2. --- modules/zynqmp/packages/images.scm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/zynqmp/packages/images.scm b/modules/zynqmp/packages/images.scm index aeebdd2..8ea4f92 100644 --- a/modules/zynqmp/packages/images.scm +++ b/modules/zynqmp/packages/images.scm @@ -15,7 +15,7 @@ #:use-module (gnu bootloader extlinux) #:use-module (gnu bootloader)) -(define root-offset (* 512 2048)) +(define root-offset (+ 512 (* 256 1024 1024))) ;; TODO: FDT (define* (install-xilinx-bootloader fdt) @@ -91,6 +91,7 @@ (size 'guess) (label "root") (file-system "ext4") + (offset root-offset) ;; Disable the metadata_csum and 64bit features of ext4, for compatibility ;; with U-Boot. (file-system-options (list "-O" "^metadata_csum,^64bit")) @@ -122,8 +123,8 @@ (size (* 256 1024 1024)) (label "BOOT") (file-system "vfat") - (offset root-offset) - (flags '()) + (offset 512) + (flags '(boot)) (initializer (with-imported-modules (source-module-closure '((guix build utils) @@ -173,8 +174,8 @@ (partition-table-type 'mbr) ;; TODO (volatile-root? #f) (partitions - (list boot-partition - root-partition)))) + (list root-partition + boot-partition)))) (define-public zynqmp-base-system-image (package -- 2.49.0