The branch main has been updated by jlduran:

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

commit beddf2c591739a43e36c339b393e0beb3878d01a
Author:     Jose Luis Duran <[email protected]>
AuthorDate: 2026-05-27 00:14:09 +0000
Commit:     Jose Luis Duran <[email protected]>
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
 

Reply via email to