6.15. bfs 4.1
bfs provides a breadth-first, find-compatible file traversal utility for the target userspace.
Input assumption:
bfs-4.1.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Source archive note: this release archive is flat (no top-level directory), so extract it into a dedicated
bfs-4.1/ directory.
Licenses:
- 0BSD
Dependencies:
- musl (libc)
- make
bfs is a breadth-first find-compatible file search utility. we need it to replace find in the target userspace with a modern and predictable traversal tool.
Extract and Enter the Source Tree
cd "$LBI_SOURCES"
mkdir -pv bfs-4.1
tar -xf bfs-4.1.tar.gz -C bfs-4.1
cd bfs-4.1
Configure bfs
Configure note:
bfs ships a custom configure wrapper and does not follow the standard autotools configure interface used by lbi_configure, so this section uses its native ./configure command directly.
CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" \
CFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS" \
LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LBI_CUSTOM_LDFLAGS" \
./configure \
--enable-release \
--without-libacl \
--without-libcap \
--without-libselinux \
--without-liburing \
--without-oniguruma
Build bfs
make $LWI_MAKE_FLAGS
Install bfs
install -Dm755 bin/bfs "$LBI_ROOT/system/binaries/bfs"
install -Dm644 docs/bfs.1 "$LBI_ROOT/system/documentation/man-pages/man1/bfs.1"
Replace find with bfs
ln -sf bfs "$LBI_ROOT/system/binaries/find"
Command Explanations
mkdir -pv bfs-4.1: Creates a dedicated source directory because this release archive does not contain a top-level directory.tar -xf bfs-4.1.tar.gz -C bfs-4.1: Extracts the flat archive into that dedicated directory.CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang": Uses the target-prefixed Clang compiler.CFLAGSandLDFLAGS: Target the selected triple/sysroot and preserve local compile and link tuning../configure: Uses bfs' native configure wrapper because it does not support the fulllbi_configureoption set.--enable-release: Selects the release build profile.--without-libacl,--without-libcap,--without-libselinux,--without-liburing, and--without-oniguruma: Disable optional dependencies that are not present in the early target userspace.make $LWI_MAKE_FLAGS: Builds bfs with the shared make parallelism setting.install -Dm755 bin/bfs ...: Installs the bfs executable and creates the destination directory if needed.install -Dm644 docs/bfs.1 ...: Installs the manual page into the book's man-page tree.ln -sf bfs "$LBI_ROOT/system/binaries/find": Provides the conventionalfindcommand name through bfs.