git: 6b6367ba8fd2 - main - release: ensure enforce_chs sysctl is 0

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 09 Aug 2022 18:22:46 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b6367ba8fd2b29de29ce08e7432291e807c3bc0

commit 6b6367ba8fd2b29de29ce08e7432291e807c3bc0
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-07-19 20:47:49 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-08-09 18:21:34 +0000

    release: ensure enforce_chs sysctl is 0
    
    We do not want CHS-based alignment for VM or SD card release images.
    
    (Other images use makefs/mkimg, not kernel gpart and so do not depend
    on this sysctl.)
    
    Sponsored by:   The FreeBSD Foundation
    Approved by:    re (gjb)
    MFC after:      1 week
---
 release/tools/arm.subr | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/release/tools/arm.subr b/release/tools/arm.subr
index 25d4640cc26b..d07dbb41b48b 100644
--- a/release/tools/arm.subr
+++ b/release/tools/arm.subr
@@ -63,6 +63,10 @@ umount_loop() {
 }
 
 arm_create_disk() {
+	if [ $(sysctl -n kern.geom.part.mbr.enforce_chs) != 0 ]; then
+		return 1
+	fi
+
 	# Create the target raw file and temporary work directory.
 	chroot ${CHROOTDIR} gpart create -s ${PART_SCHEME} ${mddev}
 	if [ "${PART_SCHEME}" = "GPT" ]; then