Fri Mar 10 15:06:31 2017 UTC

Post-construction and (optional) generation of the iso

Introduction

If you're done with pass2 successfully, you have then all the packages needed for a basic system.

We can now finalise our NuTyX and adapt it to our needs. And then, we can produce an installable ISO if we want to.

It's time to decide what you still need, at this point of progress your NuTyX:

  1. Do not have a kernel.
  2. Do not contain a boot program.
  3. Do not contain any other formating tools then the one for ext3, ext4.
  4. Do not contain any tool for RAID management.
  5. Can not connect to a dhcp server and get a dynamic address.
  6. Do not contain a text editor.

On the other hand your NuTyX contains some services that you most probably will never use.

How to go on

It's now time for you to decide what you need. A boot system, a kernel, your favorit filesystem, logical volume or RAID and your ip adress dynamic or static.

Before that we need to configure a minimum the 'cards' package manager and downloads all the ports containing the building receipes of all the available NuTyX packages.

  1. We start to exit from the NuTyX.
    exit

    We check if the LFS variable is still set.

    echo $LFS

    It must return something.

    /mnt/lfs
  2. We can now reenter in the new NuTyX to finalise the job.
    chroot $LFS /usr/bin/env -i HOME=/root TERM="$TERM" PS1='\u: \w\$' \
    /bin/bash --login
    No error should be print:
    root [ / ]# 
  3. We begin by adjusting the cards.conf file. We used from now on only the recept coming from the git project. You need to adapt the language if necessary.
    cat > /etc/cards.conf << "EOF"
    dir /usr/ports/gui-extra
    dir /usr/ports/gui
    dir /usr/ports/cli-extra
    dir /usr/ports/cli
    dir /usr/ports/base
    locale de
    base /usr/ports/base
    EOF
  4. We can now download all the availables ports and compile the receipts we want ( as long the collections are corrected configured in the cards.conf file above )
    ports -u
    ...

    We are now ready to finalise our NuTyX

The kernel compilation and optional ports compilations

  1. Kernel compilation

  2. The kernel will be the only mandatory package, without it your NuTyX will never be able to start and run. You can choose different possibilities:

    1. Compilation of one of the available ports kernel

      This choice is mandatory if you plan to produce an installable ISO. It's also the most simple choice:

      cd /usr/ports/base/kernel-lts
      pkgmk -d -i
    2. Compile your own kernel

      This choice means that the generation of an installable ISO will be not possible

      You can follow the article explaining how to compile your own kernel or you will find many tutos about kernel compilation on the net.

  3. Remove unnecessary services(recommended)

  4. During the construction of your NuTyX, services ssh and rsync have been automatically installed. If you not plan to activate a rsync server or not plan to remote acces your machine, it's strongly recommenended to deactivate thoses services. Even if you don't know what's are they, do:

    cards remove openssh.service
    cards remove rsync.service

    Add grub the boot process tool (optional)

    The grub package is ony need if you decide to produce an installable ISO or if you don't have any boot procedure yet on your machine (most probably you already have one):

    cards depcreate grub

    Once grub is installed, you will be able to setup your boot process via the command line or later via the generated ISO.

  5. Adding other files system supports (optional)

    The following files systems are availables:

    cards depcreate btrfs-progs
    cards depcreate xfsprogs
    cards depcreate reiserfsprogs
    cards depcreate jfsutils

    Choose your favorit one or leave it as ext3 , ext4.

  6. Adding the logical partitons tools and RAID (optional)

  7. If you are using RAID system:

    cards depcreate mdadm
  8. Adding a dhcp client to be able to obtain a dynamic IP adress (optional)

  9. If you don't want to use a fix ip adress, you will need a dhcp client tool:

    cards depcreate dhcpcd
  10. Adding a text editor (optional)

  11. The installeur in the generated ISO use the command 'vi' to edit your grub file, you can choose between:

    cards depcreate e3

    and

    cards depcreate vim
  12. Adding the NFS support (optional)

  13. If you don't use or don't know about NFS, you can ignore this option:

    cards depcreate nfs-utils

    Like for the sshd and rsync services, if you don't need a NFS serveur. do:

    cards remove nfs-utils.service

Option1: Produce an installable ISO

  1. We add all the necessary files for a working iso.
    cp -av /root/development/iso /ISO
    '/root/development/iso' -> '/ISO'
    '/root/development/iso/isolinux' -> '/ISO/isolinux'
    '/root/development/iso/isolinux/boot.cat' -> '/ISO/isolinux/boot.cat'
    '/root/development/iso/isolinux/boot.msg' -> '/ISO/isolinux/boot.msg'
    '/root/development/iso/isolinux/isolinux.bin' -> '/ISO/isolinux/isolinux.bin'
    '/root/development/iso/isolinux/isolinux.cfg' -> '/ISO/isolinux/isolinux.cfg'
    cp -v /boot/kernel-* /ISO/isolinux/kernel
    '/boot/kernel-3.19.3' -> '/ISO/isolinux/kernel'
    cp -v /boot/initrd-* /ISO/isolinux/initrd
    '/boot/initrd-3.19.3' -> '/ISO/isolinux/initrd'
    [Note] Consult options at the botton of the page before going further if you want to customize your ISO by adding some packages or if you want to get rid of the binaries archives and build logs to reduce the size of your ISO.
  2. We produce the squashfs files used by the iso and erase the existing one if necessary as the mksquashfs command is not able to overight existing file.
    mkdir -p /ISO/isolinux/boot/
    cd /
    for dir in opt bin etc lib root run sbin usr var home
    do
      [ -f ISO/isolinux/boot/$dir.squashfs ] && rm ISO/isolinux/boot/$dir.squashfs
      mksquashfs $dir ISO/isolinux/boot/$dir.squashfs
    done
  3. We can now go out of NuTyX and produce the iso.
    exit
  4. We can finally generate our ISO where the version is the date of today.
    [Important][Important][Important] Before you start the next command, make shure the LFS variable is still set and the commands mkisofs and isohybrid are available on your host linux distribution. They are belonging to cdrkit and syslinux packages.
    sh $LFS/root/development/scripts/mkiso
    Warning: creating filesystem that does not conform to ISO-9660.
    I: -input-charset not specified, using utf-8 (detected in locale settings)
    Size of boot image is 4 sectors -> No emulation
      3.82% done, estimate finish Fri Jan  9 21:46:48 2015
      7.63% done, estimate finish Fri Jan  9 21:46:48 2015
     11.44% done, estimate finish Fri Jan  9 21:46:48 2015
     15.25% done, estimate finish Fri Jan  9 21:46:48 2015
     19.06% done, estimate finish Fri Jan  9 21:46:48 2015
     22.88% done, estimate finish Fri Jan  9 21:46:48 2015
     26.68% done, estimate finish Fri Jan  9 21:46:48 2015
     30.50% done, estimate finish Fri Jan  9 21:46:48 2015
     34.31% done, estimate finish Fri Jan  9 21:46:48 2015
     38.12% done, estimate finish Fri Jan  9 21:46:48 2015
     41.94% done, estimate finish Fri Jan  9 21:46:48 2015
     45.74% done, estimate finish Fri Jan  9 21:46:48 2015
     49.56% done, estimate finish Fri Jan  9 21:46:48 2015
     53.37% done, estimate finish Fri Jan  9 21:46:48 2015
     57.19% done, estimate finish Fri Jan  9 21:46:48 2015
     60.99% done, estimate finish Fri Jan  9 21:46:48 2015
     64.81% done, estimate finish Fri Jan  9 21:46:48 2015
     68.62% done, estimate finish Fri Jan  9 21:46:48 2015
     72.43% done, estimate finish Fri Jan  9 21:46:48 2015
     76.24% done, estimate finish Fri Jan  9 21:46:48 2015
     80.06% done, estimate finish Fri Jan  9 21:46:48 2015
     83.86% done, estimate finish Fri Jan  9 21:46:48 2015
     87.68% done, estimate finish Fri Jan  9 21:46:48 2015
     91.49% done, estimate finish Fri Jan  9 21:46:48 2015
     95.31% done, estimate finish Fri Jan  9 21:46:48 2015
     99.11% done, estimate finish Fri Jan  9 21:46:48 2015
    Total translation table size: 2048
    Total rockridge attributes bytes: 1751
    Total directory bytes: 4096
    Path table size(bytes): 38
    Max brk space used 28000
    165140 extents written (322 MB)

    You have now an ISO located in the $LFS folder.

    ls $LFS/
    bin   etc   lib    NuTyX_x86_64-20161001.iso     root  sources  base  usr
    boot  home  lib64  NuTyX_x86_64-20161001.md5sum  run   srv      tmp     var
    dev   ISO   mnt    proc                                   sbin  sys      tools
  5. You just need to transfer it to your usb key and test it.
    dd if=$LFS/NuTyX_x86_64-20161001.iso of=/dev/sdb
    526336+0 records in
    526336+0 records out
    269484032 bytes (269 MB) copied, 66.4757 s, 4.1 MB/s

Congratulations, you have now a new base system NuTyX in your hands ready to be installed on all yours machines.

Options2: Reduce the size of your final ISO.

  1. If you want to reduce the size of the final ISO, you can remove the binaries archives and the logs, they won't be needed. If you want to keep the archives, give the following command:
    rsync -a /root/development/base/ /base/
    rsync -a /root/extra/base-extra/ /base-extra/

    no error should be printout.

    We can now delete the binaries from the git.

    find /root/ -name "*.cards.*" -exec rm -v {} \;

    no error should be printout.

    We erase the logs.

    mv /root/logs /logs

    If needed, binaries and logs are stored at the root directory of the new produced NuTyX.

  2. The compiled kernel is very big in space. If you want to reduce the size of your iso, you can delete the documentation and the sources of the kernel:
    pkgrm kernel.doc
    pkgrm kernel.devel