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


OS Week 09 Assignment #3: Linux From Scratch 12.2 Ch. 6-7

Preparation (IMPORTANT!)

Check file system /mnt/lfs

df | grep lfs



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



Three (3) Accounts

  • your own account, e.g., (user cbkadal)
  • root account (root)
  • lfs account (user lfs)

Check ALL environments for root and lsf accounts:

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




Follow “The Linux From Scratch version 12.2 Book” chapters 6-7


Take Note!

You might want to combine the commands in chapter 7.2-7.4 (root)

echo "= (1) ======================================"; sleep 1
echo "LFS=$LFS NPROC=$(nproc) MAKEFLAGS=$MAKEFLAGS"
echo "= (2) ======================================"; sleep 1
chown --from lfs -R root:root $LFS/{usr,lib,var,etc,bin,sbin}
[ -d $LFS/tools/ ] && chown --from lfs -R root:root $LFS/tools/
case $(uname -m) in
  x86_64) chown --from lfs -R root:root $LFS/lib64 ;;
esac
mkdir -pv $LFS/{dev,proc,sys,run}
echo "= (3) ======================================"; sleep 1
systemctl daemon-reload
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts
mount -vt proc   proc  $LFS/proc
mount -vt sysfs  sysfs $LFS/sys
mount -vt tmpfs  tmpfs $LFS/run
echo "= (4) ======================================"; sleep 1
if [ -h $LFS/dev/shm ]; then
  install -v -d -m 1777 $LFS$(realpath /dev/shm)
else
  mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi
echo "= (5) ======================================"; sleep 1
df /
echo "= (6) ======================================"; sleep 1
chroot "$LFS" /usr/bin/env -i   \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='(lfs chroot) \u:\w\$ ' \
    PATH=/usr/bin:/usr/sbin     \
    MAKEFLAGS="-j$(nproc)"      \
    TESTSUITEFLAGS="-j$(nproc)" \
    /bin/bash --login


The FIRST TIME chroot RESULT

(lfs chroot) I have no name!:/#


Generate LFS Ch. 6-7 Report

  • After finishing chapter 7, move (root):
mv -v $HOME/lfs-temp-tools-*.tar.xz /var/tmp/lfs-temp-tools-12.2.tar.xz


Cross Check

  • Cross-check that “lfs-temp-tools-12.2.tar.xz” is in /var/tmp/ (root)
    • The file size should be almost 1000 MB!
    • Don’t delete the lfs-temp-tools-12.2.tar.xz file until the end of the term.
    • If prompted, you should be able to show that file.
date;echo $(arch; lscpu|grep -E 'Model name'|tail -1); du -s -h /var/tmp/lfs-temp-*


Last, run (user):

export LFS="/mnt/lfs/"
cd $HOME/mywork/WEEK09/
bash 09_WEEK09.sh


Result/Report

cd $HOME/RESULT/W09/
ls -al



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