CBKADAL
OSP Weekly Assignments
C. BinKadal --- Sendirian, Berhad.


OS Week 08 Assignment #3: Linux From Scratch 12.2 Ch. 1-5

Preparation (IMPORTANT!)

Check file system /mnt/lfs

df | grep lfs



If there is no “/mnt/lfs”, see here.


Check some environments for the ROOT account

# SUPERUSER (ROOT)
echo "LFS=\"$LFS $(df $LFS|tail -1|awk '{print $1,int($2/1000000)"G"}')\" ARCH=$(arch) NPROC=$(nproc)"


  • LFS should be mounted on /mnt/lfs
  • LFS size should be 32GB


Follow “The Linux From Scratch version 12.2 Book” chapter 1-5


Take Note: SKIP Ch 2.4, 2.5, 2.7

Because “/mnt/lfs/” already exists!


Take Note: DO NOT SKIP Ch 2.6, 3.1 (ROOT)

# SUPERUSER (ROOT)
# This is for both VirtualBox and UTM
#
if [[ "$(id -u)" == "0" ]] ; then
  echo "======================"
  echo "LFS should be /mnt/lfs"
  echo "LFS=$LFS"
  echo "======================"
  sleep 4
  mkdir -pv $LFS/sources/
  chmod -v  a+wt $LFS/sources/
  cd        $LFS/sources/
  wget -c   https://www.linuxfromscratch.org/lfs/view/12.2/wget-list-sysv --directory-prefix=$LFS/sources
  wget -c   --input-file=$LFS/sources/wget-list-sysv --directory-prefix=$LFS/sources
  wget -c   https://www.linuxfromscratch.org/lfs/view/12.2/md5sums --directory-prefix=$LFS/sources
  md5sum -c md5sums
  chown root:root $LFS/sources/*
else
  echo "=== === === === ERROR: ROOT ONLY === === === ERROR ==="
  echo "=== === === === ERROR: ROOT ONLY === === === ERROR ==="
  echo "=== === === === ERROR: ROOT ONLY === === === ERROR ==="
fi


Make sure files “wget-list-sysv” and “md5sums” are in $LFS/sources/

ls -al $LFS/sources/{md5sums,wget-list-sysv}
# -rw-r--r-- 1 root root 5110 Sep  1 02:27 /mnt/lfs/sources/md5sums
# -rw-r--r-- 1 root root 5957 Sep  1 02:27 /mnt/lfs/sources/wget-list-sysv

  • Download locations may not always be accessible. If unsuccessful, try:
    (source mirror1) (source mirror2) (source mirror3)
    • See also os1:///home/zzyLFS/
  • After downloading the packages (chapter 3.1), continue to Chapter 4, and so on.
  • Make sure you have three accounts:
    • your own account (e.g. cbkadal but you are not cbkadal!)
    • root account
    • lfs account
  • Make sure when to use:
    • your own account (e.g. “cbkadal”)
    • root account
    • lfs account


Binutils-2.41 - Pass 1: Standard Build Unit (SBU)

Chapter 5.2.1. Installation of Cross Binutils (lfs)

  • Check your “LFS”, “ARCH”, “NPROC”, and “MAKEFLAGS” environment for all accounts (e.g. “cbkadal”, “root”, “lfs”).
mkdir -v build
cd       build
time { ../configure --prefix=$LFS/tools \
             --with-sysroot=$LFS \
             --target=$LFS_TGT   \
             --disable-nls       \
             --enable-gprofng=no \
             --disable-werror    \
             --enable-new-dtags  \
             --enable-default-hash-style=gnu && make && make install; }
echo "ZCZC I am $(whoami)@$(hostname) using $(uname -r) $(df $LFS|tail -1|awk '{print $1,int($2/1000000)"G"}')" 
echo "LFS=\"$LFS\" ARCH=$(arch) NPROC=$(nproc) MAKEFLAGS=$MAKEFLAGS"


Generate LFS Chapters 1-5 Report

Last, after finishing chapter 5, run (cbkadal):

export LFS="/mnt/lfs/"
cd $HOME/mywork/WEEK08/
bash 08_WEEK08.sh


Result/Report

(cbkadal):

cd $HOME/RESULT/W08/
ls -al



© 2024-2024 --- C. BinKadal --- Revision: Wed 20 Nov 2024 07:00.