[Bug 271098] [nanobsd] cannot boot any NANO_LAYOUT model on armv7

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 27 Apr 2023 12:52:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271098

            Bug ID: 271098
           Summary: [nanobsd] cannot boot any NANO_LAYOUT model on armv7
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: hondareyte.luc@laposte.net

Hello,

I try to build a bootable image on amd64 for armv7 with EFI for an orangepi-pc
and nanopi neo, but it does not work. The only layout that build without error
is 'std-embedded'. But it is not bootable because the offset of the FAT
partition is wrong. With an offset of 1M (like GPT) it works.

The good one:
=>     1  402511  md0  MBR  (197M)
       1    2047       - free -  (1.0M)
    2048   65536    1  fat16  [active]  (32M)
   67584   65536    2  freebsd  (32M)
  133120  269392    3  freebsd  (132M)

=>     0  269392  md0s3  BSD  (132M)
       0      16         - free -  (8.0K)
      16  269376      1  freebsd-ufs  (132M)

The partition layout with 'std-embedded' is as follow (I have manually activate
FAT16 partition):

The bad:
=>     1  400464  md0  MBR  (196M)
       1   65536    1  fat16  [active]  (32M)
   65537   65536    2  freebsd  (32M)
  131073  269392    3  freebsd  (132M)

=>     0  269392  md0s3  BSD  (132M)
       0      16         - free -  (8.0K)
      16  269376      1  freebsd-ufs  (132M)

And the ugly: here a patch which a new scheme named 'std-armv7' (not sure this
is the best way to solve the problem) which add an offset to _.s1.


--- common.ori  2023-04-26 13:05:49.229317000 +0200
+++ common.new  2023-04-27 14:42:41.388647000 +0200
@@ -268,6 +268,13 @@
        # but there's problems: it marks all partitions as active, so you have
to
        # boot off partition 3 or 2 by hand if you're playing around with this
WIP
        case ${NANO_LAYOUT} in
+       std-armv7)
+               # Layout for armv7 with EFI
+               mkimg -a 1 -s mbr -p ${s1}:=${NANO_LOG}/_.s1:1M \
+                       -p ${s2}:=${NANO_LOG}/_.s2 \
+                       -p ${s3}:=${NANO_LOG}/_.s3 \
+                       -o ${out}
+               ;;
        std-embedded)
                mkimg -a 3 ${skiparg} ${fmtarg} ${bootmbr} -s mbr -p
${s1}:=${NANO_LOG}/_.s1 \
                        -p ${s2}:=${NANO_LOG}/_.s2 \
@@ -593,7 +600,7 @@
 : ${NANO_MAKEFS_UFS:=makefs -t ffs -B ${NANO_ENDIAN}}
 : ${NANO_DISK_SCHEME:=mbr}     # No others really supported ATM (well, gpt)
 case ${NANO_LAYOUT} in
-std-embedded)
+std-embedded|std-armv7)
        NANO_SLICE_FAT=s1
        NANO_SLICE_CFG=s2
        NANO_SLICE_ROOT=s3

Regards,
Luc

-- 
You are receiving this mail because:
You are the assignee for the bug.