MidgardOS Developer Documentation

A website documenting creating the build root for MidgardOS


Section 5 - Building the Base System Tools

Navigation    
« Kmod 32-bit HOME GNU Diffutils »

GNU Coreutils

Name: GNU Coreutils
Summary: Basic file, shell, and text utilities needed for working with any Linux system
License: GPL v3 or later
Version: 9.9
URL: https://ftp.gnu.org/gnu/coreutils/coreutils-9.9.tar.xz

Average Build Time: 1.2 SBU
Used Install Space: 39 MiB

Preparation

To fix a bug in POSIX conformance with character boundaries with single and multi byte locales, apply the following patch:

patch -Np0 -i ../patches/coreutils/coreutils-9.9-i18n-1.patch

Configuration

To configure GNU Coreutils for install into the build root, run the following command:

autoreconf -fv
automake -af
FORCE_UNSAFE_CONFIGURE=1 \
./configure --prefix=/usr               \
            --libdir=/usr/lib64         \
            --libexecdir=/usr/lib64     \
            --enable-no-install-program=kill,uptime,hostname

Compilation and Installation

To compile GNU Coreutils, run the following command:

make

Next, run the test suite:

make NON_ROOT_USERNAME=tester check-root
if [[ ! -f /etc/pam.d/su ]]; then
    cat > /etc/pam.d/su << "EOF"
#%PAM-1.0
auth            sufficient      pam_rootok.so
auth            substack        common-auth
auth            include         postlogin-auth
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         common-account
password        include         common-password
session         include         common-session
session         include         postlogin-session
session         optional        pam_xauth.so
EOF
fi
useradd -c "Test User" -u 1000 -U -m tester
groupadd -g 102 dummy -U tester
unalias cp
cp -R ../coreutils-9.9 /tmp/
alias cp="cp -i"
chown -R tester /tmp/coreutils-9.9/
pushd /tmp/coreutils-9.9
    su tester -c "PATH=$PATH make -k RUN_EXPENSIVE_TESTS=yes check" < /dev/null
popd
rm -rf /tmp/coreutils-9.9
groupdel -f dummy
userdel -rf tester

There are two tests in both the privileged and unprivileged tests that are known to fail while inside a chroot. It is safe to ignore these failures for now.

Note that the /etc/pam.d/su configuration is a good temporary configuration for the su binary. It will be replaced when Util-Linux is installed.

Finally, to install GNU Coreutils into the build tree, run the following command:

make install
mv -v /usr/bin/chroot /usr/sbin
mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8

Contents

Contents  
Installed Programs [, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and yes
Installed Libraries libstdbuf.so
Navigation    
« Kmod 32-bit HOME GNU Diffutils »