lundi 14 janvier 2013

Building its own Linux distribution


Preparing for Linux build

Host System Requirements

Before going further you need to check some requirements on the host system. Here at pastebin you can find the version checking file.
After download, run $bash version-check.sh. You can also create it locally directly from the terminal as follow:
$cat > version-check.sh << "EOF"
>Paste here the content from pastebin
>EOF
Here is a possible output, you should have packages with at least similar version or higher than this output.
In my case, I had to install gawkpatch, and makeinfo. You may have trubble to install the last one, it is available in texinfo package. Here are the issued installation commands:
$sudo aptitude install gawk
$sudo aptitude install patch
$sudo aptitude install texinfo

Preparing a new partition

I'm using xubuntu running on a VirtualBox, to create a partition I added a new device to my virtual machine: Configuration->Storage -> select the disk controller -> add new disk. I used GParted to create new partitions.
To create a filesystem on the created partition: $sudo mke2fs -jv /dev/
In my case I used the existing swap partition in the host system.
After setting the filesystem, the partition need to be mounted:
$export LFS=/mnt/lfs
$sudo mkdir -pv $LFS
$sudo mount -v -t ext3 /dev/ $LFS

After that, I created a directory under /mnt/lfs to store downloaded packagaes before installation.

$sudo mkdir -v $LFS/sources
$sudo chmod -v a+wt $LFS/sources


I used wget to download needed packages, here is a complete list of packages to download. I first created a file to store this list as follow:

$cat > wget-list << "EOF"
>Paste here the content of packages list
>EOF


To start downloading, it took a while depending on the available bandwidth: 
$sudo wget -i wget-list -P $LFS/sources 
In the list you man-pages-3.35.tar.gz and zlib-1.2.6.tar.bz2 were missings, I had to download them manually by google the package name.

Changing the owner of from root to lfs.



When I was trying to configure GCC, i get following error error: C compiler cannot create executables. After some search, it seams that the $LFS_TGT variable was not set correctly as a result of creating a directory with user  root instead lfs , and thus I had to restart from scratch.

repeat from section 2.2 building binutils-2.2
5.4. Binutils-2.22

to be continued.