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
This commit is contained in:
Jose Luis Duran
2026-05-27 00:24:26 +00:00
parent c579927ac5
commit 5435998230
2 changed files with 2 additions and 15 deletions
+2 -2
View File
@@ -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
-13
View File
@@ -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}