Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2026 00:37:08 +0000
From:      Jose Luis Duran <jlduran@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 54359982309e - main - nanobsd: Adjust the order of the flags in makefs
Message-ID:  <6a163cb4.3de71.78e8d8f2@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jlduran:

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

commit 54359982309e63254424eea1f981215c84d2b9c6
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2026-05-27 00:24:26 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2026-05-27 00:24:26 +0000

    nanobsd: Adjust the order of the flags in makefs
    
    The order of the flags matter in makefs(8). The -t (type) flag must come
    before the -o (options) flag; otherwise, the options are reset.
    
    Move the -t flag before the -o flag and remove the shim function
    _xxx_adjust_code_size() that was created to align to the default makefs
    FFS values.
    
    It effectively prevented us from generating NanoBSD images using
    unprivileged builds with the partitions internally aligned as intended.
    
    Reviewed by:    senguptaangshuman17_gmail.com, imp
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D57226
---
 tools/tools/nanobsd/defaults.sh |  4 ++--
 tools/tools/nanobsd/legacy.sh   | 13 -------------
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 6f55b28eb77f..4997812cb15f 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -718,8 +718,8 @@ nano_makefs() {
 	image=$4
 	dir=$5
 
-	makefs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \
-	    -R "${size}b" -T "${NANO_TIMESTAMP}" -t ffs "${image}" "${dir}"
+	makefs -t ffs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \
+	    -R "${size}b" -T "${NANO_TIMESTAMP}" "${image}" "${dir}"
 }
 
 # Convenient spot to work around any umount issues that your build environment
diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh
index ed4bd493c8d7..467c7b845672 100644
--- a/tools/tools/nanobsd/legacy.sh
+++ b/tools/tools/nanobsd/legacy.sh
@@ -96,17 +96,6 @@ calculate_partitioning() {
 	' > ${NANO_LOG}/_.partitioning
 }
 
-_xxx_adjust_code_size()
-{
-	# XXX adjust the CODE_SIZE value by rounding it up to
-	# a bsize of 32768 (DFL_BLKSIZE).
-	# Otherwise makefs -s will fail because of the guard
-	# introduced in 5ad283b3c60d.
-	codesize=$1
-	bsize=32768
-	echo $(( ((codesize + (bsize - 1)) / bsize) * bsize ))
-}
-
 create_code_slice() {
 	pprint 2 "build code slice"
 	pprint 3 "log: ${NANO_OBJ}/_.cs"
@@ -166,7 +155,6 @@ _create_code_slice() {
 	(
 	IMG=${NANO_DISKIMGDIR}/${NANO_IMG1NAME}
 	CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning")
-	CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE")
 
 	echo "Writing code image..."
 	if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then
@@ -295,7 +283,6 @@ _create_diskimage() {
 	local altroot bootloader cfgimage dataimage diskimage
 
 	CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning")
-	CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE")
 	CONF_SIZE=$(awk '$3 == 3 {print $2}' "${NANO_LOG}/_.partitioning")
 	DATA_SIZE=$(awk '$3 == 4 {print $2}' "${NANO_LOG}/_.partitioning")
 	IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a163cb4.3de71.78e8d8f2>