Linux from source is a set of bash scripts to build custom "LFS" Linux From Scratch and uses dpkg as a package manager. Linux From Source is also a movment to build the Linux OS from Source code, with a facebook group and a future website to host LFS based projects with documentation.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build_system
build_tools
files
screenshots
LICENSE
README.md
backup-system.sh
chroot.sh
config.sh
copyscripts.sh
debian-LFS-depends.sh
generate-iso.sh
logo
prepare-iso.sh
umount.sh
version-check.sh
wget-list
wget.sh

README.md

Linux From Source Project

alt text

Facebook Group: Linux From Source Code

Donation Link: Linux-From-Source-GoFundMe

Linux From Source is a set of bash scripts to build a basic custom "LFS" Linux From Scratch, using dpkg as a basic package manager. These bash scripts will build normal LFS, for the architecture that its compiled on. there is an option to enable multilib if using a 64 bit computer.

Host system requirements are the dependencies needed on the host system, the Linux distro you decide to build on.

You can find the LFS page for host system requirements below. And for this project you will also need packages like cpio, xorriso, git, wget, and squashfs-tools. "sh" should be a symlink to "bash", "yacc" should be a symlink to "bison", and "awk" should be a symlink to "gawk". There may be a script added later to automate this process for the popular linux distro's. There is a LFS version-check.sh to check your system for missing dependencies.

LFS: Host System Requirements

run the LFS version-check.sh

./version-check.sh

arch-linux dependencies

pacman -S linux-headers base-devel cpio xorriso squashfs-tools git wget

First Things First

You need a clean environment to work in, please be sure to remove the symlink to /tools if starting over and then you can create the needed directories and the symlink to /tools by running the config.sh

Cleaning the system

rm -rf /mnt/linux-from-source

rm /tools

Run the config.sh

./config.sh

You can find out if the /tools symlink is funtional by "ls -l /" it should be cyan color or red if broken.

ls -l /

The LFS wget.sh

You can now run the LFS wget.sh that will fetch the needed sources of the packages used. Run it

./wget.sh

Build LFS tools

The first thing you do is build the LFS tools, this is the GNU linux toolchain. Change into the build_tools directory and you can run the scripts one by one from 0 to 99 in order. there is also the build_tools.sh that will attempt to build them all but its not as reliable because the wget script may fail to download a package because the LFS link has changed. In a event like this open the script with an editor, find a download link for the package and change into the /mnt/linux-from-source/source directory and wget it. that is how its done.

CopyScripts, Chroot and building the LFS system

There is the copyscripts.sh that will copy the build_system directory to /mnt/linux-from-source, before it copies the directory, it will rm -rf /mnt/linux-from-source/build_system directory in the work environment. This is for rapid development, changing scripts and re copying them. There is the chroot.sh that chroots you into the work environment in /mnt/linux-from-source. You then change into the build_system directory and run the scripts 0 through 1000 in order just like tools, and there is also the build_system.sh that is not as reliable. When exiting the chroot be sure to run the umount.sh twice because it causes problems with internet connectivity with the mounts. In the event you forget to run the umount.sh twice and you loose internet connectivity, just reboot/force reboot, pick up where you left off.

iso Creation

When the system is built you can exit chroot, umount.sh twice and run the prepare-iso.sh. This will create an initramfs of the whole system and copy the kernel bzImage/initramfs into the iso directory. it will also fetch syslinux and copy the linux-from-source syslinux.cfg to where it belongs in the iso directory. You can then run the generate-iso.sh, this will create a iso of the LFS system named linux-from-source-v1.iso with a xorriso command. you can then create a bootable usb drive of the iso and test, I test on bare metal but there maybe a script to run the iso in qemu one day.

Using a backup of the LFS tools and preverving the source directory

You can easily preserve the sources directory when starting over by moving it into the files directory and moving it back after cleaning the system and running the config.sh. You can do the same with the backup-tools.sh, this will make a directory /LFS-tools-backup and copy the /tools there. you can then copy the tools into /mnt/linux-from-source to restore them. do not try to move the backup-tools into the system, they will break and be unusable so use:

cp -r /LFS-tools-backup/tools /mnt/linux-from-source/

Future

Linux-from-source is not just a simple set of bash scripts to build a custom LFS, it is a movement now with the Facebook group and a website comming soon that will host all kinds of "linux-from-source" projects that are based on linux from scratch, including documentation for these projects.

Remember to go to the linux-from-source facebook group for support and everything else.

Donation

There is a GoFundme page for linux-from-source, and all the funds go to the linux-from-source-team. the linux-from-source-team is a collection of the most active people inside the facebook group. the funds will be used to help the linux-from-source-team with general funds for life, getting hardware to build LFS for different systems, and hosting challenges with prizes inside the facebook group. I have even started streaming the building process to twitch and the facebook, with hopes more members start doing that. Here is the link to the Linux-From-Source-GoFundMe