nanobsd: Add a nano_makefs function
Add a NANO_MAKEFS global variable with options equivalent to NANO_NEWFS to be used with a nano_makefs function for creating images. Also add a function that adjusts the code size calculation, so makefs -s won't error about the minimum rounded size. Ideally this shim should be removed, therefore the suspicious _xxx prefix. Initially not wired. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48789
This commit is contained in:
@@ -107,6 +107,7 @@ NANO_LATE_CUSTOMIZE=""
|
||||
|
||||
# Newfs parameters to use
|
||||
NANO_NEWFS="-b 4096 -f 512 -i 8192 -U"
|
||||
NANO_MAKEFS="-o bsize=4096,density=8192,fsize=512,softupdates=1,version=2"
|
||||
|
||||
# The drive name of the media at runtime
|
||||
NANO_DRIVE=ada0
|
||||
@@ -688,6 +689,18 @@ newfs_part() {
|
||||
mount -o async ${dev} ${mnt}
|
||||
}
|
||||
|
||||
nano_makefs() {
|
||||
local dir image metalog options size
|
||||
options=$1
|
||||
metalog=$2
|
||||
size=$3
|
||||
image=$4
|
||||
dir=$5
|
||||
|
||||
makefs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \
|
||||
-s "${size}b" -T "${NANO_TIMESTAMP}" -t ffs "${image}" "${dir}"
|
||||
}
|
||||
|
||||
# Convenient spot to work around any umount issues that your build environment
|
||||
# hits by overriding this method.
|
||||
nano_umount() {
|
||||
@@ -1002,6 +1015,7 @@ set_defaults_and_export() {
|
||||
export_var NANO_IMGNAME
|
||||
export_var NANO_IMG1NAME
|
||||
export_var NANO_MAKE
|
||||
export_var NANO_MAKEFS
|
||||
export_var NANO_MAKE_CONF_BUILD
|
||||
export_var NANO_MAKE_CONF_INSTALL
|
||||
export_var NANO_MEDIASIZE
|
||||
|
||||
@@ -92,6 +92,17 @@ 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"
|
||||
|
||||
Reference in New Issue
Block a user