git: b14067fc8d34 - stable/13 - release: ensure enforce_chs sysctl is 0

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 16 Aug 2022 01:20:16 UTC
The branch stable/13 has been updated by emaste:

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

commit b14067fc8d342a61b2498fe846a573ff4a67e8f0
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-07-19 20:47:49 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-08-16 01:20:06 +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
    
    (cherry picked from commit 6b6367ba8fd2b29de29ce08e7432291e807c3bc0)
---
 release/tools/arm.subr | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/release/tools/arm.subr b/release/tools/arm.subr
index 668592740448..9758c898ca24 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