Milestone 1 (Chapter 1 & 2)

Mothership

Specs

OS: Xubuntu 20.04.5 amd 64
Memory: 8GB
vCPU: 4threads
Storage: 1x40GB & 1x30GB SCSI disk

  • Second disk is called mothership-0.vmdk
    Boot: BIOS

Startup Commands

sudo apt install ssh
mkdir ./lfs
sudo mkdir /mnt/lfs

Version Check

sudo apt install build-essential
sudo apt dist-upgrade
cat > version-check.sh << "EOF"
#!/bin/bash
# Simple script to list version numbers of critical development tools
export LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4
MYSH=$(readlink -f /bin/sh)
echo "/bin/sh -> $MYSH"
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
unset MYSH
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
bison --version | head -n1
if [ -h /usr/bin/yacc ]; then
echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
elif [ -x /usr/bin/yacc ]; then
echo yacc is `/usr/bin/yacc --version | head -n1`
else
echo "yacc not found"
fi
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
diff --version | head -n1
find --version | head -n1
gawk --version | head -n1
if [ -h /usr/bin/awk ]; then
echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
elif [ -x /usr/bin/awk ]; then
echo awk is `/usr/bin/awk --version | head -n1`
else
echo "awk not found"
fi
gcc --version | head -n1
g++ --version | head -n1
grep --version | head -n1
gzip --version | head -n1
cat /proc/version
m4 --version | head -n1
make --version | head -n1
patch --version | head -n1
echo Perl `perl -V:version`
python3 --version
sed --version | head -n1
tar --version | head -n1
makeinfo --version | head -n1 # texinfo version
xz --version | head -n1
echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
if [ -x dummy ]
then echo "g++ compilation OK";
else echo "g++ compilation failed"; fi
rm -f dummy.c dummy
EOF

Make executable and run

sudo chmod +x ./version-check.sh
bash version-check.sh

Output from the first ./version-check.sh pass

FIX:

sudo apt install bison binutils gawk texinfo
sudo ln -sf bash /bin/sh

Output after installing all dependencies

Partitioning Scheme

/dev/sdb needs to be partitioned

Setup Partitions

sudo -i
cfdisk /dev/sdb

Now select Write and type yes
lsblk after cfdisk

mkfs.ext2 /dev/sdb2 -L LFSBOOT
mkfs.ext4 /dev/sdb3 -L LFSROOT
mkfs.ext4 /dev/sdb4 -L LFSHOME
mkswap /dev/sdb5

lsblk -f /dev/sdb

Setting $LFS (2.6)

As normal user

exit
echo "export LFS=/mnt/lfs" >> ~/.bashrc
source ~/.bashrc
echo $LFS

As root user

sudo -i
echo "export LFS=/mnt/lfs" >> ~/.bashrc
source ~/.bashrc
echo $LFS

Mounting LFS manually (2.7)

sudo -i
mkdir -pv $LFS
mount -c -t ext4 /dev/sdb3 $LFS
mkdir -v $LFS/home
mount -c -t ext4 /dev/sdb4 $LFS/home
swapon /dev/sdb5

Mount on Boot

nano /etc/fstab

reboot
lsblk