Info Summary[-][--][++]

I have successfully built LFS 7.0 i686 on my 2011 qdesk (AMD Phenom X4 8GB - see Computer Build - 2011 qDesk) machine. The host distro used to build it is i686 ArchLinux installed on my sda12, hostname is archdev, GCC is 4.6.2. A single SBU on that host machine is 27 seconds. The largest compile of GCC (the final build, not the temporary) was 47 SBU which took about 20 minutes. The actual partition on qdesk holding the new LFS build is sda13

LFS 7.0 build on ArchLinux around 2011-12-16 using GCC 4.6.2, do NOT upgrade that archdev distro!!!

Download Files[-][--][++]

Loading File Manager ...

Shell How to Package LFS for Installation[-][--][++]

This is for development, to package up the latest build to be installed below

Package Entire System[-][--][++]

Takes my current working LFS partition, tar.gz it, and send it to my website so I can install if on another computer.
From archdev as root NOT in chroot, make sure /mnt/lfs/dev/shm, /mnt/lfs/dev/pts, /mnt/lfs/dev, /mnt/lfs/proc, /mnt/lfs/sys are NOT mounted

Package LFS
mount /dev/sda13 /mnt/lfs
cd /mnt/lfs
tar -zcvf /mnt/lfs-current.tar.gz --exclude=./usr/src/ --directory=/mnt/lfs/ .
mv /mnt/lfs-current.tar.gz /nwq/admin/www/data/mrcore_files/lfs/i686/build/

Package Kernel[-][--][++]

When I rebuild the kernel from archdev its nice to deploy it to all other machines running my LFS
From archdev as root NOT in chroot

Package Kernel
mount /dev/sda13 /mnt/lfs
cd /mnt/lfs/boot
tar -zcvf /mnt/boot-current.tar.gz System.map-3.1 config-3.1 vmlinuz-3.1-lfs-7.0
mv /mnt/boot-current.tar.gz /nwq/admin/www/data/mrcore_files/lfs/i686/build/

Install How to Install my LFS Distro[-][--][++]

This is how to install the final build on your machine (Install my own custom distro). The idea is to simply download my root directories tar.gz and extract it to your partition then setup grub...

  1. Boot the ArchLinux Installer Live CD
  2. aif -p partial-configure-network
  3. Use cfdisk to make your partitions, I will do a small swap on sda1 and the remainder / on sda2, you can substitute to your desire
  4. mount /dev/sda2 /mnt; cd /mnt
  5. wget http://mreschke.com/files/lfs/i686/build/lfs-current.tar.gz
  6. tar -xzvf lfs-current.tar.gz
  7. Edit /mnt/etc/fstab with the correct root, swap... partitions
  8. Edit /mnt/etc/resolv.conf or copy over from LiveCD
  9. Edit /mnt/etc/sysconfig/ifconfig.eth0
  10. Edit /mnt/etc/udev/rules.d/70-persistent-net.rules and remove those eth0 lines
  11. Enter the new environment (chroot) with:
chroot
mount -v --bind /dev /mnt/dev
mount -vt devpts devpts /mnt/dev/pts
mount -vt tmpfs shm /mnt/dev/shm
mount -vt proc proc /mnt/proc
mount -vt sysfs sysfs /mnt/sys
chroot /mnt /usr/bin/env -i HOME=/root TERM="$TERM" /bin/bash --login
  1. Setup grub: See http://mreschke.com/files/lfs/manual/7.0/chapter08/grub.html
    1. STILL WITHIN CHROOT
    2. /usr/sbin/grub-install /dev/sda adjust to whatever partition you want, sda is MBR, sda2 is partition...etc (usually MBR unless you multiboot)
      1. If you get buffer IO errors on fd0 (your floppy), just delete the fd0 line from your /boot/grub/device.map (thats from in the chroot) then run with grub-install /dev/sda --no-floppy
    3. Make a simple /boot/grub/grub.cfg file like so:
/boot/grub/grub.cfg
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,2)
menuentry "GNU/Linux, Linux 3.1-lfs-7.0" {
        linux   /boot/vmlinuz-3.1-lfs-7.0 root=/dev/sda2 ro
}
EOF
  1. Exit chroot
  2. Unmount everything mounted in the chroot command above including /mnt itself
  3. Reboot and enjoy the mReschke lfs-current build of LFS 7.0!
  4. The root password of this LFS build is techie
  5. Thats it! You have a fresh LFS base, now there are a few optional things to configure
    1. PATH=$PATH:/usr/local/bin
    2. port update
    3. mkdir /root/build
    4. cp -rf /var/ports/port /root/port; cd /root/port; port install
    5. cp -rf /var/ports/lfs-profile /root/build; cd /root/lfs-profile; port install
    6. Logout and back in, should now have all your profile stuff (~/.bashrc, /etc/profile...)
    7. Install Sudo cp -rf /var/ports/sudo /root/build; cd /root/sudo; port install
      1. Edit the /etc/sudoers and uncomment what you want (I like the wheel no passwd one)
    8. Create user mreschke
      1. groupadd -f -g 1000 wheel
      2. groupadd -f -g 1001 users
      3. useradd -g wheel -G users -m -N -s /bin/bash mreschke
      4. passwd mreschke

Install Build Versions[-][--][++]

All build files are at /nwq/admin/www/data/mrcore_files/lfs/i686/build/ or http://mreschke.com/files/lfs/i686/build/
All versions here are LFS 7.0 i686

  1. lfs-1.0.tar.gz - Initial build, just after last page in the LFS 7.0 manual except does NOT contain grub and you must edit fstab because it points to sda13 (my qdesk partition)
  2. lfs-1.0.1.tar.gz - Initial build + wget (bc, openssl, nettle, gnutls, wget). Plus /etc/port.conf and /usr/local/bin/port. Ready to start porting!

Hard Drive LFS Build Backups[-][--][++]

These are NOT my main deployable build backups (those would be in the i686/build directory like lfs-1.0.1-tar.gz...)
These are backups of different stages during the actual building of the LFS system itself.
All backups are in /nwq/admin/www/data/mrcore_files/lfs/i686/backups/

  1. backups/01-TempSystem - This is the recommended backup of the Temporary System, this is not a working system. This was taken right at this page http://mreschke.com/files/lfs/manual/7.0/chapter05/changingowner.html
    1. If you wanted to start back at this point you would have to follow most of the mounting docs found before that spot in the manual! Remember - GCC 4.6.2
    2. Remember that to build this TempSystem and the Actual system with chroot I always use the export MAKEFLAGS='-j 4' to utilize my quad-core CPU.
  2. backups/02-BuildLFS - This is just after the actual Build of LFS, before any boot scripts or kernel. The source and tools directories are still in there. This is the best place to start fresh, perhaps build your own boot scripts... This is right at this point http://mreschke.com/files/lfs/manual/7.0/chapter07/introduction.html. Remember GCC 4.6.2 and everything is from the chroot, so mount it up properly.

Exclamation3
I removed the LFS /usr/share/doc/* and /tools and /source directories after the final page in the LFS 7.0 manual since they are not needed for an actual deployment. Those files are in NOT on /nwq but in archdev /home/mreschke/Projects/lfs/lfs-final-source-tools-backup

Code Continued LFS Development[-][--][++]

I have decided to leave the base LFS (my sda13) pretty much bare. Basically just after the last page in the LFS 7.0 manual I only basically only do the following to my sda13 base
# install bc
# install openssl
# install nettle
# install gnutls
# install wget

In other words, I want my LFS system to be as bare as possible, then add what you want to each individual install instance with the ports manager! So my LFS system is simply raw LFS 7.0 + wget

Any changes you make to this base system should then be wrapped up into a build tar.gz (see How to Package LFS for Installation above)

Host system info

  1. qdesk name of the working platform: i686-pc-linux-gnu
  2. qdesk name of the platform's dynamic linker: ld-linux.so.2
  3. binutils build time (make: 27 sec, make install: 1 sec), so one SBU = 28 sec)

Enter Chroot[-][--][++]

as root from archdev

chroot
mount /dev/sda13 /mnt/lfs
mount -v --bind /dev /mnt/lfs/dev
mount -vt devpts devpts /mnt/lfs/dev/pts
mount -vt tmpfs shm /mnt/lfs/dev/shm
mount -vt proc proc /mnt/lfs/proc
mount -vt sysfs sysfs /mnt/lfs/sys
chroot /mnt /usr/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin /bin/bash --login


ignore this stuff below, since I now use the base LFS, then use ports from there


Choices[-][--][++]

  1. I am going to utilize the fakeroot installation approach http://www.linuxfromscratch.org/hints/downloads/files/fakeroot.txt
  2. I created /etc/profile.d and reference its .sh files in /etc/profile
  3. I use ~/.bash_profile to simply reference ~/.bashrc
  4. I will install nwq profiles (public)

Basic Setup[-][--][++]

This is continued configuration of my LFS system, just after the last page of the LFS manual, either from within chroot or from actual booted LFS

  1. groupadd -f -g 1000 wheel
  2. groupadd -f -g 1001 users
  3. useradd -g wheel -G users -m -N -s /bin/bash lfs

Additional Software Installed[-][--][++]

Follow this order, for dependencies
Simply google packagename LFS to find it, its usually in the BLF book. I also attempt the latest versions of the software instead of what BLFS has.
REMEMBER: I download all software to /home/lfs/build and configure as the lfs user, then install using fakeroot as the ROOT user

Remember I install all packages to /usr/local

Remember with fakeroot its not always make DESTDIR=$FAKEROOT install sometimes DESTDIR is INSTALL_PREFIX or INSTALL_ROOT... read the INSTALL file for each package to find out.

Since I install all additional software to /usr/local all their libraries are also installed to /usr/local/lib and sometimes the program is looking for /usr/lib instead, one example is wget and libgnutls.so.28. One solution is to find all libraries with ldd /usr/local/bin/wget and make sure none say "not found", if one is not found then create a ln -s ../local/lib/libgnutls.so.28 /usr/lib. There is also an environment variable that allows you to change the search paths for libraries, though Its not recommended, see http://www.wiredrevolution.com/system-administration/how-to-correctly-use-ld_library_path

  1. install bc
  2. Install OpenSSL
    1. ./config --openssldir=/etc/ssl --prefix=/usr/local shared
    2. make MANDIR=/usr/share/man
    3. FAKEROOT=/usr/fakeroot/openssl-1.0.0g
    4. make INSTALL_PREFIX=$FAKEROOT install
  3. install nettle (required for gnutls)
  4. install gnutls (required for wget ssl this is not GNUtils)
  5. install wget
  6. install pciutils
  7. install usbutils

BLFS[-][--][++]

Downloaded blfs directory on 2012-01-19 for my LFS 7.0 build. Find it at /nwq/admin/www/data/mrcore_files/lfs/manual/blfs or http://mreschke.com/files/lfs/manual/blfs

I choose to install all additional software beyond the regular LFS base into /usr/local NOT /usr!
This means use ./configure --prefix=/usr/local etc...

Recommends configuring all packages as a normal user, then installing with root

Additional Sources to Investigate[-][--][++]

Kernel Notes[-][--][++]

When customizing the kernel, any item marked as M means it will not be compiled directly into the kernel but placed on your filesystem (your regular root fs, not an initrd) as a module in /lib/modules. LFS recommends that most items NOT be marked as module, but compiled directly (denoted by a *). Also note the LFS does NOT use any sort of initrd, so any modules required to boot must be compiled (like sata, pata, ext3/4...). I have less than 1mb of /lib/modules while ubuntu has 117mb Smile Though the more modules or build-in items you have the more hardware your kernel can boot.

I moved the kernel from /source/linux-3.1 to /usr/src/linux-3.1 so I can re-compile later

Get the boot penguin logo: http://www.articleworld.org/index.php/How_to_change_the_Linux_penguin_boot_logo

  1. Currently I do have the penguin logo, but I use vga=791 on the grub kernel string, which is deprecated, haven't figured out how to apply this for grub2 yet, gfx something or other.

Re-Compiling the Kernel[-][--][++]

http://mreschke.com/files/lfs/manual/7.0/chapter08/kernel.html

From chroot on archdev
Customize the kernel config with cd /usr/src/linux-3.1; make menuconfig
Then to deploy the new kernel use

compile and install the kernel
make
make modules_install
cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.1-lfs-7.0
cp -v System.map /boot/System.map-3.1
cp -v .config /boot/config-3.1