Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2026 00:37:01 +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: beddf2c59173 - main - nanobsd: Use rounded sizes for cfg and data slices
Message-ID:  <6a163cad.3ef3a.260a82f5@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=beddf2c591739a43e36c339b393e0beb3878d01a

commit beddf2c591739a43e36c339b393e0beb3878d01a
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2026-05-27 00:14:09 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2026-05-27 00:14:09 +0000

    nanobsd: Use rounded sizes for cfg and data slices
    
    Use the calculated (rounded up) cfg and data sizes from the
    _.partitioning file, instead of consuming them directly from the global
    variables.  We obtain the size of the cfg and data slices by explicitly
    searching for index 3 and 4 respectively in the _.partitioning file.
    
    This ensures that the final image has the rounded-up sizes, and not the
    raw sizes.
    
    Reviewed by:    imp
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D57219
---
 tools/tools/nanobsd/legacy.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh
index ac9cf4a3abe9..670a2f5ca968 100644
--- a/tools/tools/nanobsd/legacy.sh
+++ b/tools/tools/nanobsd/legacy.sh
@@ -292,6 +292,8 @@ _create_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}
 
 	if [ -f "${NANO_WORLDDIR}/${NANO_BOOTLOADER}" ]; then
@@ -327,7 +329,7 @@ _create_diskimage() {
 
 	# Create Config slice
 	_populate_cfg_part "${NANO_OBJ}/_.cfg.part" "${NANO_CFGDIR}" \
-	    "${NANO_SLICE_CFG}" "${NANO_CONFSIZE}" "${NANO_METALOG_CFG}"
+	    "${NANO_SLICE_CFG}" "${CONF_SIZE}" "${NANO_METALOG_CFG}"
 	cfgimage="-p freebsd:=${NANO_OBJ}/_.cfg.part"
 
 	# Create Data slice, if any.
@@ -339,7 +341,7 @@ _create_diskimage() {
 	fi
 	if [ "${NANO_DATASIZE}" -ne 0 ] && [ -n "${NANO_SLICE_DATA}" ] ; then
 		_populate_data_part "${NANO_OBJ}/_.data.part" "${NANO_DATADIR}" \
-		    "${NANO_SLICE_DATA}" "${NANO_DATASIZE}" "${NANO_METALOG_DATA}"
+		    "${NANO_SLICE_DATA}" "${DATA_SIZE}" "${NANO_METALOG_DATA}"
 		dataimage="-p freebsd:=${NANO_OBJ}/_.data.part"
 	fi
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a163cad.3ef3a.260a82f5>