8.36. uutils-coreutils 0.8.0
Build and install the final Rust core utilities after the target Rust toolchain is available.
Input assumption: coreutils-0.8.0.tar.gz is already present in /sources from the chapter 4 source staging step.
Source URL: https://github.com/uutils/coreutils/archive/refs/tags/0.8.0.tar.gz
Licenses:
- MIT
Dependencies:
- musl (libc)
- clang
- make
- ca-certificates
- rustc
- cargo
uutils-coreutils is a Rust reimplementation of the GNU core utilities. we need it to provide the final target command set that replaces the temporary early-userland utility coverage after Rust is installed.
Extract and Enter the Source Tree
cd /sources
rm -rf coreutils-0.8.0
tar -xf coreutils-0.8.0.tar.gz
cd coreutils-0.8.0
Build uutils-coreutils
Build option note:
MANPAGES=n and COMPLETIONS=n avoid the uudoc documentation branches, whose install paths do not match the book's manpage and completion layout. MULTICALL=y installs one coreutils binary with hardlinked applet names, replacing the temporary utility implementations in /system/binaries.
CARGO_BUILD_JOBS="$LWI_MAKE_JOBS" \
CARGO_BUILD_TARGET="$LBI_ARCH-unknown-linux-musl" \
SSL_CERT_FILE=/system/configuration/ssl/cert.pem \
CARGO_HTTP_CAINFO=/system/configuration/ssl/cert.pem \
make $LWI_MAKE_FLAGS \
PROFILE=release \
MULTICALL=y \
MANPAGES=n \
COMPLETIONS=n \
LOCALES=y \
PREFIX=/system \
BINDIR=/system/binaries \
DATAROOTDIR=/system/share \
CARGOFLAGS="--locked"
Install uutils-coreutils
CARGO_BUILD_JOBS="$LWI_MAKE_JOBS" \
CARGO_BUILD_TARGET="$LBI_ARCH-unknown-linux-musl" \
SSL_CERT_FILE=/system/configuration/ssl/cert.pem \
CARGO_HTTP_CAINFO=/system/configuration/ssl/cert.pem \
make install \
PROFILE=release \
MULTICALL=y \
MANPAGES=n \
COMPLETIONS=n \
LOCALES=y \
PREFIX=/system \
BINDIR=/system/binaries \
DATAROOTDIR=/system/share \
CARGOFLAGS="--locked"
Verify uutils-coreutils
coreutils --help >/dev/null
cat --version
test --help >/dev/null
[ --help >/dev/null
After this step is complete, the temporary
sbase tools are still useful history for bootstrapping, but the final command names in /system/binaries now come from uutils-coreutils.
Command Explanations
rm -rf coreutils-...andtar -xf: Recreate a clean uutils-coreutils source tree.CARGO_BUILD_JOBS="$LWI_MAKE_JOBS": Uses the shared job count for Cargo builds.CARGO_BUILD_TARGET="$LBI_ARCH-unknown-linux-musl": Builds for the musl target triple matching the selected architecture.SSL_CERT_FILEandCARGO_HTTP_CAINFO: Point Cargo and TLS users at the installed CA bundle.make $LWI_MAKE_FLAGS PROFILE=release MULTICALL=y MANPAGES=n: Builds the release multicall binary without generating man pages.make install ... PREFIX=/system: Installs coreutils into the book's layout.coreutils --help,cat --version,test --help, and[ --help: Smoke-test the multicall binary and important applets.