Friday, August 6, 2010

LFS after vacation

Well, here I am and I have forgotten everything. This will be a good test of how well I have written this blog.

Friday, June 25, 2010

No Progress Day 4

Reading some more about kernels today. The only saving feature about this excersize is that I have a toy OS to work with, while maintaining a running OS for normal daily usage.

Try this. Run config again and unmark everything experimental. On those items which have recommendations, I follow the advice.

make
make modules install

A quote from LFS mailing list:

Not building a required driver into the kernel is almost certainly the 
problem here.  lsmod on an earlier system and lspci are exactly the 
right tools to figure out the needed drivers.  After that rebuilding the 
kernel and retrying are the boot will be needed.

   -- Bruce 

I found another website,
Techfreaks , Driver test page, and what seemed to be a step by step guide through configuring the kernel, Pappy's Kernel Seeds. Nothing I tried was working.

Thursday, June 24, 2010

No Progress

Day 3 of a stalled LFS installation. I am going to try using the legacy grub, as some people have suggested.


Once more, try make mrproper
 make LANG=nl_NL LC_ALL= menuconfig
(SCSI device support change all M's to stars. )
make (started 13:18)

This will take a long time.

While I was waiting, I found a website called kernelnewbies.org They mentioned something called cpuinfo, which I installed on my Mandriva platform. One of the things a kernel is supposed to do is talk with the hardware, and I figure I should know a little bit about what is inside my computer.

Re-making did not work. I tried running with my Mandriva legacy GRUB. Still kernel panic, although different unkown-block (0,0) instead of (2,0)

Tuesday, June 22, 2010

Chapter 9 Device Busy

While trying to unmount the lfs partition, using: umount -v $LFS, I get device busy warnings.
Here is an example of how I debugged this, thanks to Holy Scmoly
Note that I have already logged out of the chroot environment.

[root~]# fuser -m /dev/sdb6
/dev/sdb6:            3184c

[root~]# ps auxw | grep  3184
root      3184  0.0  0.1   4024  1820 pts/0    S+   08:25   0:00 bash
root     32081  0.0  0.0   3224   744 pts/1    S+   10:36   0:00 grep --color 3184
[root@samwise ~]# kill -9 3184

Clearly, that bash is from the exec command I used and am not sure was necessary. Re-run the fuser command and it should be ok.
[root@ ~]# umount -v $LFS
/dev/sdb6 umounted

Chapter 8 revisited

Looking at my notes, I seemed to have skipped this step and ran "make oldconfig" instead. This is due to my lack of familiarity with configuration using menuconfig. I am mostly familiar with the ./configure,make and make install that I had been doing through Chapters 5 and 6.

root#make LANG=nl_NL LC_ALL= menuconfig

Well, a menu appears!
This is nice.

#
# using defaults found in arch/x86/configs/i386_defconfig
#
#
# configuration written to .config
#


*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.
Tail end of output of make
Root device is (8, 22)
Setup is 11756 bytes (padded to 11776 bytes).
System is 4048 kB
CRC 5ffe0f2f
Kernel: arch/x86/boot/bzImage is ready  (#1)
  Building modules, stage 2.
  MODPOST 2 modules
  CC      arch/x86/kernel/test_nx.mod.o
  LD [M]  arch/x86/kernel/test_nx.ko
  CC      drivers/scsi/scsi_wait_scan.mod.o
  LD [M]  drivers/scsi/scsi_wait_scan.ko


root:/sources/linux-2.6.32.8# make modules_install
INSTALL arch/x86/kernel/test_nx.ko
INSTALL drivers/scsi/scsi_wait_scan.ko
DEPMOD 2.6.32.8


Did all the other stuff in this section as well, with no errors. Reboot but first unmount everything.

Monday, June 21, 2010

Frustrated

I have reached the end of the LFS document and have a kernel panic. I am searching for the solution. It seems like I have not learned anything. I was stuck in the devices chapter and moved on, but what if this is the cause of the error? I still do not understand the kernel! I do not remember configuring it. I only see the API headers. But no .configure, make and make install stuff. It's frustrating because this is the main reason I started this in the first place.

I'm going to quit for today. Tomorrow, read the FAQ, "How do I compile a kernel or set up modules". Not sure why this is in the FAQ, it should be in the main documentation.

Chapter 9 shutdown

Well, I thought I was done and re-booted before reading section 9.3. I had noticed all the "device busy " errors (see next blog entry) when re-starting. Also, it LFS did not boot at all.



logout
 

umount -v $LFS/dev/pts
umount -v $LFS/dev/shm
umount -v $LFS/dev
umount -v $LFS/proc
umount -v $LFS/sys
 
umount -v $LFS
 
shutdown -r now
 
ok, here we go!

Chapter 8.4 Grub

Ok, I have some experience with Grub. floppies....I'll have to look for them.
(google for the right command, here )
root:/sources# fdformat /dev/fd0

I also had to install some dos utilities and do the stuff on my OS and not LFS.
[home]#mkfs -t msdos /dev/fd0

On LFS,

root:/media#  mount -t msdos /dev/fd0 /media/floppy

root:/# grub-mkdevicemap --device-map=device.map
root:/# cat device.map
(fd0)    /dev/fd0
(hd0)    /dev/sda
(hd1)    /dev/sdb



Here is where I might run into trouble. I have made a floppy but I cannot verify what is on it. I do not know why.


#fdformat /dev/fd0
#mkfs -t msdos /dev/fd0
#mount -t msdos /dev/fd0 /media/floppy
#cd /media/lfs/tmp
#dd if=floppy.img of=/dev/fd0 bs=1440 count=1

 If I check using df, there is something there. Good.

 /dev/fd0              1,4M  210K  1,2M  15% /media/floppy


I tried rebooting with this and, although grub loaded, there was no prompt. Moving ahead anyway. So far, on my platform (the computer), I have (from the menu.lst) I believe that grub is installed on the MBR because I do not have Windows on this computer anymore. The boot device is sda (from Mandriva control center)

#title KDE Mandriva Linux (Official)
#root (hd0,0)

#title Gnome Mandriva Linux (Official)
#root (hd1,0)

A weekend has come between Friday and today, Monday. I got side tracked by the floppies.SO, after all the mounting and chroot (see Ch 7)

root:/# grub-install --grub-setup=/bin/true /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(fd0)    /dev/fd0
(hd0)    /dev/sda
(hd1)    /dev/sdb
root:/# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinux-2.6.32.8-lfs-6.6
done


I heard some disk access to the floppy drive. 140 .mod files were written to the /boot/grub directory. Just had a look at /boot. It has only 4 entries.


root:/boot# ls -lg
total 5864
-rw-r--r-- 1 root 1740472 Jun 17 16:56 System.map-2.6.32.8
-rw-r--r-- 1 root   67864 Jun 17 16:58 config-2.6.32.8
drwxr-xr-x 2 root    4096 Jun 21 11:40 grub
-rw-r--r-- 1 root 4176864 Jun 17 16:55 vmlinux-2.6.32.8-lfs-6.6

root:/etc/grub.d# ls -l
total 24
-rwxr-xr-x 1 root root 3223 Jun 14 21:20 00_header
-rwxr-xr-x 1 root root 3126 Jun 14 21:20 10_linux
-rwxr-xr-x 1 root root 4409 Jun 14 21:20 30_os-prober
-rwxr-xr-x 1 root root  214 Jun 14 21:20 40_custom
-rw-r--r-- 1 root root  483 Jun 14 21:20 README

I had to run these two commands when I tried, man grub-mkconfig
root:/boot/grub# export LANG=nl_NL
root:/boot/grub# export LC_ALL=POSIX
This fixed the error message, although there was no man page for this. I really want to know what it does because, in the documentation, it is written that an Ubuntu linux was also found on a different partition (UID number is different)

vol_id --uuid /dev/sdb1 is the partition on which I am running Mandriva Gnome.  Its uuid does not appear in this list. I wonder if I should put it there?

I found some grib information here. They mention:
Note the term 'installation' can mean two things. Installation of the grub software onto a host (to allow preparation and configuration of the bootloader), and installation of a bootloader onto a target ( placing the loader at the start of a disk/partition to make GRUB really work when the machine boots). To help differentiate these, the term 'write' will be used when possible to describe the second kind of installation.

root:/etc/grub.d# grub-install -v
grub-install (GNU GRUB 1.97.2)

root:~# blkid  shows all uuid paritions on computer

Although it is not mentioned in the documentation, I feel that I need to put in here somewhere my Mandriva KDE and GNOME partitions. Using this link as reference, I put the relevent lines into /etc/grub.d/40_custom. So for 2nd hard disk and first partition (Grub2 is different fromlegacy grub)


menuentry "Mandriva-Gnome" {
insmod ext3
set root=(hd1,1)
linux (hd1,1)/boot/vmlinuz
initrd (hd1,1)/boot/initrd.img
}
For a simple test, I changed the name of the cfg.
root:/boot/grub# grub-mkconfig -o /boot/grub/test_grub.cfg

Looks good.

Section 8.4.3., I have no idea what they are talking about.  Well, feeling brave and with some familarity with legacy grub, I tried what they suggested.

  1. /sbin/reboot Turns off the computer and starts again.
  2. When graphical menu appears, press ESC key (on my computer) to exit graphics mode. A window appears for me to confirm, press yes.
  3. I see a grub console.
  4. Type root (hd1,5) , noting that grub2 will use 6.
  5. Type kernel /boot/grub/core.img
  6. Type boot
I get to a boot menu with  linux, Mandriva Gnome and Mandriva KDE. Hooray.
But, it seems I made a typo. Instead of initrd, I had written initrf. So, I fixed this and ran  

root:/# grub-mkconfig -o /boot/grub/grub.cfg

 root:/# grub-setup /dev/sda
 root:/# logout
root:/#/sbin/reboot

That's it! Too late to turn back. The logout of chroot, I have yet to figure out. But when I reboot without doing so, there are errors that $LFS is busy.


    Thursday, June 17, 2010

    Chapter 8 The Kernel!

    I hope this goes better than Chapter 7. I wonder how much of the network stuff could have been left out until the system setup was ok.


    cat > /etc/fstab << "EOF"
    # Begin /etc/fstab
    
    # file system  mount-point  type   options         dump  fsck
    #                                                        order
    
    /dev/sdb6     /            ext3  defaults        1     1
    /dev/sdb5     swap         swap   pri=1           0     0
    proc           /proc        proc   defaults        0     0
    sysfs          /sys         sysfs  defaults        0     0
    devpts         /dev/pts     devpts gid=4,mode=620  0     0
    tmpfs          /dev/shm     tmpfs  defaults        0     0
    # End /etc/fstab
    EOF
     
    This is interesting.
    Filesystems with MS-DOS or Windows origin (i.e.: vfat, ntfs, smbfs, cifs, iso9660, udf) need the “iocharset” mount option in order for non-ASCII characters in file names to be interpreted properly.
    I guess that this will help the spaces prolem in Windows.

    root:/sources/linux-2.6.32.8# echo $LANG
    nl_NL.ISO-8859-1@euro

    Therefore,
      make LANG=nl_NL.ISO-8859-1@euro LC_ALL=menuconfig

    And I get...

    *** You have not yet configured your kernel!
    *** (missing kernel config file ".config")
    ***
    *** Please run some configurator (e.g. "make oldconfig" or
    *** "make menuconfig" or "make xconfig").
    That's encouraging. But I notice that I have not run any configure.

    #make oldconfig

    Press enter for everything, choose Athlon/Duron (#12 in list ) as processor
    WIFI I said no to, touchscreen, no.  I have no idea really what all the commands were. That's annoying.

    #make

     Output at end




    Root device is (8, 22)
    Setup is 11756 bytes (padded to 11776 bytes).
    System is 4068 kB
    CRC 94875ed3
    Kernel: arch/x86/boot/bzImage is ready  (#1)
      Building modules, stage 2.
      MODPOST 2 modules
      CC      arch/x86/kernel/test_nx.mod.o
      LD [M]  arch/x86/kernel/test_nx.ko
      CC      drivers/scsi/scsi_wait_scan.mod.o
      LD [M]  drivers/scsi/scsi_wait_scan.ko
    I do not know if this is necessary, so feeling reckless,
    root:/sources/linux-2.6.32.8# make modules_install
      INSTALL arch/x86/kernel/test_nx.ko
      INSTALL drivers/scsi/scsi_wait_scan.ko
      DEPMOD  2.6.32.8
    Next,
    root:/sources/linux-2.6.32.8# cp -v arch/x86/boot/bzImage /boot/vmlinux-2.6.32.8-lfs-6.6

    root:/sources/linux-2.6.32.8# cp -v System.map /boot/System.map-2.6.32.8
    root:/sources/linux-2.6.32.8# cp -v .config /boot/config-2.6.32.8
    (saved a copy of this on home partition)
    root:/sources/linux-2.6.32.8# install -d /usr/share/doc/linux-2.6.32.8
    root:/sources/linux-2.6.32.8# cp -r Documentation/* /usr/share/doc/linux-2.6.32.8

    root:/sources# chown -R 0:0 linux-2.6.32.8
    Also configured the module boot order, although at this point I really have no clue.

    Chapter 7.13 Network Script

    I do not know if any of this is right, but this is what I entered. Specifically, I do NOT want it to be turned on at boot, because it might be wrong.

    root:/etc/sysconfig/network-devices# cat > ifconfig.eth0/ipv4 << "EOF"
    > ONBOOT=no
    > SERVICE=ipv4-static
    > IP=192.168.1.1
    > GATEWAY=192.168.1.2
    > PREFIX=24
    > BROADCAST=192.168.1.255
    > EOF



    root:/etc/sysconfig/network-devices# cat > /etc/resolv.conf << "EOF"
    > # Begin /etc/resolv.conf
    > nameserver 10.0.0.138
    > # End /etc/resolv.conf
    > EOF

    7.11-12-13 Configuring the localnet Script

    Ok, this looks like another thing I want to learn. The meaning of network.So, what is the name of my computer. Does it have to be the same as my current OS? Use hostname to find it.
     root:/etc/sysconfig# hostname
     nameofmycomputer

    echo "HOSTNAME=nameofmycomputer; /etc/sysconfig/network

    root:/etc/sysconfig# more network
    HOSTNAME=nameofmycomputer


    Now, try this
    root:/etc/sysconfig# IP_address rose.lfs.org rose_lfs
    outputs bash: IP_address: command not found

    Ok, just do the  cat command in the documentation. I chose the 192.168.1.1 because I want to work with apache eventually and this will help me understand that.  192.168.1.1 rose.lfs.org rose_lfs

    root:/etc# more hosts
    # Begin /etc/hosts (network card version)

    127.0.0.1 localhost
    192.168.1.1 rose.lfs.org rose_lfs
    # End /etc/hosts (network card version)
     I have only one network card.
    root:/sys/class/net# ls -l
    total 0
    drwxr-xr-x 4 root root 0 Jun 17 12:47 eth0
    drwxr-xr-x 4 root root 0 Jun 17 12:47 lo
    Running the for NIC loop does not give me the  70-persistent-net.rules file.

    Try, LW
    $INTERFACE=eth0 udevadm test --action=add eth0
    unable to open device '/syseth0'
    oops, try this. (from the lfs mailing list)
    $INTERFACE=/sys/class/net/eth0 udevadm test --action=add /sys/class/net/eth0
    

    The mailing list I was reading did not come up with a solution, alas. I am going to skip it. This is the output of the for command:

     udev_rules_new: rules use 11472 bytes tokens (956 * 12 bytes), 7523 bytes buffer
    udev_rules_new: temporary index used 7620 bytes (381 * 20 bytes)
    udev_device_new_from_syspath: device 0x8c25100 has devpath '/class/net/eth0'
    udev_device_new_from_syspath: device 0x8c34c50 has devpath '/class/net'

     udevadm_test: UDEV_LOG=6
    udevadm_test: DEVPATH=/class/net/eth0
    udevadm_test: PHYSDEVPATH=/devices/pci0000:00/0000:00:0e.0
    udevadm_test: PHYSDEVBUS=pci
    udevadm_test: PHYSDEVDRIVER=8139too
    udevadm_test: INTERFACE=/sys/class/net/eth0
    udevadm_test: IFINDEX=2
    udevadm_test: ACTION=add
    udevadm_test: SUBSYSTEM=net
    udevadm_test: MATCHADDR=00:30:1b:1e:b8:88
    udevadm_test: MATCHIFTYPE=1
    udevadm_test: MATCHDEVID=0x0
    udevadm_test: COMMENT=net device ()

    On my regular OS, there is a file: /etc/udev/rules.d/70-persistent-cd.rules
    # more /etc/udev/rules.d/70-persistent-net.rules
    # This file was automatically generated by the /lib/udev/write_net_rules
    # program run by the persistent-net-generator.rules rules file.
    #
    # You can modify it, as long as you keep each rule on a single line.

    # PCI device 0x10ec:0x8139 (8139too)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:30:1b:1e:b8:88", ATTR{type}=="1", KERNEL=="eth*", N
    AME="eth0"

    Linux 7.10 Getting lost, Come back here id device trouble.

    The command udevadm test /sys/block/sdb,
    gave a lot of output.Some of which is the product information. That's good.

    "Note that it is not necessary to create the rules files or symlinks at this time, because you have bind-mounted the host's /dev directory into the LFS system, and we assume the symlinks exist on the host. The rules and symlinks will be created the first time you boot your LFS system."

    This is comforting. I thought they had forgotten about me. This is the first reference back to the LFS since the dev chapter. I am not sure that it is a good idea to do all this explaining before he system is set up, since I do not know what they are talking about anyway.

    At the moment, my computer has 1 internal cd player, a USB hub to which my printer, an external hard drive, and camera are connected (sporadically).

    Wednesday, June 16, 2010

    Chapter 7.9. Device and Module Handling on an LFS System

     root:/# modinfo
    Usage: modinfo [-0][-F field][-k kernelversion][-b basedir]  module...
     Prints out the information about one or more module(s).
     If a fieldname is given, just print out that field (or nothing if not found).
     Otherwise, print all information out in a readable form
     If -0 is given, separate with nul, not newline.
     If -b is given, use an image of the module tree.


    root:/# ls -l sys/bus
    total 0
    drwxr-xr-x 4 root root 0 Jun 17 10:05 ac97
    drwxr-xr-x 4 root root 0 Jun 17 10:05 acpi
    drwxr-xr-x 4 root root 0 Jun 17 10:05 gameport
    drwxr-xr-x 4 root root 0 Jun 17 10:05 i2c
    drwxr-xr-x 4 root root 0 Jun 17 10:05 isa
    drwxr-xr-x 5 root root 0 Jun 17 10:05 pci
    drwxr-xr-x 4 root root 0 Jun 17 10:05 pci_express
    drwxr-xr-x 4 root root 0 Jun 17 10:05 platform
    drwxr-xr-x 4 root root 0 Jun 17 10:05 pnp
    drwxr-xr-x 4 root root 0 Jun 17 10:05 scsi
    drwxr-xr-x 4 root root 0 Jun 17 10:05 serio
    drwxr-xr-x 4 root root 0 Jun 17 10:05 spi
    drwxr-xr-x 4 root root 0 Jun 17 10:05 usb
    drwxr-xr-x 4 root root 0 Jun 17 10:05 virtio
    Each of thos directories has the same set of files i.e. Ac97
    drwxr-xr-x 2 root root    0 Jun 17 10:07 devices
    drwxr-xr-x 2 root root    0 Jun 17 10:07 drivers
    -rw-r--r-- 1 root root 4096 Jun 17 10:07 drivers_autoprobe
    --w------- 1 root root 4096 Jun 17 10:07 drivers_probe
    --w------- 1 root root 4096 Jun 17 10:07 uevent
    Under these directories, there are more. I have cat'd the entire list to a file. (ls -l sys/bus/*/*/* > sys_bus_before.list)

     Maybe some day it will make sense. What I do not understand is how they got there. I only looked after I had typed modprobe which is the same time as the time stamp on the files. I am going to try and log out of chroot environment and log in again to see if they are still there. So they are permanent. It must have been something I did today because I just started this morning.

    I do not understand what I have to do in this chapter.

    I'll try the reading recomendations.

    Userspace Implementation:  This is a useful defintion. "A device file is how a user program can access a specific hardware device or function." I never thought of the "hda" in /dev/hda as a file, but apparently it is and it "represents the first IDE drive of the system". Although I am used to seeing it with a number as well. The way Linux (or unix) is sold is via this "everything is a file concept.  I made a listing of the /dev directory and saved a copy. One of the lines for LFS is this one, /dev/sdb6

    brw-rw---- 1 root daemon   8,  22 Jun 17 10:24 sdb6

    I notice the b at the beginning and the word daemon as the group. This determines the properties of the file? Name has to match type of device, and are listed in  Device List

    Wow, I remember having this problem years ago (probably with kernel 2.4) "If the user rearranges the USB topology, perhaps adding a USB hub in order to support more USB devices in the system, the USB probing order of the printers might change the next time the computer is booted, reversing the assignment of the different minor number to the two printers"

    There is too much to understand in this article, so I am going to move on. If something does not work, I'll have to come back.

    Chapter 7.8 Bash Shell Startup

    On first reading, this is a bit confusing, login and interactive environments
     "An interactive login shell is started after a successful login, using /bin/login, by reading the /etc/passwd file"

    My question involves visualization. How do I know that a login shell has started? Is it that I am allowed entry to the command line? Or, is the command line part of the "shell".  I think it is useful to think of it as opening a door to a house and entering, then one can do some stuff (like run some comand line commands) and then leave.

    I have always associated a shell with an xterm but they are not one and the same. One can run multiple shells in one xterm, for example. Although I do not like to do this (hence my tangent in Chapter 6 regarding the color of the lfs window).

    " A non-interactive shell is usually present when a shell script is running. It is non-interactive because it is processing a script and not waiting for user input between commands." So, maybe the non-interactive shell is like the shell of a car (or a sea shell? can that be its origin?). The act of driving will be the script.

    Back to the text, we are creating the profile file here. This is read just after log in and sets all sorts of variables (environment)

    root:/etc# LC_ALL=en_US.iso88591 locale charmap
    ISO-8859-1
    root:/etc# LC_ALL=nl_NL.iso88591 locale charmap
    ISO-8859-1

    This is what I chose.

    root:/etc# more profile
    # Begin /etc/profile
    export LANG=nl_NL.ISO-8859-1@euro
    # End /etc/profile

    Since I have some experience with the profile file, I might add some more comments at a later time.


      Chapter 7.7. Creating the /etc/inputrc File

      "Most people do not need user-specific keyboard mappings so the command below creates a global /etc/inputrc used by everyone who logs in. If you later decide you need to override the defaults on a per-user basis, you can create a .inputrc file in the user's home directory with the modified mappings."

      This is not true in my house. I prefer the American keyboard but my kids have learned the Dutch keyboard so it would be handy to have user dependent settings.

      Chapter 7.6 Sysklog

      Notice the difference between sysklogd and syslogd !

      Reading the "man syslogd". This caught my eye. "Syslogd  reacts  to  a set of signals.  You may easily send a signal to syslogd using the following:

                    kill -SIGNAL `cat /var/run/syslogd.pid`

      My biggest problem with syslogs is that they are very difficult for me to read. Recent apps are beginning to at least provide some sort of sorting according to the day. I would like keywords like: sound or video to be available because these are errors I have had in the past.

      Ah, after some searching, this command is here: /sbin/syslogd
      root:/#file  /sbin/syslogd
      /sbin/syslogd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

      I cannot look at it.
      root:/#  ls -l /sbin/syslogd
      -r-x------ 1 root root 31508 Jun 15 12:57 /sbin/syslogd



      Wait, I am confused. They are talking about sysklogd, with a "k". Which is:
      root:/# find / -name sysklogd
      /etc/rc.d/init.d/sysklogd
      /sources/lfs-bootscripts-20100124/contrib/lsb-v3/init.d/sysklogd
      /sources/lfs-bootscripts-20100124/lfs/init.d/sysklogd




      Here's a directory listing of init.d:

      root:/etc/rc.d/init.d# ls -lrt
      total 100
      -rwxr-xr-- 1 root root   982 Jun 16 11:36 udev_retry
      -rwxr-xr-- 1 root root  2229 Jun 16 11:36 udev
      -rwxr-xr-- 1 root root   654 Jun 16 11:36 template
      -rwxr-xr-- 1 root root   978 Jun 16 11:36 sysklogd
      -rwxr-xr-- 1 root root   767 Jun 16 11:36 sysctl
      -rwxr-xr-- 1 root root   825 Jun 16 11:36 swap
      -rwxr-xr-- 1 root root   834 Jun 16 11:36 setclock
      -rwxr-xr-- 1 root root   866 Jun 16 11:36 sendsignals
      -rwxr-xr-- 1 root root   531 Jun 16 11:36 reboot
      -rwxr-xr-- 1 root root  2261 Jun 16 11:36 rc
      -rwxr-xr-- 1 root root  1356 Jun 16 11:36 network
      -rwxr-xr-- 1 root root   841 Jun 16 11:36 mountkernfs
      -rwxr-xr-- 1 root root  1242 Jun 16 11:36 mountfs
      -rwxr-xr-- 1 root root  1637 Jun 16 11:36 modules
      -rwxr-xr-- 1 root root   978 Jun 16 11:36 localnet
      -rwxr-xr-- 1 root root   483 Jun 16 11:36 halt
      -rw-r--r-- 1 root root 16747 Jun 16 11:36 functions
      -rwxr-xr-- 1 root root  1286 Jun 16 11:36 consolelog
      -rwxr-xr-- 1 root root  2531 Jun 16 11:36 console
      -rwxr-xr-- 1 root root  2293 Jun 16 11:36 cleanfs
      -rwxr-xr-- 1 root root  3758 Jun 16 11:36 checkfs

      I still do not know what to do with this. Read on.

      Chapter 7 Commands to run before beginning.

      I hope the laborious part is over. It just occurred to me that I should make another backup.
       As root,
      export LFS=/media/lfs  
      mount -v -t ext3 /dev/sdb6 $LFS (see note below)

      The order of mount and chroot may or may not be important. I still do not understand what happens to LFS after chroot.

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

      Note, if you get the error,
      chroot: cannot run command `/usr/bin/env': No such file or directory
      It just means that you forgot to mount the partition. 
       
      Relevent output of the command mount, executed before the chroot
      /dev/sdb6 on /media/lfs type ext3 (rw) 
      /dev on /media/lfs/dev type none (rw,bind)
      devpts on /media/lfs/dev/pts type devpts (rw)
      shm on /media/lfs/dev/shm type tmpfs (rw)
      proc on /media/lfs/proc type proc (rw)
      sysfs on /media/lfs/sys type sysfs (rw)

      where $LFS is /media/lfs

      After chroot,  the output of the command mount is:
      root:/# mount
      sysfs on /sys type sysfs (rw)
      proc on /proc type proc (rw)
      /dev on /dev type none (rw,bind)
      I am assuming that there is a reason for which the devpts and shm are not in the list. Maybe they are a subdirectory. Chapter 6.2.2 in the manual describes this and I do not really understand it so I will move on.




      
      

      Chapter 7.5 Console

      I am curious about console because I use it a lot. Recently, however, on another linux session, I messed up the fonts and could not find the ones I liked. Also, knowing how to make this permanent is important to me.

      "This section discusses how to configure the console and consolelog bootscripts that set up the keyboard map, console font and console kernel log level." Since I am in Europe, the euro  symbol is important (€,had to look that up, thank you Wikipedia!). So I will do this section, even though I normally use an American keyboard.

      Looking at the examples, I chose the German one and replaced de with nl for Netherlands.
       root:/etc/sysconfig# cat > /etc/sysconfig/console << "EOF"
      > # Begin /etc/sysconfig/console
      >
      > KEYMAP="nl-latin1"
      > KEYMAP_CORRECTIONS="euro2"
      > FONT="lat0-16 -m 8859-15"
      > # End /etc/sysconfig/console
      > EOF

      There is a note about this not being relevent in the X window system, but in console mode only (not even xterm mode I guess).

      Chapter 7.4 Setclock

      Just reading the text here, about setclock script.



      #  hwclock --localtime --show
      Wed Jun 16 11:55:40 2010  -0.313826 seconds

      This is the time I see on my computer.  I guess that starting from scratch means that all these details that usually take for granted, need to be set.

      Chapter 7.2 LFS-Bootscripts-20100124

      Here we go.

      Just out of curiosity, what is in the /etc/sysconfig directory? Since kernel modules is the topic I am most interested in understanding. Modules is empty except for a "Begin /etc/sysconfig/modules" commented message.

      root:~# ls -lrt /etc/sysconfig/
      total 16
      -rw-r--r-- 1 root root  408 Jun 16 11:36 rc
      drwxr-xr-x 3 root root 4096 Jun 16 11:36 network-devices
      -rw-r--r-- 1 root root  559 Jun 16 11:36 modules
      -rw-r--r-- 1 root root 1037 Jun 16 11:36 createfiles

      I have read about runlevels before, and used them usually when I have messed up the linux and had to do some repairs (such as I was able).
       root:/etc/rc.d# ls -lrt
      total 36
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc6.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc5.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc4.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc3.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc2.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc1.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rc0.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 init.d
      drwxr-xr-x 2 root root 4096 Jun 16 11:36 rcsysinit.d

      Tuesday, June 15, 2010

      Chapter 6.60 Almost done!

      Whoa, I am near the end of Chapter 6. Feeling a bit bored and bleary eyed.
      Since this is supposed to be a learning partition, I am not going to strip the debugging flags. I have plenty of space.

      I have been doing this after each reboot. Except now tools is excluded.


      Previous command: 
      chroot "$LFS" /tools/bin/env -i \
          HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
          PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
          /tools/bin/bash --login +h

      With tools removed:

      chroot "$LFS" /usr/bin/env -i \
          HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
          PATH=/bin:/usr/bin:/sbin:/usr/sbin \
          /bin/bash --login
       
      "Ensure that the virtual kernel filesystems are mounted when reentering the chroot. This process was explained in Section 6.2.2,“Mounting and Populating /dev” and Section 6.2.3,“Mounting Virtual Kernel File Systems”."

      mount -v --bind /dev $LFS/dev
      mount -vt devpts devpts $LFS/dev/pts
      mount -vt tmpfs shm $LFS/dev/shm
      mount -vt proc proc $LFS/proc
      mount -vt sysfs sysfs $LFS/sys


      I logged out and in again. I will not delete tools. This is my root directory, if I understand that term.

      root:/# ls -lrt
      total 84
      drwxr-xr-x  12 root root  4096 Jun  3 15:15 tools
      drwxr-xr-x   2 root root  4096 Jun  7 19:19 opt
      drwxr-xr-x   2 root root  4096 Jun  7 19:19 mnt
      drwxr-xr-x   2 root root  4096 Jun  7 19:19 home
      drwxr-xr-x   2 root root  4096 Jun  7 19:19 boot
      drwxr-xr-x   2 root root  4096 Jun  7 19:21 srv
      drwxr-xr-x   4 root root  4096 Jun  7 19:21 media
      drwxr-xr-x   9 root root  4096 Jun  7 19:28 usr
      drwxr-xr-x  12 root root  4096 Jun  7 19:30 var
      drwxr-xr-x   2 root root  4096 Jun  9 13:15 rose_notes
      drwxr-xr-x  15 root root  4820 Jun 15 08:17 dev
      dr-xr-xr-x 124 root root     0 Jun 15 10:13 proc
      drwxr-xr-x  12 root root     0 Jun 15 10:13 sys
      drwxr-xr-x   2 root root  4096 Jun 15 13:33 bin
      drwxr-xr-x   2 root root  4096 Jun 15 13:50 sbin
      drwxr-xr-x   6 root root  4096 Jun 15 13:50 lib
      drwxrwxrwt   4 root root  4096 Jun 15 13:53 sources
      drwxrwxrwt   2 root root 20480 Jun 15 14:15 tmp
      drwxr-xr-x   7 root root  4096 Jun 15 14:15 etc
      drwxr-x---   2 root root  4096 Jun 15 14:18 root

      Next stop Chapter 7.

      Chapter 6.44-59

      • gzip
      • iproute I have no idea what this is. I just need to remember to run the tests ... after doing what?





        If you wish to run these tests after booting into your new LFS system, ensure you select /proc/config.gztestsuite/ subdirectory. CONFIG_IKCONFIG_PROC ("General setup" -> "Enable access to .config through /proc/config.gz") support into your kernel then run 'make alltests' from the testsuite/ subdirectory.
      • kbd
      • less
      • make
      • man-db
      • module-init No make command?, oh, that was for the testsuite which is one of these statements that assume that I know what they  mean.
      • patch
      • psmisc
      • shadow, do NOT install the Cracklib stuff. Set passwd
      • sysklogd. Looks like I should start paying better attention.
      • sysvinit
      • tar
      • texinfo
      • udev. I have been using tar jxf to unpack bz files. Now, I see that



        tar -xvf
        also works.
      •  udev. But what if I do not have a RAID device, or nor a mobile device, nor isdn?
      • vim creates a directory vim72 and not vim-7.2. Sigh. Unpacked language files as: tar zxf vim-7.2-lang.tar.gz -C ./vim72, , for controlling the output of make test, make test >& vim_make_test_log, skip the X window stuff since I do not understand it.

        vim -c ':options'
        took me into the editor and I have no idea what I was supposed to do. Shift-ZZ two times.set spelllang=en,nl

        Monday, June 14, 2010

        Chapter 6.36- 44

        •  Bzip
        • Diffutils
        • Gawk
        • findutils. I do not understand why find has to be moved to bin in place of remaining under /usr/bin. Something about it being needed on the root partition (what is that exactly?)
        • flex
        • gettext
        • groff  use: PAGE=A4 ./configure --prefix=/usr
        • grub, result of  make, root:/sources/grub-1.97.2/build# ls | wc
             2392    2392   62198
          misprint in text: /usr/inclue/grub

        Chapter 6.34- Autoconf

        • autoconf, For full test coverage, Autoconf can be re-tested after Automake has been installed.So I will not delete this directory yet.
        • automake
        • All 672 tests behaved as expected (4 expected failures) (63 tests were not run)
        • Re-run make check for autoconf

          422 tests behaved as expected.
          17 tests were skipped.

        Second Weekend

        I have to get back to where I was. Referring to Chapter 6.4, I ran the relevent mount and chroot commands. However, upon looking at the sources directory, I found a file, index.html, belonging to root. It was created after zlib was downloaded.

        Upon looking for who the index.html file belongs to, I found this for bash:

        Run the newly compiled bash program (replacing the one that is currently being executed):
        exec /bin/bash --login +h
        I am wondering whether I have to do this again. I ran it again, figuring that it can do no harm. See Chapter 6.4 for comments for re-running commands after computer shutdown.

        I think I found the source for the index.html.  I had been looking for the correct version  for zlib and I believe that it was downloaded by mistake. When I open it in Firefox, it refers to Sourge Forge.

        Thursday, June 10, 2010

        Chapter 6.33 Perl

        • Perl "Perl is set up, you can run the interactive Configure script and hand-pick the way this package is built." I would not know where to start so run the defaults.
        • autoconf (Interupted....See post after Second Weekend)

        Chapter 6.17-32

        • sed
        • pkg-config
        • ncurses - did not "create non-wide-character Ncurses libraries". I do not know what it means. Not happy with this "Trick such applications".
        • util-linux-ng-2.17
        • e2fsprogs
        • Coreutils-8.4 (apply patches ). I am running the test suite so I need to do all that group name stuff. Tests taking a long time.
        • iana-etc-2.30 This is a new one for me. Internet assigned numbers authority.
        • m4
        • bison
        • procps
        • grep-
          • "Glibc's regex library is broken when building against Glibc-2.11.1. This switch forces the use of Glibc's regex". So there are multiple libraries with the same name?
          • 1 of 14 failed tests, ok.
        • readline
        • bash- I am not learning anything from running these tests. I don't understand the "nobody" stuff.
        • gdbm 
        • inetutils

        Chapter 6.16 GCC

         gcc No mention of patch, so do not apply. Skip references to BLFS.

        Doing the tests, I had to leave the computer on overnight, it was taking very log. There were an awful lot of worrisome errors appearing.

        To receive a summary of the test suite results, run:
        ../gcc-4.4.3/contrib/test_summary
         
        

        Well. Too much scrolled past.
        root:/sources/gcc-build# ../gcc-4.4.3/contrib/test_summary | grep -A7 Summ > piped_summary

        Now, I have to compare this output with LFS output gcc. This is not a simple matter. The statement "Unless the test results are vastly different from those at the above URL, it is safe to continue." is a bit vague. I'll interpret it as an understanding that some errors will occur. The libmudflap does appear in my report and is the only "unexpected" failure.  So proceed with the install.
        Done.

        Chapter 6.13-15 gmp, mpfr,file

        • gmp
        • mpfr
        • file

        Wednesday, June 9, 2010

        Chapter 6.12 Binutils-2.20

        Ah, binutils again. There are no problems with the statement:
        expect -c "spawn ls"

        This had been a worry of mine when I first started in Chapter 5.
        No problems.

        Chapter 6.11 Zlib 1.2.3

        Hmm. I have no zlib in my sources. It seems that just last week there has been an update to 1.2.5. Since the manual I am using is NOT the newest one (Version SVN-201006010), I would like to stay with the 1.2.3 version. So, I googled zlib .1.2.3 and found it on SourceForge. Since I cannot use wget in the root system to which I chroot'd, I open another xterm and log on to my regular session as root. I change directory to $LFS/sources and run:

        [$LFS/sources#]wget http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz

        Ok! Now,return to the xterm to which I had  chroot'd. (Tip, change background color of these terminals just to diffentiate them from the normal one).

        Back in business. Configure mentions CFLAGS variable, but since I have been following their instructions verbatum, I suppose it is not important.

        Make shared library and then a static library.

        Chapter 6.10 Re-adjusting the Toolchain

        Follow instructions as is. I was a bit surprised to see: i686-pc-linux-gnu in the output because I thought that it should be lfs in place of pc. Not too worried.

        "It is a good idea to visually inspect the specs file" but where is it? I ran the gcc -dumpspecs command at root level. Which is ok.
        /root:/# find / -name specs
        /tools/lib/gcc/i686-lfs-linux-gnu/4.4.3/specs
        /tools/lib/gcc/i686-pc-linux-gnu/4.4.3/specs

        Running diff betwen these two files yields too many differences. What I do notice is that, tools does not appear in the -pc- specs. And, it was created today. (That is what the command did, but the sed commands are quite intricate.)
        root:/tools/lib/gcc# ls -lrt i686-*-linux-gnu/4.4.3/specs
        -rw-r--r-- 1 root root 4616 Jun  1 13:17 i686-lfs-linux-gnu/4.4.3/specs
        -rw-r--r-- 1 root root 4731 Jun  9 10:53 i686-pc-linux-gnu/4.4.3/specs
        Proceed with remainder of commands and checks. Everything is OK!

        Chapter 6.9. Glibc-2.11.1

        Just input all statements in the outlined box. I have no idea what they mean. This is going to take a while, I think. Run all the commands and check whether there is any errors:

        root:/sources/glibc-build# grep Error glibc-check-log
        make[2]: [/sources/glibc-build/posix/annexc.out] Error 1 (ignored)


        I don't really understand the locale stuff. I do not want other languages clogging up my system, as I intend to first stay with english.Since I live in the Netherlands,I will also add that. Hmm. more does not work.

        root:/sources/glibc-2.11.1/localedata# cat SUPPORTED  | grep NL
        Gives me (my comments after <<):
        fy_NL/UTF-8 \                      << frisian NL
        li_NL/UTF-8 \                       << belgian (limburg)
        nds_NL/UTF-8 \                   << Lower Saxson
        nl_NL.UTF-8/UTF-8 \           << Netherlands
        nl_NL/ISO-8859-1 \              << Netherlands
        nl_NL@euro/ISO-8859-15 \ << Netherlands

        So, if I use the Frenchcommands as a template,

        localedef -i fr_FR -f ISO-8859-1 fr_FR
        localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
        localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
         
        localedef -i nl_NL -f ISO-8859-1 nl_NL
        localedef -i nl_NL@euro -f ISO-8859-15 nl_NL@euro
        localedef -i nl_NL -f UTF-8 nl_NL.UTF-8

        I just installed hardinfo() on my session (not the LFS partition). This command will output some info, among which is the language labels and what they mean. That's what I used to add the comments above. Honestly, I have never heard of Lower Saxon Netherlands. Some overlap with lowe saxon Germany, no doubt.

        Here's  a nice command, found here:

        /home/myname%echo "I live in `locale territory`"
        Output = I live in Netherlands
        Here's the command for finding what is in locale_archive (it's binary so cat won't show anything human readable). This gives me a list. I will use it to verify that my dutch commands worked.

        root:/usr/lib/locale#locale -a



        So, first, save the original list and then install the dutch.
        root:/usr/lib/locale# locale -a > original_files.txt

        root:/usr/lib/locale# localedef -i nl_NL -f ISO-8859-1 nl_NL
        root:/usr/lib/locale# locale -a > new_files.txt
        root:/usr/lib/locale# diff -cw original_files.txt new_files.txt 



        *** original_files.txt    Wed Jun  9 10:17:16 2010
        --- new_files.txt    Wed Jun  9 10:18:13 2010
        ***************
        *** 26,30 ****
        --- 26,32 ----
          it_IT.iso88591
          ja_JP
          ja_JP.eucjp
        + nl_NL
        + nl_NL.iso88591
          tr_TR.utf8
          zh_CN.gb18030
        Ok, I will add the second two lines as well. Next, timezone

        root:/#cp -v --remove-destination /usr/share/zoneinfo/Europe/Amsterdam  /etc/localtime



        Add directories to the dynamic loader's search path, I note this because the search defaults for linux are unkown to me. This is one clue.

        Done.



        Tuesday, June 8, 2010

        Chapter 6.8 man-pages

        make install. That's it.

        Chapter 6.7. Linux-2.6.32.8 API Headers

        Well, after some comentary about log files. we are back to installing all of a sudden. I remember the phrase make mrproper from Chapter 5. I guess I need to install the linux package again.

        root:/sources# tar -jxf linux-2.6.32.8.tar.bz2



        root:/sources# cd linux

        make headers_check
        make INSTALL_HDR_PATH=dest headers_install
        find dest/include \( -name .install -o -name ..install.cmd \) -delete
        cp -rv dest/include/* /usr/include

        APT = Application Programming Interface.

        I am not learning much from the short description.

        root:/sources/linux-2.6.32.8#make install 

        AAAAAAAAAAAAAh! lots of errors!

        scripts/kconfig/conf -s arch/x86/Kconfig
        ***
        *** You have not yet configured your kernel!
        *** (missing kernel config file ".config")
        ***
        *** Please run some configurator (e.g. "make oldconfig" or
        *** "make menuconfig" or "make xconfig").
        ***
        make[2]: *** [silentoldconfig] Error 1
        make[1]: *** [silentoldconfig] Error 2
        sh /sources/linux-2.6.32.8/arch/x86/boot/install.sh arch/x86/boot/bzImage \
        System.map "/boot"

        *** Missing file: System.map
        *** You need to run "make" before "make install".

        make[1]: *** [install] E
        rror 1
        make: *** [install] Error 2




        Not paying attention again. I should have left linux and moved on to unpacking the man package!

        Chapter 6.6 Files and Links

        Continue from yesterday (did all the mounting anc chroot).

        I have no name!:/#ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin

        Notice that the tools directory does not have $LFS in front of it anymore.

         
         
        exec /tools/bin/bash --login +h

        Chapter 6.5 Creating Directories

        Left off reading this link http://www.pathname.com/fhs/ It's a 52 page document that I just can't read at the moment. It seems though, tha theyhave standadized where everything should be put. That's handy.

        Monday, June 7, 2010

        Chapter 6.4 Entering the Chroot **Important commands**

        Gulp. I read all that stuff in between about the package installers. I look forward to actually learning who does what.

        It is important that all the commands throughout the remainder of this chapter and the following chapters are run from within the chroot environment. If you leave this environment for any reason (rebooting for example), ensure that the virtual kernel filesystems are mounted as explained in Section 6.2.2, “Mounting and Populating /dev” and Section 6.2.3, “Mounting Virtual Kernel File Systems” and enter chroot again before continuing with the installation.

        I doubt that I will finish this today, so I must remember this. Here are the mount commands from Section 6.2.2 and 6.2.3.

        Keep in mind that my root does not have LFS in it's bash file, so I first explicitly type,   
        export LFS=/media/lfs
        mount -v -t ext3 /dev/sdb6 $LFS

        mount -v --bind /dev $LFS/dev
        mount -vt devpts devpts $LFS/dev/pts
        mount -vt tmpfs shm $LFS/dev/shm
        mount -vt proc proc $LFS/proc
        mount -vt sysfs sysfs $LFS/sys

        Here's the command to change root.

        chroot "$LFS" /tools/bin/env -i \
            HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
            PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
            /tools/bin/bash --login +h

        I am curious about this command, chroot. According to the man page:

        chroot - run command or interactive shell with special root directory
        SYNOPSIS: chroot NEWROOT [COMMAND...]. "The Bash shell is told that $LFS is now the root (/) directory. " The result of this command, other than that it has no name,  is that, when I type, pwd, I get the "/" mark. There are 19 directories, including tools and sources.

        This is just a little weird. if I cd /, I get to the top of this partition $LFS and not to my original session. This concept of chroot is totally alien to me. But, I will move on.

        I added this after Second Weekend blog entry.

        exec /bin/bash --login +h

        I am not sure if it is necessary. The assumptions seem to be that this is all done in one sitting, except for the warning with the chroot.  I am assuming that running it again cannot hurt.

        Chapter 6.2. Preparing Virtual Kernel File Systems

        Here we go. Following all recomendations (no optimisation, no parallel compiling). Recall from Chapter 5,

        The commands in the remainder of this book must be performed while logged in as user root and no longer as user lfs. Also, double check that $LFS is set in root's environment.

        Ok, so type "su -" and log in as root. (check echo $LFS, else export LFS=/media/lfs)

        This makes "directories onto which the file systems will be mounted:"
        mkdir -v $LFS/{dev,proc,sys}

        I have no idea what a device node is.The numbers 5 1 and 1 3 appear in the file listing.

        mknod -m 600 $LFS/dev/console c 5 1
        mknod -m 666 $LFS/dev/null c 1 3
         
        crw------- 1 root root 5, 1 2010-06-07 16:43 console
        crw-rw-rw- 1 root root 1, 3 2010-06-07 16:43 null
        

        Not really sure what this means: "A bind mount is a special type of mount that allows you to create a mirror of a directory or mount point to some other location.", or rather its purpose.

        Here are the outputs ($LFS replacing my real directory) of the mount command. Not sure why each one is different or whether I should worry about it.
        • mount: devpts already mounted or $LFS/dev/pts busy,
          mount: according to mtab, devpts is already mounted on $LFS/dev/pts
        • shm on $LFS/dev/shm type tmpfs (rw)
        • $LFS/proc on $LFS/proc type proc (rw)
        • sysfs on $LFS/sys type sysfs (rw)
        Output of df looks very strange for shm:
         /dev/sdb6             9,9G  651M  8,8G   7% $LFS
        shm                    760M     0      760M   0% $LFS/dev/shm
        Maybe I do not see the others because they are virtual Kernel filesystems? shm is shared memory, it seems.


          Review after weekend

          I have lost momentum over the weekend. Upon re-reading the last entry (Chapter 5.31 and 5.32) I am reminded that I should make a backup of the tools directory. Good. I recall that being important. I'll make 2. I do this as root so that I can save it in a special directory called "backup", owned by root.

          [backup]#dump -A tools_toc -f tools_dump -L LFS_TOOLS_LABEL -v $LFS/tools

          Check using restore,

          [directory_where_to_unpack]#restore -xf /backup/tools_dump -A /backup/tools_toc

          OK. dump is much faster than tar'ing and zip'ing, although it creates a 255MB file whereas tar'ing and zip'ing make an 80 MB file.

          No matter, log in to current session as lfs, su - lfs. I had made a text file called "things_to_do_first" which is a reminder to umount and mount the lfs partition. cd to $LFS and I am ready to start.

          I am re-reading the section of Chapter 5. After all this effort at keeping tools ownership as lfs, now I have to change it to root.

          ....%$#$%! Cleaning up a bit, I did something stupid and deleted my sources and tools directory. I easily restored the tools directory, luckily. But I have to download the sources again. Problem was that I had mounted the same partition as / AND /home. I wonder why it is allowed to have multiple names. Anyway, I forgot about home and thought that it was just one of the test files I made while testing the dump and restore. Sad to say, I have made this kind of mistake long ago....

          As root,
          [$LFS/sources]#wget -i wget-list
           74 files, 260M in 6m 3s (734 KB/s)

          [$LFS/sources]#chown -R lfs:lfs * (should be owned by lfs, although tools is now root owned).

          Thursday, June 3, 2010

          Chapter 5.31 and 32

          Well, no package called stripping, so just follow the text. I do not like having unused files cluttering up the disk, so I am going to learn this.

          Remaining in tools,620 directories, 8251 files. I forgot to run tree before this. Oh well.  I have 10GB partition so I am not worried about space.

          Chapter 5.32 Getting ready for the big test. 

          I am going to back up tools directory regardless. Just in case I mess up somewhere in chapter 6. I have not spend all my time doing this setup, but I estimate that it took about 20 hours altogether.

          Chapter 5.29 Tar

          ## ------------- ##
          ## Test results. ##
          ## ------------- ##

          70 tests were successful.
          7 tests were skipped.

          Chapter 5.28 SED

          make check results:


          ======================================================
          All 65 tests behaved as expected (4 expected failures)
          ======================================================

          Chapter 5.27 Perl

          ok.

          Chapter 5.26 Patch

          During make, I get: $LFS/sources/patch-2.6.1/src/patch.c:1542: warning: the use of `mktemp' is dangerous, better use `mkstemp'

          Igonore for now.

          Chapter 5.25 Make

          Result of make check.

          351 Tests in 96 Categories Complete ... No Failures :-)

          The system uptime program believes the load average to be:
          uptime
           12:20pm  up   5:27,  5 users,  load average: 0.53, 0.68, 0.88
          The GNU load average checking code thinks:
          ./loadavg
          1-minute: 0.530000  5-minute: 0.680000  15-minute: 0.880000

          =====================================================================
           Regression PASSED: GNU Make 3.81 (i686-pc-linux-gnu) built with gcc
          =====================================================================

          Chapter 5.22 Grep

          Sigh, 10 more packages. Slow and steady. Let's not be hasty.

          Chapter 5.21 Gettext

          Starting to get bored. Oh, I have to go into a subdirectory here. $LFS/sources/gettext-0.17%cd gettext-tools. Pay attention.

          334 directories, 7783 files

          Chapter 5.20 Gawk

          I saw a "Good Luck?" message after the gawk configure.

          Just for fun, make check:
          ======== Done with tests that can vary based on character set or locale support ========
          make[2]: Entering directory `/media/lfs/sources/gawk-3.1.7/test'
          3 TESTS FAILED

          This should be ok.

          Chapter 5.19 Findutils

          OK.

          Chapter 5.18 Diffutils

          Ok. Not installiing patches unless explicitly stated.

          Chapter 5.17 Coreutils

          No problem installing. All 184 tests passed
          (18 tests were not run)

          Chapter 5.16 Bzip

          Another familiar name, and a patch file. Ah, at least this time it is mentioned that the configure script is not needed. (unlike the missing make with DejaGnu) Done.

          Wait, there was a patch. I checked Chapter 6 and it is explicitly installed there so I will NOT install it here.

          Chapter 5.15 Bash

          Ah, I know what bash is.  Just a minor glitch, no doubt due to my messing with the color of the prompt. Up until now, when I copy and paste from the documents, I have seen the entire command output on several lines. Now, the long lines are output to the beginning of the same line.
          i.e. This:  ./configure --prefix=/tools --without-bash-malloc

          Looked like:
          -malloclfs/sources/bash-4.1%./configure --prefix=/tools --without-bash-

          I checked that it worked properly by the first line in config.log, which helpfully repeats the command.

          Run make test, just to familiarize myself with what it is doing. All is well. Using tree, I get:
          277 directories, 7349 files

          Chapter 5.14 Ncurses

          Another package whose name I have seen but I have no idea what it does.
          Ok, followed the instructions. Nothing odd to report.

          Chapter 5.13 DejaGNU

          I'm beginning to get the hang of this.
          $LFS/sources/dejagnu-1.4.4$ ./configure --prefix=/tools OK!

          Where is the make command?After much digging, I found this here:
          September 22nd, 2003 [jeremy]: Removed the make command from DejaGnu, since it performs nothing.
          Well, if it doesn't do anything, running it should not do any harm, right? What does the Makefile look like? I don't see anything.

          $LFS/sources/dejagnu-1.4.4$ make
          Making all in doc
          make[1]: Entering directory `/media/lfs/sources/dejagnu-1.4.4/doc'
          make[1]: Nothing to be done for `all'.
          make[1]: Leaving directory `/media/lfs/sources/dejagnu-1.4.4/doc'
          make[1]: Entering directory `/media/lfs/sources/dejagnu-1.4.4'
          make[1]: Nothing to be done for `all-am'.
          make[1]: Leaving directory `/media/lfs/sources/dejagnu-1.4.4'
          Indeed, it does nothing. Running make install and make check. I have got problems with make check. The word ERROR shows up clearly.

          I did some searching just in case. I installed expect on my normal session and ran the command: expect -c "spawn ls". The output was "spawn ls" with no message of errors.  I conclude that it is the $LFS which cannot do this, and since it does not even have a kernel yet, it seems pointless to try and correct this error now.  But, it is good that I have been alerted to this anyway, in case it does come up in Chapter 6.

          Wednesday, June 2, 2010

          Chapter 5.12 Expect

          There are several expect files:
          $LFS/sources$ ls -l expect*
          -rw-r--r-- 1 lfs lfs 6824 Mar 1 21:30 expect-5.43.0-spawn-1.patch
          -rw-r--r-- 1 lfs lfs 6824 Mar 1 21:30 expect-5.43.0-spawn-1.patch.1
          -rw-r--r-- 1 lfs lfs 4150 Mar 1 21:30 expect-5.43.0-tcl_8.5.5_fix-1.patch
          -rw-r--r-- 1 lfs lfs 4150 Mar 1 21:30 expect-5.43.0-tcl_8.5.5_fix-1.patch.1
          -rw-r--r-- 1 lfs lfs 525572 Feb 2 2006 expect-5.43.0.tar.gz

          Hmmm. Looks like I downloaded this twice, because the .1 at the end of the spawn and fix means that they are doubles. The document applies only two patches.

          Do all the configure,make and make test. Some errors which I am told not to worry about (one of which is the ptys error which I have been warned about. I will skip it for now.
          all.tcl: Total 15 Passed 2 Skipped 0 Failed 13
          Sourced 0 Test Files.
          Files with failing tests: cat.test logfile.test pid.test send.test spawn.test stty.test

          I forgot to run tree after the tcl/unix install, but here it is at the end of this chapter. $LFS/tools$ tree
          213 directories, 3833 files.

          Chapter 5.11 Tcl

          Unpack tcl8.5.8 and cd into it. That's where the directory unix is. Although not necessary, I am running ths suggested test, remaining inside the unix subdirectory.

          Here's the result:

          Tests ended at Wed Jun 02 08:07:30 UTC 2010
          all.tcl: Total 24472 Passed 23366 Skipped 1106 Failed 0
          Sourced 137 Test Files.


          Next, install to $LFS/tools directory using make install (as user lfs).
          Before changing the permissions,
          $LFS/tools/lib$ ls -l libtcl*
          -r-xr-xr-x 1 lfs lfs 1146739 Jun 2 10:09 libtcl8.5.so

          After changing permissions (chmod -v u+w /tools/lib/libtcl8.5.so)
          tools/lib$ ls -l libtcl*.so
          -rwxr-xr-x 1 lfs lfs 1146739 Jun 2 10:09 libtcl8.5.so

          Ok, writable for user lfs. Follow remaining commands. I stay in the unix directory. I am deleting all the created tcl directories under $LFS/source. There is only one, no build directory was created.

          Tuesday, June 1, 2010

          Chapter 5.10 GCC Pass 2

          Oh dear. Now they want the patch installed? I have done this already. Did this affect the first pass? Should I run it again? Yes, because I deleted the sources and have to re-configure.

          Being sure to cd into gcc directory first, run the patch command.

          Bootstrap is a funny word.


          "Before starting to build GCC, remember to unset any environment variables that override the default optimization flags. " This sounds rather important but I don't know what to do. I have saved my environment (using env) just in case something goes wrong. But for now, continue. During the make, all the paths have the word tools in them.

          Hooray! So far so good,

          readelf -l a.out | grep ': /tools'
          [Requesting program interpreter: /tools/lib/ld-linux.so.2]


          Tools directory, tree gives me 200 files,2879 files.

          Chapter 5.9 Binutils Pass 2

          Can you find the error?

          $LFS/sources$ mkdir -v ../binutils-build
          mkdir: cannot create directory `../binutils-build': Permission denied

          A moments lapse and near disaster. I went to make some tea and forgot which directory I was in. This makes the insistance that everything be done as user lfs so important.

          Not much else to say. I just followed the rest of the instructions and everything went ok.

          Chapter 5.8 Toolchain

          Getting a bit scary...Reading technical notes because I really do not know what they are talking about. The purpose of this discussion is, I believe, to demonstrate that I am NOT supposed to see ANYTHING in the text that refers to /usr or /lib.

          1. Name of the platform? I dutifully unpacked binutils and ran the command ./config.guess (I got a "command not found" without the dot) and I have: i686-pc-linux-gnu.
          2. Platform's dynamic linker*. A random binary? I tried gcc. readelf -l /usr/bin/gcc | grep interpreter

            [Requesting program interpreter: /lib/ld-linux.so.2]
          3. Linker library search order: ld --verbose | grep SEARCH

            SEARCH_DIR("/usr/i586-mandriva-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
          4. Detailed information about the preprocessor, compilation, and assembly stages, gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded

            Several lines that look like: "attempt to open /lib/ld-linux.so.2 succeeded"
          (*) definition: "dynamic linker provided by Glibc finds and loads the shared libraries needed by a program, prepares the program to run, and then runs it)"



          I believe that the next commands will change the environment. It is therefore not important from which directory they are run. I do not understand what the SPECS is doing but note that it is unset at the end. Meaning, it has no meaning in my current environment (not lfs yet).

          OK, this looks good! Before all this, in the technical notes section, I had obtained /lib/ld-linux.so.2. Now, when I run: readelf -l a.out | grep ': /tools', I get:  [Requesting program interpreter: /tools/lib/ld-linux.so.2]

          All paths should have the word tools in them!

          Chapter 5.7 Glib

          A quick uname -a tells me I have a i686 AMD Duron(tm) processor and do not have to worry about the i486 note. (I might, if I try to install this on my Pentium II machine. ) I ran this anyway, being unused to using case at the command line, I was curious.
          case `uname -m` in i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;; esac
          No errors... Copy and paste the configure from the web book...aside from the warnings they warn me about, I also get "WARNING: cpuid.h" statements which I will ignore. How many files? $LFS/tools, tree shows 145 directories and 2031 files. Wow. 14% of a 10GB partition.

          Chapter 5.6 Linux

          Yesterday, I did not know what to do at first with this section because I did not read the chapter heading, just searched for the next command in a box. A sort of tunnel vision. I wrote this in my notes: "Though not instructed to do so, I surmised that the linux file was necessary. I confirmed this by looking for evidence of mrproper and I found it in the Makefile." I have used make clean and make distclean but mrproper was new. Everything went smoothly until: $LFS/sources/linux-2.6.32.8$ make headers_check
          /media/lfs/sources/linux-2.6.32.8/usr/include/scsi/scsi.h:162: userspace cannot call function or variable defined in the kernel /media/lfs/sources/linux-2.6.32.8/usr/include/scsi/scsi.h:288: userspace cannot call function or variable defined in the kernel
          Googling finds me this response to a similar question:
          Where is the error? It's just giving a warning. /usr/include/scsi/scsi.h will be overwritten when you install glibc so the fact that it is broken should cause you no problems.
          So, I'll ignore it. Next comes $LFS/sources/linux-2.6.32.8$ make INSTALL_HDR_PATH=dest headers_install $LFS/sources/linux-2.6.32.8$ cp -rv dest/include/* /tools/include And I turn the page...and find that the book has moved on to glib. No configure, make, make install sequence? In tools, the command tree tells me what has changed. 55 directories, 761 files so far. remove ..../sources/linux-2.6.32.8 directory as instructed.

          Chapter 5.5 GCC

          Unpack gcc from within $LFS/sources/ and enter directory $LFS/sources/gcc-4.4.3 The first time, something went wrong and that is when I realized the purpose of the tools directory. But I will review what I did first. Unpack in the $LFS/sources directory. CD into the gcc directory. There is a patch, which I am unfamiliar with, so I applied this command from within gcc directory (sorry to be repetitive but it is really important to keep track of where one is):  

          patch -Np1 -i ../gcc-4.4.3-startfiles_fix-1.patch

          I get message, patching file ..../sources/gcc-4.4.3/gcc.c Followed the rest of the instructions from the book until I got to the ln command. I knew this was a soft link and whenever I have done this in the past, I always created the link assuming that it would be made in the directory from which I ran the command. But, everything in sources/ was to be deleted so this did not make sense. I ran it and got an error, something about libgcc.a not being found. Oh. I tried using locate libgcc.a but that only found the one in /usr/lib which I am not supposed to use. This is when I looked at the tools directory and realized its importance (I mentioned this also in the binutils section of this blog). I saw the ownership conflicts between lfs and root and decided that I must be doing something wrong.

          I started over. Delete all created directories in sources and tools. Re-installed bin-utils. This created 10 directories and 66 files in $LFS/tools directory (using tree). Re-installed gcc. I saw that the path $LFS/tools/bin.../lib/gcc/i686-lfs.../4.4.3/ was being created and that that is where the libgcc.a was located. I ran the soft link command from the $LFS/sources/gcc-4.4.3 directory and, to my surprise, it wrote it in the directory under tools. Well, curiosity got the best of me and I read the info page:info ln. It turns out that there are three ways to make a soft link, one of which is implied. These are my least favorite kind of commands:

          If the `--target-directory' (`-t') option is given, or failing that if the last file is a directory and the `--no-target-directory' (`-T') option is not given, `ln' creates a link to each TARGET file in the specified directory, using the TARGETs' names.

          This a bit confusing, from my perspective. But, no errors. Next, make mrproper gives me an error. No rule to make target. Well, searched around a bit and after wasting I don't know how much time, realized that I was suppposed to move on to the next package. I was so deep in following the instructions that I did not look at the Section headers. in $LFS/tools, tree command shows: 27 directories and 135 files.

          Chapter 5.4 Binutils

          Here is where I encountered the distinction between sources directory and package sources. The word sources was used in two different contexts. Everything had to be in the $LFS/sources directory. This means the downloaded compressed files. I decided to unpack them one by one, at need. My first suspicion that something was going wrong was the mixture of file ownership in the tools directory (varied between roor and lfs). This is because I was doing "make install" as root. I started over again. Another problem I have is interpreting the text which scrolls by during the configure, make and make install. Words such as "cannot find" cause me alarm. But, upon more reading, I found someone who said: If there is an error, you will know about it at the end. After the "make install" which is the step where everything needed is placed in the $LFS/tools directory. That's why I can safely delete the binutils-source and binutils-2.2.0 directories. I keep the compressed file in case I have to re-do the process.

          Linux from Scratch Version 6.6

          I finally have taken the plunge. After fiddling with linux for so many years, I hope to finally understand how it works (and hopefully how to fix it when it goes wrong). Except where explicitly said, all commands should run as lfs and not root. This includes even "make install" which ordinarily I would have run as root. Comments from me are usually something I forgot to note, or something I did not realize until the next day. This saves me from having to edit the original note.

          I use the directory structure $LFS/source$. It's too bad I did not change the $ after source. Somewhere in the bash it can be changed. To the uninitiated, the multiple $ with very different meanings, might be confusing. Perhaps at the end of all this I will go back and change it to something else.

          Monday, May 31, 2010

          Introduction

          This will be the third blog that I am attempting to start. It's purpose is to summarize things that I am doing and what I may be learning. Linux will appear frequently, as well as some science related notes. Mostly it is a place for me to keep important linux commands that I keep forgetting. I currently work between 3 computers, 2 of which are dual booted with Linux and Windows XP. So, it helps to have my notes on the internet where I can find them.