6.14. oksh 7.8
oksh provides the interactive login shell used when entering the target chroot.
Input assumption: oksh-7.8.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Source URL: https://github.com/ibara/oksh/releases/download/oksh-7.8/oksh-7.8.tar.gz
Upstream build note: upstream ships a custom configure script and documents ./configure, make, and make install. for cross builds, upstream documents --no-thanks to skip host execution checks.
Licenses:
- Public domain (main shell code)
- BSD and ISC-style licenses (portability code)
Dependencies:
- musl (libc)
- clang/llvm toolchain
- make
oksh is a portable OpenBSD ksh implementation. we need it to provide the interactive login shell used for chapter 7 chroot work.
Extract and Enter the Source Tree
cd "$LBI_SOURCES"
tar -xf oksh-7.8.tar.gz
cd oksh-7.8
Configure oksh
oksh does not use GNU autotools configure defaults, so lbi_configure is not supported here. this section calls upstream's script directly and uses --no-thanks for cross-compiling.
./configure \
--no-thanks \
--disable-curses \
--prefix=/system \
--bindir=/system/binaries \
--mandir=/system/documentation/man-pages \
--cc="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" \
--cflags="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS"
Build oksh
make $LWI_MAKE_FLAGS \
LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LBI_CUSTOM_LDFLAGS"
Install oksh
make install DESTDIR="$LBI_ROOT"
ln -sf oksh "$LBI_ROOT/system/binaries/ksh"
Command Explanations
./configure: Uses oksh's upstream configure script directly because it is not a GNU autotools-compatible script.--no-thanks: Skips configure checks that try to run target-built test programs during the cross build.--disable-curses: Builds oksh without curses support for this early target shell.--prefix=/system,--bindir=/system/binaries, and--mandir=/system/documentation/man-pages: Install oksh into the book's filesystem layout.--cc="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang": Uses the target-prefixed Clang compiler.--cflags="--target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS": Targets the selected triple/sysroot while preserving local C flag tuning.make $LWI_MAKE_FLAGS LDFLAGS=...: Builds with shared make parallelism and target-sysroot linker flags.make install DESTDIR="$LBI_ROOT": Installs into the target root instead of the host system.ln -sf oksh "$LBI_ROOT/system/binaries/ksh": Provides the traditionalkshcommand name for the installed oksh binary.