git: 318a85d4b201 - main - nanobsd: Explicitly set image size and secsz in mkimg
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 May 2026 00:37:04 UTC
The branch main has been updated by jlduran:
URL: https://cgit.FreeBSD.org/src/commit/?id=318a85d4b201b1cb77f25c8a98d2b0687e8259e5
commit 318a85d4b201b1cb77f25c8a98d2b0687e8259e5
Author: Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2026-05-27 00:21:57 +0000
Commit: Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2026-05-27 00:21:57 +0000
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
---
tools/tools/nanobsd/legacy.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh
index 763f65c4dbdc..1d7a0cef2fed 100644
--- a/tools/tools/nanobsd/legacy.sh
+++ b/tools/tools/nanobsd/legacy.sh
@@ -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} \