Bug 271098 - nanobsd: cannot boot any NANO_LAYOUT model on armv7
Summary: nanobsd: cannot boot any NANO_LAYOUT model on armv7
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 13.2-RELEASE
Hardware: arm Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-27 12:52 UTC by Luc Hondareyte
Modified: 2023-04-29 15:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luc Hondareyte 2023-04-27 12:52:21 UTC
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