Giter VIP home page Giter VIP logo

bilfs's Introduction

BI Linux From Scratch

notes and some scripts to build Linux From Scratch 12

Install prerequisites

To you get started depending on your OS follow one of these guides:

And run this script to verify:

./check-versions.sh

Prepare disk image and folders

set environment variables (if you are using the nix-shell you don't need to do this):

export LC_ALL=POSIX
export LFS=/mnt/lfs
export LFS_TGT=$(uname -m)-lfs-linux-gnu
export CONFIG_SITE=$LFS/usr/share/config.site
export PATH=$LFS/tools/bin:$PATH
export NPROC=$(nproc)
export MAKEFLAGS="-j$NPROC"
umask 022

prepare.sh is going to download packages from wget-list-sysv and store them in ./sources folder to be re-used in later executions. Delete the folder if you change the list of packages.

Sources are basically LFS 12 wget-list-sysv + sudo and curl

# defaults
# LFS_DISK_IMAGE=lfs.img
# LFS_DISK_SIZE_GB=50
LFS_DISK_IMAGE=/mnt/storage/lfs-my-image.img \
    LFS_DISK_SIZE_GB=100 \
    ./prepare.sh

Install tools from host

You can follow README-manual.md to execute the commands one by one (note that the instructions are less complete and you are going to have to improvise at the end to get it all working)

..or you can run the scripts that automate this process:

./install.sh

and verify the compiler it's working:

echo 'int main(){}' | $LFS_TGT-gcc -xc -
readelf -l a.out | grep ld-linux
#cleanup
rm -v a.out

it if all looks good, execute the second step:

./install2.sh

Install tools in chroot

Copy config files:

cp ./etc/* $LFS/etc/

Set permissions and mount directories to host

sudo chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools,lib64}

sudo mkdir -pv $LFS/{dev,proc,sys,run,tmp}

./chroot-mount.sh

Copy install scripts in the new fs:

mkdir $LFS/opt
cp install3.sh $LFS/opt
cp install4.sh $LFS/opt

Enter chroot:

sudo mkdir -pv $LFS/root
sudo chroot "$LFS" /usr/bin/env -i   \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='(lfs chroot) \u:\w\$ ' \
    PATH=/usr/bin:/usr/sbin     \
    MAKEFLAGS="-j${NPROC}" \
    /bin/bash --login

run install script 3:

/opt/install3.sh

and when successful run install 4

/opt/install4.sh

Setup sudo

sudo is configured to allow access to all users in the wheel group so if you need new user

mkdir -pv /home/myuser
useradd -d /home/myuser
usermod -a -G wheel myuser

Setup network

if the host is connected to the internet, you should just configure DNS for the chrooted environment

cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

# End /etc/resolv.conf
EOF

echo "bilfs" > /etc/hostname

Usage

Root SSL certificates are not installed so if you want to use curl for https links, you would need to run

echo "--insecure" >> ~/.curlrc

to turn off SSL checks

Cleanup

exit the chroot and umount

./chroot-umount.sh

delete your disk

rm lfs.img

remove sources

rm -rf ./sources

bilfs's People

Contributors

gotha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.