Date: Thu, 19 Mar 2026 17:15:29 +0000 From: Jose Luis Duran <jlduran@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 5902c1834d82 - main - nanobsd: Minor cleanup Message-ID: <69bc2f31.33db9.4d037b95@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=5902c1834d82737137152eeaf8b60f1cd6652fad commit 5902c1834d82737137152eeaf8b60f1cd6652fad Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2026-03-19 17:14:24 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2026-03-19 17:14:24 +0000 nanobsd: Minor cleanup No functional change intended. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54979 --- tools/tools/nanobsd/defaults.sh | 4 +- tools/tools/nanobsd/embedded/common | 98 ++++++++++++++++++------------------- tools/tools/nanobsd/fill_pkg.sh | 12 ++--- 3 files changed, 55 insertions(+), 59 deletions(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 0e5af1e3e95a..adeb83365050 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -424,8 +424,8 @@ make_conf_install() { echo "${CONF_WORLD}" echo "${CONF_INSTALL}" if [ -n "${NANO_NOPRIV_BUILD}" ]; then - echo NO_ROOT=t - echo METALOG=${NANO_METALOG} + echo NO_ROOT=true + echo METALOG=${NANO_METALOG} fi ) > ${NANO_MAKE_CONF_INSTALL} } diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index bb3a2d707967..f1ecf21fe51d 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -83,7 +83,6 @@ NANO_PMAKE="make -j $(sysctl -n hw.ncpu)" NANO_CFG_BASE=$(pwd) NANO_CFG_BASE=$(realpath ${NANO_CFG_BASE}/..) NANO_SRC=$(realpath ${NANO_CFG_BASE}/../../..) -#### XXX share obj if [ -z ${NANO_CPUTYPE} ]; then NANO_OBJ=${NANO_SRC}/../embedded/obj else @@ -95,7 +94,7 @@ NANO_LOG=${NANO_OBJ}/../${NANO_NAME} NANO_DISKIMGDIR=${NANO_OBJ}/../images NANO_WORLDDIR=${NANO_LOG}/_.w NANO_INIT_IMG2=0 -NANO_NOPRIV_BUILD=t +NANO_NOPRIV_BUILD=true unset MAKEOBJDIRPREFIX mkdir -p ${NANO_OBJ} @@ -149,13 +148,13 @@ WITHOUT_SHAREDOCS=true WITHOUT_SYSCONS=true WITHOUT_LIB32=true WITHOUT_TESTS=true -WITHOUT_DEBUG_FILES=t -WITHOUT_KERNEL_SYMBOLS=t +WITHOUT_DEBUG_FILES=true +WITHOUT_KERNEL_SYMBOLS=true " CONF_INSTALL="$CONF_BUILD -INSTALL_NODEBUG=t -NOPORTDOCS=t -NO_INSTALL_MANPAGES=t +INSTALL_NODEBUG=true +NOPORTDOCS=true +NO_INSTALL_MANPAGES=true " # The following would help... # WITHOUT_TOOLCHAIN=true can't build ports @@ -203,7 +202,6 @@ create_diskimage_gpt() { } create_diskimage_mbr() { - local fmt [ -z ${NANO_DISKIMAGE_FORMAT} ] || fmt=".${NANO_DISKIMAGE_FORMAT}" @@ -268,11 +266,11 @@ create_diskimage_mbr() { [ -z ${NANO_NOPRIV_BUILD} ] || extra="-F ${NANO_METALOG}" sz=${NANO_SLICE_ROOT_SIZE:+-s ${NANO_SLICE_ROOT_SIZE}} eval "${NANO_MAKEFS_UFS}" ${extra} $sz "${NANO_LOG}/_.${NANO_ROOT}" \ - "${NANO_WORLDDIR}" + "${NANO_WORLDDIR}" case ${NANO_DISK_SCHEME} in mbr) mkimg -s bsd ${bootbsd} -p freebsd-ufs:=${NANO_LOG}/_.${NANO_ROOT} \ - -o ${NANO_LOG}/_.${NANO_SLICE_ROOT} + -o ${NANO_LOG}/_.${NANO_SLICE_ROOT} eval $NANO_SLICE_CFG=freebsd eval $NANO_SLICE_ROOT=freebsd ;; @@ -290,9 +288,9 @@ create_diskimage_mbr() { fi # XXX -F cfg-mtree eval "${NANO_MAKEFS_UFS}" -s ${NANO_SLICE_CFG_SIZE} \ - "${NANO_LOG}/_.${NANO_SLICE_CFG}" "${NANO_CFGDIR}" + "${NANO_LOG}/_.${NANO_SLICE_CFG}" "${NANO_CFGDIR}" - # data slice not supported since we need the part for FAT for + # data slice not supported since we need the part for FAT for # booting # Now shuffle all the slices together into the proper layout @@ -307,37 +305,35 @@ create_diskimage_mbr() { case ${NANO_LAYOUT} in std-embedded) mkimg -a 3 ${skiparg} ${fmtarg} ${bootmbr} -s mbr -p ${s1}:=${NANO_LOG}/_.s1 \ - -p ${s2}:=${NANO_LOG}/_.s2 \ - -p ${s3}:=${NANO_LOG}/_.s3 \ - -o ${out} + -p ${s2}:=${NANO_LOG}/_.s2 \ + -p ${s3}:=${NANO_LOG}/_.s3 \ + -o ${out} ;; std-x86) # s3 is cfg, s1 is /, s2 is other / (s2 is created in first boot script) mkimg -a 1 ${fmtarg} ${bootmbr} -s mbr -p ${s1}:=${NANO_LOG}/_.s1 \ - -p- \ - -p ${s3}:=${NANO_LOG}/_.s3 \ - -o ${out} - - + -p- \ + -p ${s3}:=${NANO_LOG}/_.s3 \ + -o ${out} ;; std-uefi) # s1 is boot, s2 is cfg, s3 is /, not sure how to make that # boot (marked as active) with mkimg yet mkimg -a 2 ${fmtarg} ${bootmbr} -s mbr \ - -p efi:=${NANO_WORLDDIR}/boot/efiboot.img \ - -p ${s2}:=${NANO_LOG}/_.s2 \ - -p ${s3}:=${NANO_LOG}/_.s3 \ - -o ${out} + -p efi:=${NANO_WORLDDIR}/boot/efiboot.img \ + -p ${s2}:=${NANO_LOG}/_.s2 \ + -p ${s3}:=${NANO_LOG}/_.s3 \ + -o ${out} ;; std-uefi-bios) # p1 is boot for uefi, p2 is boot for gpt, p3 is cfg, p4 is / # and p5 is alt-root (after resize) mkimg -a 2 ${fmtarg} ${bootmbr} -s gpt \ - -p efi/efiboot0:=${NANO_WORLDDIR}/boot/efiboot.img \ - -p freebsd-boot:=${NANO_WORLDDIR}/boot/gptboot \ - -p ${p3}/cfg:=${NANO_LOG}/_.p3 \ - -p ${p4}:=${NANO_LOG}/_.p4 \ - -o ${out} + -p efi/efiboot0:=${NANO_WORLDDIR}/boot/efiboot.img \ + -p freebsd-boot:=${NANO_WORLDDIR}/boot/gptboot \ + -p ${p3}/cfg:=${NANO_LOG}/_.p3 \ + -p ${p4}:=${NANO_LOG}/_.p4 \ + -o ${out} ;; powerpc64-ibm) # A lie to make the boot loader work, it boots the first BSD partition @@ -347,9 +343,9 @@ create_diskimage_mbr() { # partition isn't FAT with special files, but a copy of the boot # loader itself. mkimg -a 1 ${fmtarg} -s mbr -p prepboot:=${NANO_LOG}/_.s1 \ - -p ${s2}:=${NANO_LOG}/_.s2 \ - -p ${s3}:=${NANO_LOG}/_.s3a \ - -o ${out} + -p ${s2}:=${NANO_LOG}/_.s2 \ + -p ${s3}:=${NANO_LOG}/_.s3a \ + -o ${out} ;; esac rm -f ${out}.xz @@ -357,7 +353,7 @@ create_diskimage_mbr() { ) > ${NANO_LOG}/_.di 2>&1 } -die( ) { +die() { echo "$*" exit 1 } @@ -374,8 +370,8 @@ die( ) { rp=$(realpath ${NANO_OBJ}/) __a=`mount | grep ${rp} | awk '{print length($3), $3;}' | sort -rn | awk '{$1=""; print;}'` if [ -n "$__a" ]; then - echo "unmounting $__a" - umount $__a + echo "unmounting $__a" + umount $__a fi if [ "$DEBUG" = 1 ]; then @@ -384,7 +380,7 @@ DEBUG_FLAGS= -g " else DEBUG_INSTALL=" -INSTALL_NODEBUG= t +INSTALL_NODEBUG= true " fi @@ -396,7 +392,7 @@ ${DEBUG_INSTALL} " if [ "${NANO_PACKAGE_ONLY}" -eq 1 ]; then - CONF_INSTALL="${CONF_INSTALL} + CONF_INSTALL="${CONF_INSTALL} ${PKG_ONLY_MAKE_CONF} " echo "Automatically building a thin image with packages" @@ -439,10 +435,11 @@ fix_pkg() ( mkdir -p pkg/tmp # Needed for pkg bootstrap mkdir -p usr/local/etc # Will get moved to local/etc ( - echo 'PKG_DBDIR = "/pkg/db"' - echo 'PKG_CACHEDIR = "/pkg/cache"' - echo 'DEFAULT_ALWAYS_YES = "yes"' - echo 'ASSUME_ALWAYS_YES = "yes"' + echo 'PKG_DBDIR = "/pkg/db";' + echo 'PKG_CACHEDIR = "/pkg/cache";' + echo 'TMPDIR = "/pkg/tmp";' + echo 'DEFAULT_ALWAYS_YES = true;' + echo 'ASSUME_ALWAYS_YES = true;' ) >> usr/local/etc/pkg.conf [ -z ${NANO_NOPRIV_BUILD} ] || ( echo "./pkg type=dir uname=root gname=wheel mode=0755" @@ -470,7 +467,7 @@ shrink_md_fbsize() { # and gives us more back on 9.x as the default block and frag size # are 4 times larger). sed -i '' -e 's,-S -i 4096,-S -i 4096 -b 4096 -f 512,' \ - ${NANO_WORLDDIR}/etc/rc.initdiskless + ${NANO_WORLDDIR}/etc/rc.initdiskless } customize_cmd shrink_md_fbsize @@ -531,17 +528,17 @@ late_customize_cmd product_custom # set global variables # -std_aarch64 ( ) { +std_aarch64() { } -std_amd64 ( ) { +std_amd64() { std_i386 } -std_armv7 ( ) { +std_armv7() { } -std_i386 ( ) { +std_i386() { # Default values, if not overridden in .cfg file : ${NANO_KERNEL:=GENERIC} : ${NANO_DRIVE:=ada0} @@ -550,11 +547,11 @@ std_i386 ( ) { : ${NANO_BOOT_BSD:=${NANO_WORLDDIR}/boot/boot} } -std_powerpc ( ) { +std_powerpc() { NANO_ENDIAN=big } -std_powerpc64 ( ) { +std_powerpc64() { NANO_LAYOUT=powerpc64-ibm NANO_ENDIAN=big } @@ -562,8 +559,7 @@ std_powerpc64 ( ) { # # QEMU settings for the standard environments # -qemu_env ( ) { - +qemu_env() { NANO_DISKIMAGE_FORMAT=qcow2 } @@ -594,7 +590,7 @@ eval std_${NANO_ARCH} : ${NANO_ENDIAN:=little} # make -V something to figure it out? : ${NANO_LAYOUT:=std-embedded} : ${NANO_MAKEFS_UFS:=makefs -t ffs -B ${NANO_ENDIAN}} -: ${NANO_DISK_SCHEME:=mbr} # No others really supported ATM (well, gpt) +: ${NANO_DISK_SCHEME:=mbr} # No others really supported ATM (well, gpt) case ${NANO_LAYOUT} in std-embedded) NANO_SLICE_FAT=s1 diff --git a/tools/tools/nanobsd/fill_pkg.sh b/tools/tools/nanobsd/fill_pkg.sh index 17d163709f91..e706fbdd11ea 100644 --- a/tools/tools/nanobsd/fill_pkg.sh +++ b/tools/tools/nanobsd/fill_pkg.sh @@ -35,18 +35,18 @@ : ${PORTSDIR:=/usr/ports} -usage () { +usage() { echo "Usage: $0 [-cv] package-dump-dir nano-package-dir port-dir-or-pkg ..." 1>&2 exit 2 } -msg () { +msg() { local l l=$1 ; shift [ "$l" -le "$VERBOSE" ] && echo $* } -ports_recurse() ( +ports_recurse() { local outputfile dumpdir type fullpath pkgname p outputfile=$1 ; shift dumpdir=$1 ; shift @@ -100,9 +100,9 @@ ports_recurse() ( else dir=`dirname "$p"` # Get directory from SPECIFIED path, not from full path if [ "$dir" = "." ] ; then - dir="" + dir="" else - dir=${dir}/ + dir=${dir}/ fi deps=`pkg info -dF "$fullpath" | grep -v "$pkgname:"` for dep in $deps ; do @@ -114,7 +114,7 @@ ports_recurse() ( echo "$pkgname" >> "$outputfile" fi done -) +} COPY="ln -s" VERBOSE=0home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69bc2f31.33db9.4d037b95>
