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:

Dependencies:

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