aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Luis Duran <jlduran@FreeBSD.org>2026-05-27 00:24:26 +0000
committerJose Luis Duran <jlduran@FreeBSD.org>2026-05-27 00:24:26 +0000
commit54359982309e63254424eea1f981215c84d2b9c6 (patch)
treef1f04b64b0a5b82468ca81ad0ff8b5de599981f9
parentc579927ac591ffcf36f4cd06444d167ba467ec8d (diff)
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
-rwxr-xr-xtools/tools/nanobsd/defaults.sh4
-rw-r--r--tools/tools/nanobsd/legacy.sh13
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}