Fri Mar 10 14:43:42 2017 UTC

Building of the CHROOT (pass 1)

In this first pass we will build up a chroot environnement which will be used to build a NuTyX in a second pass. If you choose to use a separate artition, 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 unpriviledge account LFS.

The building time of the first pass can varie between 1 hour( with an 8 cores 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 all 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 absolutly necessaryy if you enter this accound 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 environnement: 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
    EOF
    and the /home/lfs/.bashrc file
    echo "set +h
    umask 022
    LFS=$LFS
    LC_ALL=POSIX
    LFS_TARGET=$(uname -m)-lfs-linux-gnu
    PATH=/home/lfs/bin:/tools/bin:/bin:/usr/bin
    export LFS LC_ALL LFS_TARGET PATH" > /home/lfs/.bashrc
Time to go on with the LFS unprivildge user part:
su - lfs

LFS part:

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

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

git clone git://github.com/NuTyX/core.git development

Ones this is done, a new folder is created: development. We enter in it and launch the first script:

cd development
scripts/runmebeforepass1

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

If everything went well, you should read the following messages:

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

Let's 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.
/home/lfs/development/chroot

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