nanobsd: Explicitly set image size and secsz in mkimg

When building an unprivileged NanoBSD image, explicitly set the desired
image size, by passing --capacity to mkimg in bytes, and the logical
sector size (-S) to 512 bytes.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57222
This commit is contained in:
Jose Luis Duran
2026-05-27 00:21:57 +00:00
parent f1de49f508
commit 318a85d4b2
+3 -3
View File
@@ -178,7 +178,7 @@ _create_code_slice() {
nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \
"${NANO_METALOG}" "$(( CODE_SIZE - METADATA_SECTS ))" \
"${NANO_OBJ}/_.disk.part" "${NANO_WORLDDIR}"
mkimg -s bsd \
mkimg -s bsd -S 512 --capacity $(( CODE_SIZE * 512 )) \
${bootcode} \
-p freebsd-ufs:="${NANO_OBJ}/_.disk.part" \
-o "${IMG}"
@@ -318,7 +318,7 @@ _create_diskimage() {
if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then
bootcode="-b ${NANO_WORLDDIR}/boot/boot"
fi
mkimg -s bsd \
mkimg -s bsd -S 512 --capacity $(( CODE_SIZE * 512 )) \
${bootcode} \
-p freebsd-ufs:="${NANO_OBJ}/_.altroot.part" \
-o "${NANO_OBJ}/_.altroot.image"
@@ -350,7 +350,7 @@ _create_diskimage() {
fi
echo "Writing out ${NANO_IMGNAME}..."
mkimg -s mbr \
mkimg -s mbr -S 512 --capacity $(( NANO_MEDIASIZE * 512 )) \
${bootloader} \
${diskimage} \
${altroot} \