8.19. bfs stage 2 4.1
Rebuild bfs in the final target environment so the find-compatible traversal tool matches the completed userspace.
Input assumption: bfs-4.1.tar.gz is already present in /sources from the chapter 4 source staging step.
Source URL: https://github.com/tavianator/bfs/releases/download/4.1/bfs-4.1.tar.gz
Source archive note: this release archive is flat (no top-level directory), so extract it into a dedicated bfs-4.1/ directory.
Upstream build note: upstream documents ./configure followed by make. The custom configure wrapper supports --enable-release and explicit --without-* dependency toggles, but it does not support the full lbi_configure directory option set.
Licenses:
- 0BSD
Dependencies:
- musl (libc)
- make
bfs is a breadth-first find-compatible file search utility. we need it to provide final target bfs and find command behavior in the completed chapter 8 userspace.
Extract and Enter the Source Tree
cd /sources
rm -rf bfs-4.1
mkdir -p bfs-4.1
tar -xf bfs-4.1.tar.gz -C bfs-4.1
cd bfs-4.1
Configure bfs
bfs does not use an autotools-compatible configure script, so lbi_configure is not applicable here.
CC=cc \
CFLAGS="-O2 $LWI_CFLAGS" \
LDFLAGS="$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 /system/binaries/bfs
install -Dm644 docs/bfs.1 /system/documentation/man-pages/man1/bfs.1
Replace find with bfs
ln -sf bfs /system/binaries/find
/sources if you do not plan to rebuild bfs again.
Command Explanations
rm -rf bfs-4.1andmkdir -p bfs-4.1: Recreate the dedicated source directory for bfs' flat archive.tar -xf bfs-4.1.tar.gz -C bfs-4.1: Extracts the source archive into that directory.CC=cc,CFLAGS, andLDFLAGS: Build with the target compiler and local tuning variables../configure --enable-release: Configures bfs for a release build.--without-libacl,--without-libcap,--without-libselinux,--without-liburing, and--without-oniguruma: Disable optional dependencies not required in this target system.make $LWI_MAKE_FLAGS: Builds with shared make parallelism.install -Dm755andinstall -Dm644: Install the executable and man page.ln -sf bfs /system/binaries/find: Provides the standardfindcommand name.