7.10. ubase git snapshot
ubase provides Linux-specific base utilities for the chroot environment.
Input assumption: ubase-e8249b49ca3e.tar.gz is already present in /sources from the chapter 4 source staging step.
Source note: this archive is generated by scripts/fetch-sources.sh from upstream https://git.suckless.org/ubase at commit e8249b49ca3e02032dece5e0cdac3d236667a6d9.
Licenses:
- MIT/X Consortium-style license
Dependencies:
- musl (libc)
- make
- clang/llvm toolchain
ubase is a Linux-specific base utility collection from suckless. we need it to provide tools such as mount, umount, ps, stat, swapon, switch_root, and related Linux system commands inside the target environment.
Extract and Enter the Source Tree
cd /sources
tar -xf ubase-e8249b49ca3e.tar.gz
cd ubase-e8249b49ca3e
Build ubase
Build note: upstream ubase links
-lcrypt by default. musl provides the needed crypt interface from libc, so this target build clears LDLIBS.
make $LWI_MAKE_FLAGS \
CC=cc \
AR=ar \
RANLIB=ranlib \
CFLAGS="-std=c99 -Wall -Wextra $LWI_CFLAGS" \
LDFLAGS="$LBI_CUSTOM_LDFLAGS" \
LDLIBS=
Install ubase
make install \
DESTDIR= \
PREFIX=/system \
MANPREFIX=/system/documentation/man-pages \
CFLAGS="-std=c99 -Wall -Wextra $LWI_CFLAGS" \
LDFLAGS="$LBI_CUSTOM_LDFLAGS" \
LDLIBS=
install -d /system/binaries
if [ -d /system/bin ]; then
mv -f /system/bin/* /system/binaries/
rmdir /system/bin
fi
Command Explanations
cd /sources,tar -xf, andcd ubase-...: Enter the staged ubase snapshot source tree.make $LWI_MAKE_FLAGS: Builds ubase with the shared parallel make setting.CC=cc,AR=ar, andRANLIB=ranlib: Use the target toolchain now active inside the chroot.CFLAGS="-std=c99 -Wall -Wextra $LWI_CFLAGS": Keeps upstream warning settings while preserving local C flag tuning.LDFLAGS="$LBI_CUSTOM_LDFLAGS"andLDLIBS=: Apply local linker tuning and avoid extra default libraries.make install PREFIX=/system MANPREFIX=...: Installs ubase commands and manual pages into the book's layout.install -d /system/binaries: Ensures the final binary directory exists for any later command moves or links.