Tue Oct 15 03:52:38 2019 UTC

Building of the CHROOT (pass 1)

In this first pass we will build a chroot environment which will be used to build a NuTyX in a second pass. If you choose to use a separate partition, it should be mounted now. When done we can go on.

We start by creating folders, links and the right user account for the building of the first pass.

The first part of preparation is done via the root account and the second directly in the unprivileged account LFS.

The building time of the first pass can vary between 1 hour( with an 8 core processor) and probably 1 night(with a single core 32 bits).

It's a summary of what has to be done before starting the various scripts which will do the job automatically.

Note that in this article, we use only a folder and not a partition. It's possible to build the CHROOT in a folder.

Administrator part:

  1. Creation of the LFS configuration variable:
  2. export LFS=/mnt/lfs
  3. Creation of folders:
  4.  mkdir -vp $LFS/{sources,tools}
  5. Add the needed links:
  6. ln -svf $LFS/tools /
    ln -svf $LFS/sources /
  7. Creation of the lfs user:
  8. groupadd lfs
    useradd -s /bin/bash -g lfs -m -k /dev/null lfs
    passwd lfs
    Enter the password of your choice, it's not absolutely necessary if you enter this account from root.
  9. Owner and mode changing of the folders:
  10. chown -v lfs $LFS/{tools,sources}
    chmod -v a+wt $LFS/sources
    chown -v lfs $LFS
  11. Adjust the working environment: the /home/lfs/.bash_profile file:
  12. cat > /home/lfs/.bash_profile << "EOF"
    exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
    and the /home/lfs/.bashrc file
    echo "set +h
    umask 022
    LFS_TARGET=$(uname -m)-nutyx-linux-gnu
    export LFS LC_ALL LFS_TARGET PATH" > /home/lfs/.bashrc
Time to go on with the LFS unprivileged user part:
su - lfs

LFS part:

From now on, you should type all the commands as lfs user.

you get the latest version of the source code from git:

git clone https://github.com/NuTyX/packages-x86_64 development

Once this is done, a new folder is created: development. We open it and launch the first script:

cd development

The script will check a series of verifications and NO errors should occur. The downloading of the sources will start automatically. When it's finish you just have to follow the instructions.

If everything went well, you should be reading the following messages:

=====> Successfull configured
If you’re reading this, congratulations you are ready to launch the first pass for the construction of your future NuTyX, do:
cd chroot

Let the show begin ...

+ mkdir -pv /mnt/lfs/var/lib/pkg/DB
mkdir: created directory '/mnt/lfs/var'
mkdir: created directory '/mnt/lfs/var/lib'
mkdir: created directory '/mnt/lfs/var/lib/pkg'
mkdir: created directory '/mnt/lfs/var/lib/pkg/DB'
=======> Building '/home/lfs/development/chroot/cards/Pkgfile' succeeded.

Note that you can follow the evolution of the construction and then check that everything has gone well by consulting the folder /home/lfs/logs/chroot/ . For each build package there is a corresponding log.